From: Stephan Müller Date: Wed, 22 Jul 2020 14:00:32 +0000 (+0200) Subject: mgr/dashboard: Fix regression on table error handling X-Git-Tag: wip-pdonnell-testing-20200918.022351~512^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c4d1e95f094db31b24c13e71ad41370ec95fef41;p=ceph-ci.git mgr/dashboard: Fix regression on table error handling 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 --- 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 d1bea0bdd52..259cf869151 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 af298a9e5b1..46a64e39e78 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 4f83b0c944c..48f5acc293d 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 eae76ef70c7..893a3a16896 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;