expect(spans[7].textContent).toBe('N/A');
});
+ it('should test if memory/raw capacity columns shows N/A if facts are available but in fetching state', () => {
+ const features = [OrchestratorFeature.HOST_FACTS];
+ let hostPayload: any[];
+ hostPayload = [
+ {
+ hostname: 'host_test',
+ services: [
+ {
+ type: 'osd',
+ id: '0'
+ }
+ ],
+ cpu_count: 2,
+ cpu_cores: 1,
+ memory_total_kb: undefined,
+ hdd_count: 4,
+ hdd_capacity_bytes: undefined,
+ flash_count: 4,
+ flash_capacity_bytes: undefined,
+ nic_count: 1
+ }
+ ];
+ OrchestratorHelper.mockStatus(true, features);
+ hostListSpy.and.callFake(() => of(hostPayload));
+ fixture.detectChanges();
+
+ component.getHosts(new CdTableFetchDataContext(() => undefined));
+ expect(component.hosts[0]['memory_total_bytes']).toEqual('N/A');
+ expect(component.hosts[0]['raw_capacity']).toEqual('N/A');
+ });
+
it('should show force maintenance modal when it is safe to stop host', () => {
const errorMsg = `WARNING: Stopping 1 out of 1 daemons in Grafana service.
Service will not be operational with no daemons left. At
import { OrchestratorStatus } from '~/app/shared/models/orchestrator.interface';
import { Permissions } from '~/app/shared/models/permissions';
import { DimlessBinaryPipe } from '~/app/shared/pipes/dimless-binary.pipe';
+import { EmptyPipe } from '~/app/shared/pipes/empty.pipe';
import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
import { ModalService } from '~/app/shared/services/modal.service';
import { NotificationService } from '~/app/shared/services/notification.service';
constructor(
private authStorageService: AuthStorageService,
private dimlessBinary: DimlessBinaryPipe,
+ private emptyPipe: EmptyPipe,
private hostService: HostService,
private actionLabels: ActionLabelsI18n,
private modalService: ModalService,
transformHostsData() {
if (this.checkHostsFactsAvailable()) {
_.forEach(this.hosts, (hostKey) => {
- hostKey['memory_total_bytes'] = hostKey['memory_total_kb'] * 1024;
- hostKey['raw_capacity'] = hostKey['hdd_capacity_bytes'] + hostKey['flash_capacity_bytes'];
+ hostKey['memory_total_bytes'] = this.emptyPipe.transform(hostKey['memory_total_kb'] * 1024);
+ hostKey['raw_capacity'] = this.emptyPipe.transform(
+ hostKey['hdd_capacity_bytes'] + hostKey['flash_capacity_bytes']
+ );
});
} else {
// mark host facts columns unavailable