Răsfoiți Sursa

HUE-6418 [editor] Refresh the statement locations on execute

Johan Ahlen 8 ani în urmă
părinte
comite
18a5ba0

+ 10 - 0
desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

@@ -3504,10 +3504,20 @@
         }, 500);
       });
 
+      var locateSubscription = huePubSub.subscribe('editor.refresh.statement.locations', function (snippet) {
+        if (snippet === self.snippet) {
+          window.clearTimeout(changeThrottle);
+          window.clearTimeout(updateThrottle);
+          parseForStatements();
+          updateActiveStatement();
+        }
+      });
+
       self.disposeFunctions.push(function () {
         window.clearTimeout(changeThrottle);
         window.clearTimeout(updateThrottle);
         self.editor.off("change", changeListener);
+        locateSubscription.remove();
         cursorSubscription.remove();
       });
     };

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

@@ -1040,6 +1040,9 @@ var EditorViewModel = (function() {
       if (self.status() == 'running' || self.status() == 'loading' || now - self.lastExecuted() < 1000 || ! self.isReady()) {
         return;
       }
+      if (self.isSqlDialect()) {
+        huePubSub.publish('editor.refresh.statement.locations', self);
+      }
 
       self.previousChartOptions = {
         chartScope: typeof self.chartScope() !== "undefined" ? self.chartScope() : self.previousChartOptions.chartScope,