瀏覽代碼

HUE-7332 [editor] Make the syntax checker aware of database changes

Johan Ahlen 8 年之前
父節點
當前提交
6b980f5
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

+ 5 - 0
desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

@@ -318,9 +318,14 @@ var EditorViewModel = (function() {
     };
 
     self.database = ko.observable();
+    var previousDatabase = null;
     self.database.subscribe(function (newValue) {
       if (newValue !== null) {
         self.getApiHelper().setInTotalStorage('editor', 'last.selected.database', newValue);
+        if (previousDatabase !== null && previousDatabase !== newValue) {
+          huePubSub.publish('editor.refresh.statement.locations', self);
+        }
+        previousDatabase = newValue;
       }
     });
     self.database(typeof snippet.database != "undefined" && snippet.database != null ? snippet.database : null);