浏览代码

HUE-7141 [dashboard] Menu shows an incomplete dropdown

Romain Rigaux 8 年之前
父节点
当前提交
e5570b1

+ 2 - 2
apps/impala/src/impala/dashboard_api.py

@@ -151,8 +151,8 @@ class SQLApi():
 
 
   def datasets(self, show_all=False):
-    # Implemented via Hive chooser
-    return []
+    snippet = {'type': self.engine}
+    return [table['name'] for table in get_api(MockRequest(self.user), snippet).autocomplete(snippet, database='default')['tables_meta']]
 
 
   def fields(self, dashboard):

+ 7 - 1
desktop/core/src/desktop/models.py

@@ -1687,7 +1687,13 @@ class ClusterConfig():
         'name': 'dashboard',
         'displayName': _('Dashboard'),
         'buttonName': _('Dashboard'),
-        'interpreters': interpreters,
+        'interpreters': [{
+            'type': interpreter['type'],
+            'displayName': interpreter['type'].title(),
+            'buttonName': interpreter['type'].title(),
+            'page': '/dashboard/new_search?engine=%(type)s' % interpreter,
+            'tooltip': _('%s Dashboard') % interpreter['type'].title()
+          } for interpreter in interpreters],
         'page': '/dashboard/new_search'
       }
     else:

+ 2 - 2
desktop/core/src/desktop/templates/hue.mako

@@ -136,7 +136,7 @@ ${ hueIcons.symbols() }
           <!-- ko if: item.dividerAbove -->
           <li class="divider"></li>
           <!-- /ko -->
-          <li data-bind="css: { 'dropdown-submenu': item.isCategory }">
+          <li data-bind="css: { 'dropdown-submenu': item.isCategory && item.children.length > 1 }">
             <!-- ko if: item.url -->
              <a href="javascript: void(0);" data-bind="hueLink: item.url">
                 <!-- ko if: item.icon -->
@@ -148,7 +148,7 @@ ${ hueIcons.symbols() }
             <!-- ko if: item.href -->
               <a data-bind="attr: { href: item.href }, text: item.displayName" target="_blank"></a>
             <!-- /ko -->
-            <!-- ko if: item.isCategory -->
+            <!-- ko if: item.isCategory && item.children.length > 1 -->
             <ul class="dropdown-menu" data-bind="foreach: { data: item.children, as: 'item' }">
               <!-- ko template: 'quick-create-item-template' --><!-- /ko -->
             </ul>