]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Fix validation of OSDs 30488/head
authorTiago Melo <tmelo@suse.com>
Thu, 19 Sep 2019 13:39:22 +0000 (13:39 +0000)
committerTiago Melo <tmelo@suse.com>
Fri, 20 Sep 2019 11:48:19 +0000 (11:48 +0000)
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 <tmelo@suse.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts

index 2066258058be1d898b5e07668ed342a737a1381d..abf6f2992f61897b5eed105729309159b20542be 100644 (file)
@@ -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;