浏览代码

HUE-8572 [tb] Fix JS exception when clearing table browser selection via pubsub

Johan Ahlen 7 年之前
父节点
当前提交
ce92900
共有 1 个文件被更改,包括 8 次插入4 次删除
  1. 8 4
      apps/metastore/src/metastore/templates/metastore.mako

+ 8 - 4
apps/metastore/src/metastore/templates/metastore.mako

@@ -1164,10 +1164,14 @@ ${ components.menubar(is_embeddable) }
       });
 
       huePubSub.subscribe('metastore.clear.selection', function () {
-        viewModel.selectedDatabases.removeAll();
-        if (viewModel.database()) {
-          viewModel.database().selectedTables.removeAll();
-        }
+        viewModel.sources().forEach(function (source) {
+          source.namespaces().forEach(function (namespace) {
+            namespace.selectedDatabases.removeAll();
+            namespace.databases().forEach(function (database) {
+              database.selectedTables.removeAll();
+            })
+          })
+        });
       }, 'metastore');
 
       viewModel.currentTab.subscribe(function(tab){