Browse Source

HUE-7809 [reporting] Add report into Dashboard submenu

Romain Rigaux 8 years ago
parent
commit
f4bc273

+ 22 - 8
desktop/core/src/desktop/models.py

@@ -43,7 +43,7 @@ from settings import HUE_DESKTOP_VERSION
 
 from aws.conf import is_enabled as is_s3_enabled, has_s3_access
 from azure.conf import is_adls_enabled, has_adls_access
-from dashboard.conf import get_engines
+from dashboard.conf import get_engines, HAS_REPORT_ENABLED
 from notebook.conf import SHOW_NOTEBOOKS, get_ordered_interpreters
 
 from desktop import appmanager
@@ -1692,17 +1692,31 @@ class ClusterConfig():
     interpreters = get_engines(self.user)
 
     if interpreters and (self.cluster_type not in (DATAENG, ANALYTIC_DB)):
+      _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(),
+          'is_sql': True
+        } for interpreter in interpreters
+      ]
+
+      if HAS_REPORT_ENABLED.get():
+        _interpreters.append({
+          'type': 'report',
+          'displayName': 'Report',
+          'buttonName': 'Report',
+          'page': '/dashboard/new_search?engine=report',
+          'tooltip': _('Report'),
+          'is_sql': False
+        })
+
       return {
         'name': 'dashboard',
         'displayName': _('Dashboard'),
         'buttonName': _('Dashboard'),
-        '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],
+        'interpreters': _interpreters,
         'page': '/dashboard/new_search?engine=%(type)s' % interpreters[0]
       }
     else:

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

@@ -1378,7 +1378,7 @@ ${ smart_unicode(login_modal(request).content) | n,unicode }
               $.each(app['interpreters'], function(index, interpreter) {
                 // Promote the first catagory of interpreters
                 if (! dividerAdded) {
-                  toAddDivider = app.name === 'editor' && (lastInterpreter != null && lastInterpreter.is_sql != interpreter.is_sql);
+                  toAddDivider = (app.name === 'editor' || app.name === 'dashboard') && (lastInterpreter != null && lastInterpreter.is_sql != interpreter.is_sql);
                 }
                 interpreters.push({
                   displayName: interpreter.displayName,

+ 1 - 0
desktop/core/src/desktop/templates/hue_icons.mako

@@ -277,6 +277,7 @@
     <!-- ko switch: icon -->
     <!-- ko case: 'dashboard' --><svg class="hi"><use xlink:href="#hi-dashboard"></use></svg><!-- /ko -->
     <!-- ko case: 'documents' --><svg class="hi"><use xlink:href="#hi-documents"></use></svg><!-- /ko -->
+    <!-- ko case: 'report' --><i class="fa fa-fw fa-area-chart"></i><!-- /ko -->
     <!-- ko case: 'dist-cp' --><i class="fa fa-fw fa-files-o"></i><!-- /ko -->
     <!-- ko case: 'editor' --><svg class="hi"><use xlink:href="#hi-editor"></use></svg><!-- /ko -->
     <!-- ko case: 'hbase' --><svg class="hi"><use xlink:href="#hi-hbase"></use></svg><!-- /ko -->