From 0a27d5a1aaac306c9056536e4ddabb5c6269f87e Mon Sep 17 00:00:00 2001 From: Tiago Melo Date: Thu, 19 Sep 2019 13:39:22 +0000 Subject: [PATCH] mgr/dashboard: Fix validation of OSDs There were situations where the OSD was removed and then we tried to access some property of the OSD object, causing a frontend error. Signed-off-by: Tiago Melo --- .../src/app/ceph/cluster/osd/osd-list/osd-list.component.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 2066258058b..abf6f2992f6 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 @@ -241,13 +241,14 @@ export class OsdListComponent implements OnInit { return true; } - const validOsds = []; + let validOsds = []; if (this.selection.hasSelection) { for (const osdId of this.getSelectedIds()) { validOsds.push(this.osds.filter((o) => o.id === osdId).pop()); } } + validOsds = validOsds.filter((osd) => !_.isUndefined(osd)); if (validOsds.length === 0) { // `osd` is undefined if the selected OSD has been removed. return true; -- 2.47.3