From: Tiago Melo Date: Thu, 19 Sep 2019 13:39:22 +0000 (+0000) Subject: mgr/dashboard: Fix validation of OSDs X-Git-Tag: v15.1.0~1460^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0a27d5a1aaac306c9056536e4ddabb5c6269f87e;p=ceph.git 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 --- 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 2066258058be1..abf6f2992f618 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;