// in different steps
this.getTableCell(this.columnIndex.hostname, hostname).click();
}
+
+ checkServiceInstancesExist(hostname: string, instances: string[]) {
+ this.getTableCell(this.columnIndex.hostname, hostname)
+ .parent()
+ .find(`datatable-body-cell:nth-child(${this.columnIndex.services}) .badge`)
+ .should(($ele) => {
+ const serviceInstances = $ele.toArray().map((v) => v.innerText);
+ for (const instance of instances) {
+ expect(serviceInstances).to.include(instance);
+ }
+ });
+ }
}
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import _ from 'lodash';
-import { Subscription } from 'rxjs';
+import { Observable, Subscription } from 'rxjs';
import { map, mergeMap } from 'rxjs/operators';
import { HostService } from '~/app/shared/api/host.service';
import { CdTableColumn } from '~/app/shared/models/cd-table-column';
import { CdTableFetchDataContext } from '~/app/shared/models/cd-table-fetch-data-context';
import { CdTableSelection } from '~/app/shared/models/cd-table-selection';
+import { Daemon } from '~/app/shared/models/daemon.interface';
import { FinishedTask } from '~/app/shared/models/finished-task';
import { OrchestratorFeature } from '~/app/shared/models/orchestrator.enum';
import { OrchestratorStatus } from '~/app/shared/models/orchestrator.interface';
hostList.map((host) => {
const counts = {};
host['service_instances'] = new Set<string>();
- host['services'].forEach((service: any) => {
- counts[service.type] = (counts[service.type] || 0) + 1;
- });
- host['services'].map((service: any) => {
- host['service_instances'].add(`${service.type}: ${counts[service.type]}`);
- });
+ if (this.orchStatus?.available) {
+ let daemons: Daemon[] = [];
+ let observable: Observable<Daemon[]>;
+ observable = this.hostService.getDaemons(host['hostname']);
+ observable.subscribe((dmns: Daemon[]) => {
+ daemons = dmns;
+ daemons.forEach((daemon: any) => {
+ counts[daemon.daemon_type] = (counts[daemon.daemon_type] || 0) + 1;
+ });
+ daemons.map((daemon: any) => {
+ host['service_instances'].add(
+ `${daemon.daemon_type}: ${counts[daemon.daemon_type]}`
+ );
+ });
+ });
+ } else {
+ host['services'].forEach((service: any) => {
+ counts[service.type] = (counts[service.type] || 0) + 1;
+ });
+ host['services'].map((service: any) => {
+ host['service_instances'].add(`${service.type}: ${counts[service.type]}`);
+ });
+ }
return host;
})
)