浏览代码

[editor] Enable active database selection from the assist panel

Johan Ahlen 9 年之前
父节点
当前提交
6fed220

+ 1 - 0
desktop/core/src/desktop/static/desktop/js/assist/assistDbEntry.js

@@ -306,6 +306,7 @@
       })
     } else if (self.definition.isDatabase) {
       huePubSub.publish("assist.database.selected", {
+        source: self.assistDbSource.type,
         name: self.definition.name
       })
     }

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

@@ -277,7 +277,7 @@ from desktop.views import _ko
           fieldType: definition.type,
           assistHelper: assistDbSource.assistHelper
         } }"></span>
-      <a class="inactive-action" href="javascript:void(0)" data-bind="visible: navigationSettings.openItem, click: openItem"><i class="fa fa-long-arrow-right" title="${_('Open')}"></i></a>
+      <a class="inactive-action" href="javascript:void(0)" data-bind="visible: navigationSettings.openItem || (navigationSettings.openDatabase && definition.isDatabase), click: openItem"><i class="fa fa-long-arrow-right" title="${_('Open')}"></i></a>
     </div>
   </script>
 

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

@@ -197,11 +197,14 @@
     self.isSqlDialect.subscribe(updateDatabases);
     updateDatabases();
 
-    huePubSub.subscribe("assist.database.set", function (databaseDef) {
+    var handleAssistSelection = function (databaseDef) {
       if (databaseDef.source === self.type() && self.database() !== databaseDef.name) {
         self.database(databaseDef.name);
       }
-    });
+    };
+
+    huePubSub.subscribe("assist.database.set", handleAssistSelection);
+    huePubSub.subscribe("assist.database.selected", handleAssistSelection);
 
     if (! self.database()) {
       huePubSub.publish("assist.get.database", self.type());

+ 1 - 0
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -323,6 +323,7 @@ ${ require.config() }
             sourceTypes: $root.sqlSourceTypes,
             activeSourceType: $root.activeSqlSourceType,
             navigationSettings: {
+              openDatabase: true,
               openItem: false,
               showPreview: true,
               showStats: true