From c4d1e95f094db31b24c13e71ad41370ec95fef41 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stephan=20M=C3=BCller?= Date: Wed, 22 Jul 2020 16:00:32 +0200 Subject: [PATCH] mgr/dashboard: Fix regression on table error handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The regression was introduced by #35290 through the use of the new tab module the pools and host listing got wrapped into the new usage, however they needed to use the table as Viewchild and the table was static before, but it's now dynamic. This resulted in an empty variable that wasn't filled with the right table object. The calling of the ".reset()" was not possible during an error case and produced an error in console trying to access "reset" of undefined, by not calling "reset" the table get's stuck with an rotating reload symbol. Fixes: https://tracker.ceph.com/issues/46660 Signed-off-by: Stephan Müller --- .../frontend/src/app/ceph/cluster/hosts/hosts.component.ts | 2 +- .../src/app/ceph/cluster/osd/osd-list/osd-list.component.ts | 3 --- .../src/app/ceph/cluster/services/services.component.ts | 2 +- .../src/app/ceph/pool/pool-list/pool-list.component.ts | 2 +- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts index d1bea0bdd525..259cf869151e 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts @@ -36,7 +36,7 @@ const BASE_URL = 'hosts'; providers: [{ provide: URLBuilderService, useValue: new URLBuilderService(BASE_URL) }] }) export class HostsComponent extends ListWithDetails implements OnInit { - @ViewChild(TableComponent, { static: true }) + @ViewChild(TableComponent) table: TableComponent; @ViewChild('servicesTpl', { static: true }) public servicesTpl: TemplateRef; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts index af298a9e5b16..46a64e39e781 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts @@ -12,7 +12,6 @@ import { ConfirmationModalComponent } from '../../../../shared/components/confir import { CriticalConfirmationModalComponent } from '../../../../shared/components/critical-confirmation-modal/critical-confirmation-modal.component'; import { FormModalComponent } from '../../../../shared/components/form-modal/form-modal.component'; import { ActionLabelsI18n, URLVerbs } from '../../../../shared/constants/app.constants'; -import { TableComponent } from '../../../../shared/datatable/table/table.component'; import { CellTemplate } from '../../../../shared/enum/cell-template.enum'; import { Icons } from '../../../../shared/enum/icons.enum'; import { NotificationType } from '../../../../shared/enum/notification-type.enum'; @@ -50,8 +49,6 @@ export class OsdListComponent extends ListWithDetails implements OnInit { markOsdConfirmationTpl: TemplateRef; @ViewChild('criticalConfirmationTpl', { static: true }) criticalConfirmationTpl: TemplateRef; - @ViewChild(TableComponent, { static: true }) - tableComponent: TableComponent; @ViewChild('reweightBodyTpl') reweightBodyTpl: TemplateRef; @ViewChild('safeToDestroyBodyTpl') diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.ts index 4f83b0c944ca..48f5acc293d4 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.ts @@ -18,7 +18,7 @@ import { AuthStorageService } from '../../../shared/services/auth-storage.servic styleUrls: ['./services.component.scss'] }) export class ServicesComponent extends ListWithDetails implements OnChanges, OnInit { - @ViewChild(TableComponent) + @ViewChild(TableComponent, { static: true }) table: TableComponent; @Input() hostname: string; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.ts index eae76ef70c7f..893a3a168963 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.ts @@ -40,7 +40,7 @@ const BASE_URL = 'pool'; styleUrls: ['./pool-list.component.scss'] }) export class PoolListComponent extends ListWithDetails implements OnInit { - @ViewChild(TableComponent, { static: true }) + @ViewChild(TableComponent) table: TableComponent; @ViewChild('poolUsageTpl', { static: true }) poolUsageTpl: TemplateRef; -- 2.47.3