Browse Source

HUE-8330 [frontend] Tweak the menu to only show the core apps

Romain Rigaux 7 years ago
parent
commit
69927f3

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

@@ -246,7 +246,7 @@ ${ hueIcons.symbols() }
         % if user.is_authenticated() and section != 'login' and (cluster != ANALYTIC_DB or IS_MULTICLUSTER_ONLY.get()):
         <div class="dropdown navbar-dropdown pull-right">
           % if IS_MULTICLUSTER_ONLY.get():
-            <!-- ko component: { name: 'hue-app-switcher', params: { onPrem: ko.observable(false) } } --><!-- /ko -->
+            ##<!-- ko component: { name: 'hue-app-switcher', params: { onPrem: ko.observable(false) } } --><!-- /ko -->
           % endif
 
           <%

+ 18 - 3
desktop/core/src/desktop/templates/ko_components/ko_dw_sidebar.mako

@@ -31,14 +31,22 @@
         <!-- /ko -->
         <!-- ko foreach: children -->
         <!-- ko if: $component.collapsed -->
-        <a role="button" class="sidebar-item" data-bind="hueLink: url, attr: { title: displayName }, css: { 'active': url === $component.activeUrl() }, tooltip: { placement: 'right' }"><span class="sidebar-icon with-tooltip"><!-- ko template: { name: 'app-icon-template' } --><!--/ko--></span><span class="sidebar-item-name" data-bind="text: displayName"></span></a>
+        <a role="button" class="sidebar-item" data-bind="hueLink: url, attr: { title: displayName }, css: { 'active': url === $component.activeUrl() }, tooltip: { placement: 'right' }">
+          <span class="sidebar-icon with-tooltip"><!-- ko template: { name: 'app-icon-template' } --><!--/ko--></span>
+          <span class="sidebar-item-name" data-bind="text: displayName"></span>
+        </a>
         <!-- /ko -->
         <!-- ko ifnot: $component.collapsed -->
-        <a role="button" class="sidebar-item" data-bind="hueLink: url, attr: { title: displayName }, css: { 'active': url === $component.activeUrl() }"><span class="sidebar-icon without-tooltip"><!-- ko template: { name: 'app-icon-template' } --><!--/ko--></span><span class="sidebar-item-name" data-bind="text: displayName"></span></a>
+        <a role="button" class="sidebar-item" data-bind="hueLink: url, attr: { title: displayName }, css: { 'active': url === $component.activeUrl() }">
+          <span class="sidebar-icon without-tooltip"><!-- ko template: { name: 'app-icon-template' } --><!--/ko--></span>
+          <span class="sidebar-item-name" data-bind="text: displayName"></span>
+        </a>
         <!-- /ko -->
         <!-- /ko -->
       </div>
-      <a class="sidebar-action-button" role="button" data-bind="toggle: collapsed"><span aria-hidden="true" class="fa" data-bind="css: { 'fa-angle-double-right': collapsed, 'fa-angle-double-left': !collapsed() }"></span></a>
+      <a class="sidebar-action-button" role="button" data-bind="toggle: collapsed">
+        <span aria-hidden="true" class="fa" data-bind="css: { 'fa-angle-double-right': collapsed, 'fa-angle-double-left': !collapsed() }"></span>
+      </a>
     </div>
   </script>
 
