Remove redundant codes for detecting Orchestrator.
Signed-off-by: Kiefer Chang <kiefer.chang@suse.com>
-<cd-alert-panel type="info"
- *ngIf="!orchestratorExist && !checkingOrchestrator"
- i18n>Please consult the
- <a href="{{ docsUrl }}"
- target="_blank">documentation</a> on how to
- configure and enable the orchestrator functionality.</cd-alert-panel>
-
-<ng-container *ngIf="orchestratorExist">
+<cd-orchestrator-doc-panel *ngIf="!hasOrchestrator"></cd-orchestrator-doc-panel>
+<ng-container *ngIf="hasOrchestrator">
<legend i18n>Devices</legend>
<div class="row">
<div class="col-md-12">
import { OrchestratorService } from '../../../shared/api/orchestrator.service';
import { Icons } from '../../../shared/enum/icons.enum';
-import { CephReleaseNamePipe } from '../../../shared/pipes/ceph-release-name.pipe';
-import { SummaryService } from '../../../shared/services/summary.service';
import { InventoryDevice } from './inventory-devices/inventory-device.model';
@Component({
icons = Icons;
- checkingOrchestrator = true;
- orchestratorExist = false;
+ hasOrchestrator = false;
docsUrl: string;
devices: Array<InventoryDevice> = [];
- constructor(
- private cephReleaseNamePipe: CephReleaseNamePipe,
- private orchService: OrchestratorService,
- private summaryService: SummaryService
- ) {}
+ constructor(private orchService: OrchestratorService) {}
ngOnInit() {
- // duplicated code with grafana
- const subs = this.summaryService.subscribe((summary: any) => {
- if (!summary) {
- return;
+ this.orchService.status().subscribe((status) => {
+ this.hasOrchestrator = status.available;
+ if (status.available) {
+ this.getInventory();
}
-
- const releaseName = this.cephReleaseNamePipe.transform(summary.version);
- this.docsUrl = `http://docs.ceph.com/docs/${releaseName}/mgr/orchestrator/`;
-
- setTimeout(() => {
- subs.unsubscribe();
- }, 0);
- });
-
- this.orchService.status().subscribe((data: { available: boolean }) => {
- this.orchestratorExist = data.available;
- this.checkingOrchestrator = false;
});
}
ngOnChanges() {
- if (this.orchestratorExist) {
+ if (this.hasOrchestrator) {
this.devices = [];
this.getInventory();
}
-<cd-loading-panel *ngIf="loading"
- i18n>Loading...</cd-loading-panel>
-<cd-alert-panel type="info"
- *ngIf="!orchestratorExist && !checkingOrchestrator"
- i18n>Please consult the
- <a href="{{ docsUrl }}"
- target="_blank">documentation</a> on how to
- configure and enable the orchestrator functionality.</cd-alert-panel>
+<cd-orchestrator-doc-panel *ngIf="!hasOrchestrator"></cd-orchestrator-doc-panel>
<div class="cd-col-form"
- *ngIf="!loading && orchestratorExist">
+ *ngIf="!loading && hasOrchestrator">
<form name="form"
#formDir="ngForm"
[formGroup]="form"
import { Icons } from '../../../../shared/enum/icons.enum';
import { CdFormGroup } from '../../../../shared/forms/cd-form-group';
import { CdTableColumn } from '../../../../shared/models/cd-table-column';
-import { CephReleaseNamePipe } from '../../../../shared/pipes/ceph-release-name.pipe';
import { AuthStorageService } from '../../../../shared/services/auth-storage.service';
-import { SummaryService } from '../../../../shared/services/summary.service';
import { InventoryDevice } from '../../inventory/inventory-devices/inventory-device.model';
import { OsdCreationPreviewModalComponent } from '../osd-creation-preview-modal/osd-creation-preview-modal.component';
import { DevicesSelectionChangeEvent } from '../osd-devices-selection-groups/devices-selection-change-event.interface';
features: { [key: string]: OsdFeature };
featureList: OsdFeature[] = [];
- checkingOrchestrator = true;
- orchestratorExist = false;
+ hasOrchestrator = false;
docsUrl: string;
constructor(
private i18n: I18n,
private orchService: OrchestratorService,
private router: Router,
- private bsModalService: BsModalService,
- private summaryService: SummaryService,
- private cephReleaseNamePipe: CephReleaseNamePipe
+ private bsModalService: BsModalService
) {
this.resource = this.i18n('OSDs');
this.action = this.actionLabels.CREATE;
}
ngOnInit() {
- const subs = this.summaryService.subscribe((summary: any) => {
- if (!summary) {
- return;
- }
-
- const releaseName = this.cephReleaseNamePipe.transform(summary.version);
- this.docsUrl = `http://docs.ceph.com/docs/${releaseName}/mgr/orchestrator/`;
-
- setTimeout(() => {
- subs.unsubscribe();
- }, 0);
- });
-
- this.orchService.status().subscribe((data: { available: boolean }) => {
- this.orchestratorExist = data.available;
- this.checkingOrchestrator = false;
- if (this.orchestratorExist) {
+ this.orchService.status().subscribe((status) => {
+ this.hasOrchestrator = status.available;
+ if (this.hasOrchestrator) {
this.getDataDevices();
}
});
-<cd-alert-panel type="info"
- *ngIf="!orchestratorExist && !checkingOrchestrator"
- i18n>Please consult the
- <a href="{{ docsUrl }}"
- target="_blank">documentation</a> on how to
- configure and enable the orchestrator functionality.</cd-alert-panel>
-
-<ng-container *ngIf="orchestratorExist">
+<cd-orchestrator-doc-panel *ngIf="!hasOrchestrator"></cd-orchestrator-doc-panel>
+<ng-container *ngIf="hasOrchestrator">
<cd-table [data]="services"
[columns]="columns"
identifier="service_name"
import { CdTableSelection } from '../../../shared/models/cd-table-selection';
import { Permissions } from '../../../shared/models/permissions';
import { CephService } from '../../../shared/models/service.interface';
-import { CephReleaseNamePipe } from '../../../shared/pipes/ceph-release-name.pipe';
import { AuthStorageService } from '../../../shared/services/auth-storage.service';
-import { SummaryService } from '../../../shared/services/summary.service';
@Component({
selector: 'cd-services',
checkingOrchestrator = true;
orchestratorExist = false;
+ hasOrchestrator = false;
docsUrl: string;
columns: Array<CdTableColumn> = [];
constructor(
private authStorageService: AuthStorageService,
- private cephReleaseNamePipe: CephReleaseNamePipe,
private i18n: I18n,
private orchService: OrchestratorService,
- private cephServiceService: CephServiceService,
- private summaryService: SummaryService
+ private cephServiceService: CephServiceService
) {
this.permissions = this.authStorageService.getPermissions();
}
return !this.hiddenColumns.includes(col.prop);
});
- // duplicated code with grafana
- const subs = this.summaryService.subscribe((summary: any) => {
- if (!summary) {
- return;
- }
-
- const releaseName = this.cephReleaseNamePipe.transform(summary.version);
- this.docsUrl = `http://docs.ceph.com/docs/${releaseName}/mgr/orchestrator/`;
-
- setTimeout(() => {
- subs.unsubscribe();
- }, 0);
- });
-
- this.orchService.status().subscribe((data: { available: boolean }) => {
- this.orchestratorExist = data.available;
- this.checkingOrchestrator = false;
+ this.orchService.status().subscribe((status) => {
+ this.hasOrchestrator = status.available;
});
}