mirror of
https://github.com/ceph/ceph
synced 2025-02-21 09:57:26 +00:00
mgr/dashboard: hide daemon table when orchestrator is disabled
The refresh time of services/daemons is also increased to 1 minute since they are not updated so frequently. Fixes: https://tracker.ceph.com/issues/44558 Signed-off-by: Kiefer Chang <kiefer.chang@suse.com>
This commit is contained in:
parent
5cf9cd5d1c
commit
9587caac41
@ -1,6 +1,9 @@
|
||||
<cd-table [data]="daemons"
|
||||
<cd-orchestrator-doc-panel *ngIf="!hasOrchestrator"></cd-orchestrator-doc-panel>
|
||||
<cd-table *ngIf="hasOrchestrator"
|
||||
#daemonsTable
|
||||
[data]="daemons"
|
||||
[columns]="columns"
|
||||
columnMode="flex"
|
||||
autoReload="0"
|
||||
[autoReload]="60000"
|
||||
(fetchData)="getDaemons($event)">
|
||||
</cd-table>
|
||||
|
@ -1,10 +1,22 @@
|
||||
import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core';
|
||||
|
||||
import {
|
||||
AfterViewInit,
|
||||
Component,
|
||||
Input,
|
||||
OnChanges,
|
||||
OnDestroy,
|
||||
OnInit,
|
||||
QueryList,
|
||||
TemplateRef,
|
||||
ViewChildren
|
||||
} from '@angular/core';
|
||||
import { I18n } from '@ngx-translate/i18n-polyfill';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
import { CephServiceService } from '../../../../shared/api/ceph-service.service';
|
||||
import { HostService } from '../../../../shared/api/host.service';
|
||||
import { OrchestratorService } from '../../../../shared/api/orchestrator.service';
|
||||
import { TableComponent } from '../../../../shared/datatable/table/table.component';
|
||||
import { CdTableColumn } from '../../../../shared/models/cd-table-column';
|
||||
import { CdTableFetchDataContext } from '../../../../shared/models/cd-table-fetch-data-context';
|
||||
@ -15,11 +27,9 @@ import { Daemon } from '../../../../shared/models/daemon.interface';
|
||||
templateUrl: './service-daemon-list.component.html',
|
||||
styleUrls: ['./service-daemon-list.component.scss']
|
||||
})
|
||||
export class ServiceDaemonListComponent implements OnInit, OnChanges {
|
||||
@ViewChild(TableComponent, { static: true })
|
||||
table: TableComponent;
|
||||
@ViewChild('lastSeenTpl', { static: true })
|
||||
lastSeenTpl: TemplateRef<any>;
|
||||
export class ServiceDaemonListComponent implements OnInit, OnChanges, AfterViewInit, OnDestroy {
|
||||
@ViewChildren('daemonsTable')
|
||||
daemonsTableTpls: QueryList<TemplateRef<TableComponent>>;
|
||||
|
||||
@Input()
|
||||
serviceName?: string;
|
||||
@ -30,10 +40,16 @@ export class ServiceDaemonListComponent implements OnInit, OnChanges {
|
||||
daemons: Daemon[] = [];
|
||||
columns: CdTableColumn[] = [];
|
||||
|
||||
hasOrchestrator = false;
|
||||
|
||||
private daemonsTable: TableComponent;
|
||||
private daemonsTableTplsSub: Subscription;
|
||||
|
||||
constructor(
|
||||
private i18n: I18n,
|
||||
private hostService: HostService,
|
||||
private cephServiceService: CephServiceService
|
||||
private cephServiceService: CephServiceService,
|
||||
private orchService: OrchestratorService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
@ -98,15 +114,30 @@ export class ServiceDaemonListComponent implements OnInit, OnChanges {
|
||||
flexGrow: 2
|
||||
}
|
||||
];
|
||||
|
||||
this.orchService.status().subscribe((data: { available: boolean }) => {
|
||||
this.hasOrchestrator = data.available;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnChanges() {
|
||||
this.daemons = [];
|
||||
this.table.reloadData();
|
||||
if (!_.isUndefined(this.daemonsTable)) {
|
||||
this.daemonsTable.reloadData();
|
||||
}
|
||||
}
|
||||
|
||||
updateData(daemons: Daemon[]) {
|
||||
this.daemons = daemons;
|
||||
ngAfterViewInit() {
|
||||
this.daemonsTableTplsSub = this.daemonsTableTpls.changes.subscribe(
|
||||
(tableRefs: QueryList<TableComponent>) => {
|
||||
this.daemonsTable = tableRefs.first;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.daemonsTableTplsSub) {
|
||||
this.daemonsTableTplsSub.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
getDaemons(context: CdTableFetchDataContext) {
|
||||
|
@ -6,6 +6,7 @@
|
||||
forceIdentifier="true"
|
||||
columnMode="flex"
|
||||
selectionType="single"
|
||||
[autoReload]="60000"
|
||||
(fetchData)="getServices($event)"
|
||||
(updateSelection)="updateSelection($event)">
|
||||
<cd-service-details cdTableDetail
|
||||
|
@ -28,7 +28,6 @@ export class ServicesComponent implements OnChanges, OnInit {
|
||||
permissions: Permissions;
|
||||
|
||||
checkingOrchestrator = true;
|
||||
orchestratorExist = false;
|
||||
hasOrchestrator = false;
|
||||
docsUrl: string;
|
||||
|
||||
@ -90,7 +89,7 @@ export class ServicesComponent implements OnChanges, OnInit {
|
||||
}
|
||||
|
||||
ngOnChanges() {
|
||||
if (this.orchestratorExist) {
|
||||
if (this.hasOrchestrator) {
|
||||
this.services = [];
|
||||
this.table.reloadData();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user