Эх сурвалжийг харах

HUE-8679 [cluster] Add Warehouse title without tabs

Romain Rigaux 7 жил өмнө
parent
commit
367a905

+ 29 - 20
apps/jobbrowser/src/jobbrowser/templates/job_browser.mako

@@ -14,12 +14,12 @@
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 <%
-  from django.utils.translation import ugettext as _
+from django.utils.translation import ugettext as _
 
-  from desktop import conf
-  from desktop.views import commonheader, commonfooter, _ko
+from desktop.conf import CUSTOM, IS_K8S_ONLY, is_hue4
+from desktop.views import commonheader, commonfooter, _ko
 
-  from jobbrowser.conf import DISABLE_KILLING_JOBS, MAX_JOB_FETCH, ENABLE_QUERY_BROWSER
+from jobbrowser.conf import DISABLE_KILLING_JOBS, MAX_JOB_FETCH, ENABLE_QUERY_BROWSER
 %>
 
 <%
@@ -39,7 +39,7 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
 <link rel="stylesheet" href="${ static('notebook/css/notebook.css') }">
 <link rel="stylesheet" href="${ static('notebook/css/notebook-layout.css') }">
 <style type="text/css">
-% if conf.CUSTOM.BANNER_TOP_HTML.get():
+% if CUSTOM.BANNER_TOP_HTML.get():
   .show-assist {
     top: 110px!important;
   }
@@ -97,7 +97,7 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
       }
     } --><!-- /ko -->
 
-    % if not conf.IS_K8S_ONLY.get():
+    % if not IS_K8S_ONLY.get():
     <!-- ko component: {
       name: 'hue-context-selector',
       params: {
@@ -123,6 +123,12 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
         <div class="nav-collapse">
           <ul class="nav">
             <li class="app-header">
+              % if IS_K8S_ONLY.get():
+                <a data-bind="click: function() { selectInterface('dataware2-clusters'); }">
+                  <i class="altus-icon altus-adb-cluster"></i>
+                  ${ _('Warehouses') }
+                </a>
+              % else:
               <!-- ko ifnot: $root.cluster() && $root.cluster()['type'].indexOf("altus-dw") !== -1 -->
               <a href="/${app_name}">
                 <img src="${ static('jobbrowser/art/icon_jobbrowser_48.png') }" class="app-icon" alt="${ _('Job browser icon') }"/>
@@ -146,6 +152,7 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
                   > gke_gcp-eng-dsdw_us-west2-b_impala-demo
                 </span>
               <!-- /ko -->
+              % endif
             </li>
             <!-- ko foreach: availableInterfaces -->
               <li data-bind="css: {'active': $parent.interface() === interface}, visible: condition()">
@@ -2949,11 +2956,11 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
       });
       self.paginationPage = ko.observable(1);
       self.paginationOffset = ko.observable(1); // Starting index
-      %if conf.is_hue4():
-      self.paginationResultPage = ko.observable(100);
-      %else:
-      self.paginationResultPage = ko.observable(50);
-      %endif
+      % if is_hue4():
+        self.paginationResultPage = ko.observable(100);
+      % else:
+        self.paginationResultPage = ko.observable(50);
+      % endif
       self.pagination = ko.computed(function() {
         return {
             'page': self.paginationPage(),
@@ -3219,7 +3226,7 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
           return self.cluster() && self.cluster()['type'] == 'altus-dw';
         };
         var dataWarehouse2InterfaceCondition = function () {
-          return self.cluster() && self.cluster()['type'] == 'altus-dw2';
+          return false && self.cluster() && self.cluster()['type'] == 'altus-dw2';
         };
         var schedulerInterfaceCondition = function () {
           return '${ user.has_hue_permission(action="access", app="oozie") }' == 'True' && (!self.cluster() || self.cluster()['type'].indexOf('altus') == -1);
@@ -3314,22 +3321,24 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
         interface = self.isValidInterface(interface);
         self.interface(interface);
         self.resetBreadcrumbs();
+
         % if not is_mini:
-        huePubSub.publish('graph.stop.refresh.view');
-        if (window.location.hash !== '#!' + interface) {
-          hueUtils.changeURL('#!' + interface);
-        }
+          huePubSub.publish('graph.stop.refresh.view');
+          if (window.location.hash !== '#!' + interface) {
+            hueUtils.changeURL('#!' + interface);
+          }
         % endif
         self.jobs.selectedJobs([]);
         self.job(null);
+
         if (interface === 'slas'){
           % if not is_mini:
-          self.loadSlaPage();
+            self.loadSlaPage();
           % endif
         }
         else if (interface === 'oozie-info') {
           % if not is_mini:
-          self.loadOozieInfoPage();
+            self.loadOozieInfoPage();
           % endif
         }
         else {
@@ -3408,9 +3417,9 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
         }
         loaded = true;
         var h = window.location.hash;
-        %if not is_mini:
+        % if not is_mini:
         huePubSub.publish('graph.stop.refresh.view');
-        %endif
+        % endif
 
         h = h.indexOf('#!') === 0 ? h.substr(2) : '';
         switch (h) {

+ 6 - 6
apps/jobbrowser/src/jobbrowser/views.py

@@ -22,27 +22,27 @@ import time
 import urllib2
 import urlparse
 
-from urllib import quote_plus
 from lxml import html
+from urllib import quote_plus
 
 from django.http import HttpResponseRedirect
 from django.utils.functional import wraps
 from django.utils.translation import ugettext as _
 from django.urls import reverse
 
-from desktop.log.access import access_log_level
-from desktop.lib.rest.http_client import RestException
-from desktop.lib.rest.resource import Resource
+from desktop.auth.backend import is_admin
 from desktop.lib.django_util import JsonResponse, render_json, render, copy_query_dict
-from desktop.lib.json_utils import JSONEncoderForHTML
 from desktop.lib.exceptions import MessageException
 from desktop.lib.exceptions_renderable import PopupException
+from desktop.lib.json_utils import JSONEncoderForHTML
+from desktop.lib.rest.http_client import RestException
+from desktop.lib.rest.resource import Resource
+from desktop.log.access import access_log_level
 from desktop.views import register_status_bar_view
 
 from hadoop import cluster
 from hadoop.yarn.clients import get_log_client
 from hadoop.yarn import resource_manager_api as resource_manager_api
-from desktop.auth.backend import is_admin
 
 
 LOG = logging.getLogger(__name__)