@@ -64,6 +72,13 @@
         huePubSub.subscribe('set.current.app.name', function (appName) {
           window.clearTimeout(throttle);
           throttle = window.setTimeout(function () {
+            self.items([
+              {displayName:"Apps", isCategory:true, children: [{displayName: "Editor", url: "/editor/?type=impala", icon: "editor"}]},
+              {displayName:"Apps", isCategory:true, children: [{displayName: "Catalog", url: "/metastore/tables", icon: "editor"}]},
+              {displayName:"Apps", isCategory:true, children: [{displayName: "Warehouses", url: "/hue/jobbrowser", icon: "editor"}]},
+              {displayName:"Apps", isCategory:true, children: [{displayName: "Importer", url: "/indexer/importer", icon: "editor"}]}
+              ]
+            );
             self.items().some(function (item) {
               return item.children.some(function (child) {
                 if (child.url.indexOf(appName.replace('_', '/')) !== -1) {

+ 115 - 52
desktop/core/src/desktop/templates/ko_components/ko_multi_cluster_sidebar.mako

@@ -110,6 +110,10 @@ from desktop.views import _ko
       // TODO: Fetch menu from the backend
       var FIXED_CATEGORIES = [{
         items: [{
+##          label: '${ _('Home') }',
+##          url: '/',
+##          icon: 'fa fa-home'
+
           label: '${ _('Data Warehouse') }',
           icon: 'altus-icon altus-adb-query',
           items: [{
@@ -119,9 +123,12 @@ from desktop.views import _ko
               label: '${ _('Catalog') }',
               url: '/metastore/tables'
             },{
-              label: '${ _('Files') }',
-              url: '/filebrowser/view=S3A://'
+              label: '${ _('Warehouses') }',
+              url: '/hue/jobbrowser',
             },{
+##              label: '${ _('Files') }',
+##              url: '/filebrowser/view=S3A://'
+##            },{
 ##              label: '${ _('Dashboard') }',
 ##              url: '/dashboard/new_search'
 ##            },{
@@ -132,62 +139,119 @@ from desktop.views import _ko
               url: '/indexer/importer'
             }
           ]
-        }, {
-          label: '${ _('Data Science') }',
-          url: '/',
-          icon: 'altus-icon altus-ds',
-          items: [{
-              label: '${ _('Projects') }',
-              url: '/editor?type=impala'
-            },{
-              label: '${ _('Sessions') }',
-              url: '/metastore/tables'
-            },{
-              label: '${ _('Experiments') }',
-              url: '/filebrowser/view=S3A://'
-            },{
-              label: '${ _('Models') }',
-              url: '/dashboard/new_search'
-            },{
-              label: '${ _('Jobs') }',
-              url: '/oozie/editor/coordinator/new/'
-            },{
-              label: '${ _('Settings') }',
-              url: '/indexer/importer'
-            }
-          ]
-        }
-      ]
-   
-      }, {
-        label: '${ _('Admin') }',
-        items: [{
-            label: '${ _('Engines') }',
-            url: '/hue/jobbrowser',
-            icon: 'altus-icon altus-de'
-          },{
-            label: '${ _('Catalog') }',
+          }, {
+            label: '${ _('Data Science') }',
             url: '/',
-            icon: 'altus-icon altus-sdx'
-          },{
-            label: '${ _('Environments') }',
+            icon: 'altus-icon altus-ds',
+            items: [{
+                label: '${ _('Projects') }',
+                url: '/editor?type=impala'
+              },{
+                label: '${ _('Sessions') }',
+                url: '/metastore/tables'
+              },{
+                label: '${ _('Experiments') }',
+                url: '/filebrowser/view=S3A://'
+              },{
+                label: '${ _('Models') }',
+                url: '/dashboard/new_search'
+              },{
+                label: '${ _('Jobs') }',
+                url: '/oozie/editor/coordinator/new/'
+              },{
+                label: '${ _('Settings') }',
+                url: '/indexer/importer'
+              }
+            ]
+          }, {
+            label: '${ _('Admin') }',
             url: '/',
-            icon: 'altus-icon altus-environment'
-          },{
-            label: '${ _('Directory') }',
-            url: 'https://console.altus.cloudera.com/iam/index.html',
-            icon: 'altus-icon altus-iam',
+            icon: 'altus-icon altus-de',
             items: [{
-                label: '${ _('User') }',
-                url: '/hue/useradmin/users/'
+                label: '${ _('Clusters') }',
+                url: '/hue/jobbrowser',
               },{
-                label: '${ _('Groups') }',
-                url: '/hue/useradmin/groups/'
+                label: '${ _('Catalog') }',
+                url: '/',
+              },{
+                label: '${ _('Environments') }',
+                url: '/',
+              },{
+                label: '${ _('Directory') }',
+                url: 'https://console.altus.cloudera.com/iam/index.html',
               }
             ]
           }
         ]
-      }
+      }];
+
+##        }, {
+##          label: '${ _('Data Engineering') }',
+##          url: '/',
+##          icon: 'altus-icon altus-workload',
+##          items: [{
+##              label: '${ _('Ingest') }',
+##              url: '/editor?type=impala'
+##            },{
+##              label: '${ _('Transform') }',
+##              url: '/metastore/tables'
+##            },{
+##              label: '${ _('Streams') }',
+##              url: '/metastore/tables'
+##            },{
+##              label: '${ _('Schedule') }',
+##              url: '/filebrowser/view=S3A://'
+##            }
+##          ]
+##        }, {
+##          label: '${ _('Data Stewart') }',
+##          url: '/',
+##          icon: 'altus-icon altus-adb',
+##          items: [{
+##              label: '${ _('Catalog') }',
+##              url: '/editor?type=impala'
+##            },{
+##              label: '${ _('Security') }',
+##              url: '/editor?type=impala'
+##            },{
+##              label: '${ _('Audit') }',
+##              url: '/metastore/tables'
+##            },{
+##              label: '${ _('BDR') }',
+##              url: '/filebrowser/view=S3A://'
+##            }
+##          ]
+
+##      }, {
+##        label: '${ _('Admin') }',
+##        items: [{
+##            label: '${ _('Engines') }',
+##            url: '/hue/jobbrowser',
+##            icon: 'altus-icon altus-de'
+##          },{
+##            label: '${ _('Catalog') }',
+##            url: '/',
+##            icon: 'altus-icon altus-sdx'
+##          },{
+##            label: '${ _('Environments') }',
+##            url: '/',
+##            icon: 'altus-icon altus-environment'
+##          },{
+##            label: '${ _('Directory') }',
+##            url: 'https://console.altus.cloudera.com/iam/index.html',
+##            icon: 'altus-icon altus-iam',
+##            items: [{
+##                label: '${ _('User') }',
+##                url: '/hue/useradmin/users/'
+##              },{
+##                label: '${ _('Groups') }',
+##                url: '/hue/useradmin/groups/'
+##              }
+##            ]
+##          }
+##        ]
+##      }
+
 ##           },{
 ##             label: '${ _('Streaming') }',
 ##             url: '/',
@@ -212,7 +276,7 @@ from desktop.views import _ko
           ##  url: '/'
           ##}
 
-        
+
 ##      }, {
 ##        label: '${ _('Admin') }',
 ##        items: [{
@@ -286,7 +350,6 @@ from desktop.views import _ko
         ##      {label: 'altus-sql-editor', url: '/', icon: 'altus-icon altus-sql-editor'},
         ##      {label: 'altus-feedback', url: '/', icon: 'altus-icon altus-feedback'}]
         ##  }
-      ];
 
       var MultiClusterSidebar = function MultiClusterSidebar() {
         var self = this;