Browse Source

HUE-8330 [cluster] Adding new logo when in cluster only mode

Romain Rigaux 7 years ago
parent
commit
d2ffba74de

+ 1 - 1
desktop/core/src/desktop/api2.py

@@ -139,7 +139,7 @@ def get_context_computes(request, interface):
         'namespace': cluster['id'],
         'interface': interface,
         'type': cluster['type']
-      } for cluster in clusters
+      } for cluster in clusters if cluster.get('type') == 'direct'
     ])
 
   if interface == 'impala' or interface == 'jobs':

+ 8 - 1
desktop/core/src/desktop/conf.py

@@ -1584,13 +1584,20 @@ DISABLE_HUE_3 = Config( # To remove in Hue 5
   help=_('Choose whether to still allow users to enable the old Hue 3 interface.')
 )
 
+IS_MULTICLUSTER_ONLY = Config(
+  key='is_multicluster_only',
+  default=False,
+  type=coerce_bool,
+  help=_('Choose whether to pick configs only from [desktop] [[cluster]]')
+)
+
 
 def get_clusters(user):
   clusters = []
 
   # Get core standalone config if there
   apps = appmanager.get_apps_dict(user)
-  if 'beeswax' in apps:
+  if 'beeswax' in apps and not IS_MULTICLUSTER_ONLY.get():
     from beeswax.conf import HIVE_SERVER_HOST
     clusters.append(
       (CLUSTER_ID.get(), {

+ 3 - 3
desktop/core/src/desktop/models.py

@@ -49,7 +49,7 @@ from kafka.conf import has_kafka
 from notebook.conf import SHOW_NOTEBOOKS, get_ordered_interpreters
 
 from desktop import appmanager
-from desktop.conf import get_clusters, CLUSTER_ID
+from desktop.conf import get_clusters, CLUSTER_ID, IS_MULTICLUSTER_ONLY
 from desktop.lib.i18n import force_unicode
 from desktop.lib.exceptions_renderable import PopupException
 from desktop.lib.paths import get_run_root
@@ -1558,7 +1558,7 @@ def get_cluster_config(user):
   return cluster_config.get_config()
 
 
-ANALYTIC_DB = 'analyticdb'
+ANALYTIC_DB = 'altus'
 
 
 class ClusterConfig():
@@ -1913,7 +1913,7 @@ class Cluster():
   def __init__(self, user):
     self.user = user
     self.clusters = get_clusters(user)
-    self.data = self.clusters[CLUSTER_ID.get()]
+    self.data = 'Altus' if IS_MULTICLUSTER_ONLY.get() else self.clusters[CLUSTER_ID.get()]
 
   def get_type(self):
     return self.data['type']

+ 43 - 0
desktop/core/src/desktop/static/desktop/art/cloudera-altus.svg

@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 21.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" preserveAspectRatio="xMinYMax meet"
+     viewBox="0 0 499 74" style="enable-background:new 0 0 499 74;" xml:space="preserve">
+<style type="text/css">
+  .st0{fill:#2E3B42;}
+</style>
+<g>
+	<path class="st0" d="M34.9,11.3c10.4,0,17.7,6.1,19.8,15.4h-4.4c-2.3-6.8-7.6-11.2-15.5-11.2c-11.1,0-19.1,9-19.1,23.4
+		c0,14.3,8,23.4,19.1,23.4c7.9,0,13.2-4.4,15.5-11.2h4.4c-2.2,9.3-9.5,15.4-19.8,15.4c-13.2,0-23.6-10.7-23.6-27.6
+		S21.7,11.3,34.9,11.3z"/>
+	<path class="st0" d="M67,65.7h-4.4V8.9H67V65.7z"/>
+	<path class="st0" d="M92,66.5c-10.2,0-17.1-8.2-17.1-20.2c0-12,6.9-20.2,17.1-20.2c10.3,0,17.2,8.2,17.2,20.2
+		C109.2,58.3,102.3,66.5,92,66.5z M92,30c-7.7,0-12.8,6.6-12.8,16.3c0,9.8,5.1,16.3,12.8,16.3c7.8,0,12.8-6.6,12.8-16.3
+		C104.8,36.5,99.8,30,92,30z"/>
+	<path class="st0" d="M146.7,65.7h-4.3v-6.2c-2.4,3.7-6.8,7-12.3,7c-8.8,0-13.5-5.7-13.5-13.9V26.9h4.3V52c0,6,3.1,10.5,10,10.5
+		c5.3,0,9.6-3.8,11.5-8.4V26.9h4.3V65.7z"/>
+	<path class="st0" d="M183.6,59.9c-2.2,3.3-6.7,6.6-12.1,6.6c-11.4,0-17-9.4-17-20.2c0-10.7,5.5-20.2,17-20.2
+		c5.3,0,9.9,3.2,12.1,6.6V8.9h4.3v56.8h-4.3V59.9z M183.6,37.8c-2.6-5-7-7.7-11.7-7.7c-8.1,0-12.9,6.8-12.9,16.2
+		c0,9.4,4.8,16.2,12.9,16.2c4.7,0,9.1-2.7,11.7-7.7V37.8z"/>
+	<path class="st0" d="M228,54.4c-1.5,7.2-6.9,12.1-15,12.1c-10.2,0-17.2-8.1-17.2-20.2c0-11.5,6.6-20.2,17.1-20.2
+		c10.3,0,15.7,8,15.7,19v1.6h-28.6c0.1,9.9,5.4,16,12.9,16c5.5,0,9.6-3.1,10.8-8.2H228z M200.2,43.3h24C224,36.4,220.6,30,212.9,30
+		C205.9,30,201.1,35.1,200.2,43.3z"/>
+	<path class="st0" d="M254.7,30.9c-1-0.4-2.2-0.7-3.6-0.7c-4.7,0-8.5,3.4-10.3,8.4v27.1h-4.4V26.9h4.4v6.2c1.7-3.8,5.7-7,10.5-7
+		c1.5,0,2.5,0.3,3.4,0.5V30.9z"/>
+	<path class="st0" d="M282.5,65.7V62c-1.7,2-5.9,4.3-10.7,4.3c-7.9,0-14.3-4.5-14.3-12c0-7.2,6.5-11.9,14.5-11.9
+		c4.5,0,8.8,2.2,10.6,4.1v-6.9c0-5.8-3.5-9.7-9.7-9.7c-4.8,0-8,2.1-9.4,6.6h-4.3c1.5-6.6,6.9-10.5,13.7-10.5
+		c8.7,0,13.9,5.2,13.9,13.4v26.2H282.5z M282.5,51.9c-1.2-3.3-5.6-5.8-10.3-5.8c-5.5,0-10.7,2.7-10.7,8.2c0,5.5,5.2,8.3,10.7,8.3
+		c4.7,0,9.1-2.4,10.3-5.8V51.9z"/>
+	<path class="st0" d="M339.4,12.1L360,65.7h-9.3l-5.5-14.9h-20.5l-5.5,14.9H310l20.6-53.7H339.4z M327.6,43h14.7l-7.3-19.8L327.6,43
+		z"/>
+	<path class="st0" d="M374.1,65.7h-8.7V8.9h8.7V65.7z"/>
+	<path class="st0" d="M385.2,34.2h-6.1v-7.3h6.1V16.5h8.7v10.4h8.7v7.3H394v20.1c0,3.1,1.7,4.5,4.6,4.5c1.7,0,3.8-0.7,5-1.6v8
+		c-1.5,0.9-3.8,1.4-6.6,1.4c-6.9,0-11.8-3.7-11.8-11.4V34.2z"/>
+	<path class="st0" d="M443,65.7h-8.7V62c-2.1,2.4-5.9,4.5-10.4,4.5c-8.8,0-13.6-5.9-13.6-14.4V26.9h8.7v23.8c0,4.8,2.3,8,7.3,8
+		c3.8,0,7.1-2.4,8-6.2V26.9h8.7V65.7z"/>
+	<path class="st0" d="M458.3,54.5c1,3.2,3.8,4.9,7.7,4.9c4,0,6.6-1.6,6.6-4.6c0-2.1-1.3-3.2-4.5-4l-8-1.9c-5.5-1.3-9.6-4.3-9.6-10.7
+		c0-7,6.2-12.1,14.7-12.1c9.1,0,14.2,4.4,15.6,11.4h-8.6c-0.8-2.5-3.1-4.3-7.1-4.3c-3.1,0-6.2,1.4-6.2,4.5c0,1.7,1.2,2.9,4,3.6
+		l8.2,1.9c6.6,1.6,10,5.3,10,11c0,7.7-6.4,12.4-15.1,12.4c-9.1,0-15.4-4.5-16.5-12.1H458.3z"/>
+	<path class="st0" d="M478.8,21.3h4.9v0.8h-2v5.2h-0.9v-5.2h-2V21.3z M487.4,27.3l-1.8-4.4v4.4h-0.9v-5.9h1.1l1.9,4.7l1.9-4.7h1.1
+		v5.9h-0.9v-4.4l-1.8,4.4H487.4z"/>
+</g>
+</svg>

+ 7 - 4
desktop/core/src/desktop/templates/hue.mako

@@ -18,8 +18,7 @@
   from django.utils.translation import ugettext as _
 
   from desktop import conf
-  from desktop.conf import IS_EMBEDDED
-  from desktop.conf import DEV_EMBEDDED
+  from desktop.conf import IS_EMBEDDED, DEV_EMBEDDED, IS_MULTICLUSTER_ONLY
   from desktop.views import _ko, commonshare, login_modal
   from desktop.lib.i18n import smart_unicode
   from desktop.models import PREFERENCE_IS_WELCOME_TOUR_SEEN, ANALYTIC_DB, hue_version
@@ -176,7 +175,11 @@ ${ hueIcons.symbols() }
         </a>
 
         <a class="brand" data-bind="hueLink: '/home/'" href="javascript: void(0);" title="${_('Documents')}">
-          <svg style="height: 24px; width: 120px;"><use xlink:href="#hi-logo"></use></svg>
+          % if IS_MULTICLUSTER_ONLY.get():
+            <img src="${ static('desktop/art/cloudera-altus.svg') }" style="height: 28px; width: 140px; margin-top: -6px">
+          % else:
+            <svg style="height: 24px; width: 120px;"><use xlink:href="#hi-logo"></use></svg>
+          % endif
         </a>
         % endif
 
@@ -229,7 +232,7 @@ ${ hueIcons.symbols() }
 
       <div class="top-nav-right">
 
-        % if user.is_authenticated() and section != 'login' and cluster != ANALYTIC_DB:
+        % if user.is_authenticated() and section != 'login' and (cluster != ANALYTIC_DB or IS_MULTICLUSTER_ONLY.get()):
         <div class="dropdown navbar-dropdown pull-right">
           <%
             view_profile = user.has_hue_permission(action="access_view:useradmin:edit_user", app="useradmin") or user.is_superuser

+ 1 - 1
desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

@@ -368,7 +368,7 @@ var EditorViewModel = (function() {
 
     self.compute = ko.observable();
     self.compute.subscribe(function(newCompute) {
-      $.each(self.availableNamespaces(), function(index, namespace) {console.log(newCompute.namespace); console.log(namespace.name);
+      $.each(self.availableNamespaces(), function(index, namespace) {
         if (namespace.name == newCompute.namespace) {
           self.namespace(namespace);
           return;