From: Tiago Melo Date: Wed, 17 Jun 2020 16:38:25 +0000 (+0000) Subject: mgr/dashboard: Re-enable OSD's table autoReload X-Git-Tag: v15.2.5~96^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3e982155c7cf7ea1e98c3b53ae0276d76c559bf6;p=ceph.git mgr/dashboard: Re-enable OSD's table autoReload Fixes: https://tracker.ceph.com/issues/45303 Signed-off-by: Tiago Melo (cherry picked from commit e5d94e24ecf676afc5bca7810459f8d1ebda4642) Conflicts: src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.html - Template structure change src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html - Template structure change src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.ts - Optional chaining is not available in older version of TypeScript, use `_.get` to implement it. Signed-off-by: Kiefer Chang --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.html index 3430d00b48af..3769577cb378 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.html @@ -2,22 +2,20 @@ id="tabset-osd-details"> - + - + - + [data]="osd?.details?.osd_metadata"> - + - + [serviceId]="osd?.id"> - Histogram not available: {{ osd.histogram_failed }}
+ *ngIf="osd?.details?.histogram">

Writes

- +

Reads

- +
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.ts index 9cac703d2622..0f9e7f701a82 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.ts @@ -17,7 +17,6 @@ export class OsdDetailsComponent implements OnChanges { osd: { id?: number; - loaded?: boolean; details?: any; histogram_failed?: string; tree?: any; @@ -29,11 +28,11 @@ export class OsdDetailsComponent implements OnChanges { } ngOnChanges() { - this.osd = { - loaded: false - }; - if (this.selection) { + if (_.get(this, 'osd.id') !== _.get(this, 'selection.id')) { this.osd = this.selection; + } + + if (_.isNumber(_.get(this, 'osd.id'))) { this.refresh(); } } @@ -46,7 +45,6 @@ export class OsdDetailsComponent implements OnChanges { this.osd.histogram_failed = data.histogram; this.osd.details.histogram = undefined; } - this.osd.loaded = true; }); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html index 55d0e0219360..65a38cd90a3d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html @@ -1,9 +1,7 @@ - - (this.devices = devices); - if (this.hostname) { - this.hostService.getDevices(this.hostname).subscribe(updateDevicesFn); - } else if (this.osdId !== null) { - this.osdService.getDevices(this.osdId).subscribe(updateDevicesFn); - } this.columns = [ { prop: 'devid', name: this.i18n('Device ID'), minWidth: 200 }, { @@ -79,4 +74,13 @@ export class DeviceListComponent implements OnInit { { prop: 'readableDaemons', name: this.i18n('Daemons') } ]; } + + ngOnChanges() { + const updateDevicesFn = (devices: CdDevice[]) => (this.devices = devices); + if (this.hostname) { + this.hostService.getDevices(this.hostname).subscribe(updateDevicesFn); + } else if (this.osdId !== null) { + this.osdService.getDevices(this.osdId).subscribe(updateDevicesFn); + } + } }