Browse Source

HUE-4569 [editor] If we don't have a query history select the saved query tab

Minor side effect is when we clear the query history it will switch to the saved query tab.
Romain Rigaux 9 years ago
parent
commit
7490137d95

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

@@ -1282,6 +1282,11 @@
       self.coordinatorUuid(self.dependentsCoordinator()[0].uuid());
       self.coordinatorUuid(self.dependentsCoordinator()[0].uuid());
     }
     }
     self.history = ko.observableArray(vm.selectedNotebook() ? vm.selectedNotebook().history() : []);
     self.history = ko.observableArray(vm.selectedNotebook() ? vm.selectedNotebook().history() : []);
+    self.history.subscribe(function(val) {
+      if (self.id() == null && val.length == 0) {
+        self.snippets()[0].currentQueryTab('savedQueries');
+      }
+    });
     self.historyFilter = ko.observable('');
     self.historyFilter = ko.observable('');
     self.historyFilterVisible = ko.observable(false);
     self.historyFilterVisible = ko.observable(false);
     self.historyFilter.extend({ rateLimit: 300 });
     self.historyFilter.extend({ rateLimit: 300 });