Эх сурвалжийг харах

HUE-7001 [assist] Remember the last selected HBase cluster

Johan Ahlen 8 жил өмнө
parent
commit
6b9aa5f07f

+ 18 - 1
desktop/core/src/desktop/templates/assist.mako

@@ -1415,9 +1415,26 @@ from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING, get_ord
         self.selectedHBaseEntry = ko.observable();
         self.reload = function () {
           self.selectedHBaseEntry(root);
-          root.loadEntries();
+          root.loadEntries(function () {
+            var lastOpenendPath = self.apiHelper.getFromTotalStorage('assist', 'last.opened.hbase.entry', null);
+            if (lastOpenendPath) {
+              root.entries().every(function (entry) {
+                if (entry.path === lastOpenendPath) {
+                  entry.open();
+                  return false;
+                }
+                return true;
+              })
+            }
+          });
         };
 
+        self.selectedHBaseEntry.subscribe(function (newEntry) {
+          if (newEntry !== root || (newEntry === root && newEntry.loaded)) {
+            self.apiHelper.setInTotalStorage('assist', 'last.opened.hbase.entry', newEntry.path);
+          }
+        });
+
         huePubSub.subscribe('assist.clickHBaseItem', function (entry) {
           if (entry.definition.host) {
             entry.loadEntries();