Browse Source

HUE-1554 [core] Polishing glitches from new design

Pig: Shortened editor page, switched to jHueNotify completely and improved Hive down notifications
Changed tooltips on Oozie workflow editor
FB: changed style to view file and edit file pages, fixed chmod/chown dropdown button, added a bit of padding on the file list table
Introduce height media queries on Quick start wizard and user admin, if the browser height < 800 they are fixed at the bottom, otherwise under the form
Enrico Berti 12 years ago
parent
commit
0d343b1

+ 18 - 7
apps/about/src/about/templates/admin_wizard.mako

@@ -66,8 +66,8 @@ ${ commonheader(_('Quick Start'), "quickstart", user, "100px") | n,unicode }
               <h2 class="card-heading simple">${ _('Checking current configuration') }</h2>
 
               <div class="card-body">
-                <div id="check-config-section">
-                  <!--[if !IE]><!--><i class="icon-spinner icon-spin" style="font-size: 60px;"></i><!--<![endif]-->
+                <div id="check-config-section" style="margin-bottom:20px">
+                  <!--[if !IE]><!--><i class="icon-spinner icon-spin" style="font-size: 60px; color: #DDD"></i><!--<![endif]-->
                   <!--[if IE]><img src="/hbase/static/art/loader.gif" /><![endif]-->
                 </div>
               </div>
@@ -207,12 +207,13 @@ ${ commonheader(_('Quick Start'), "quickstart", user, "100px") | n,unicode }
           </div>
           % endif
       </div>
-    </div>
-  </div>
 
-  <div class="form-actions" style="position:fixed;bottom:0;margin:0;margin-left:-20px;width:100%">
-    <a id="backBtn" class="btn disabled">${ _('Back') }</a>
-    <a id="nextBtn" class="btn btn-primary disable-feedback">${ _('Next') }</a>
+      <div class="form-actions">
+        <a id="backBtn" class="btn disabled">${ _('Back') }</a>
+        <a id="nextBtn" class="btn btn-primary disable-feedback">${ _('Next') }</a>
+      </div>
+
+    </div>
   </div>
 
 </div>
@@ -227,6 +228,16 @@ ${ commonheader(_('Quick Start'), "quickstart", user, "100px") | n,unicode }
     margin-left: 50px;
   }
 
+  @media all and (max-height: 800px) {
+    .form-actions {
+      position:fixed;
+      bottom:0;
+      margin:0;
+      margin-left:-20px;
+      width:100%;
+    }
+  }
+
 </style>
 
 <script src="/static/ext/js/routie-0.3.0.min.js" type="text/javascript" charset="utf-8"></script>

+ 7 - 2
apps/beeswax/src/beeswax/views.py

@@ -47,8 +47,9 @@ from beeswax.forms import QueryForm
 from beeswax.design import HQLdesign
 from beeswax.models import SavedQuery, make_query_context, QueryHistory
 from beeswax.server import dbms
-from beeswax.server.dbms import expand_exception, get_query_server_config,\
-  QueryServerException
+from beeswax.server.dbms import expand_exception, get_query_server_config, QueryServerException
+
+from thrift.transport.TTransport import TTransportException
 
 
 LOG = logging.getLogger(__name__)
@@ -888,8 +889,12 @@ def autocomplete(request, database=None, table=None):
     else:
       t = db.get_table(database, table)
       response['columns'] = [column.name for column in t.cols]
+  except TTransportException, tx:
+    response['code'] = 503
+    response['error'] = tx.message
   except Exception, e:
     LOG.warn('Autocomplete data fetching error %s.%s: %s' % (database, table, e))
+    response['code'] = 500
     response['error'] = e.message
 
 

+ 12 - 4
apps/beeswax/static/js/autocomplete.utils.js

@@ -75,7 +75,9 @@ function hac_getTableColumns(databaseName, tableName, textScanned, callback) {
       table: tableName,
       onDataReceived: function (data) {
         if (data.error) {
-          $(document).trigger('error', data.error);
+          if (typeof HIVE_AUTOCOMPLETE_FAILS_SILENTLY_ON == undefined || data.code == null || HIVE_AUTOCOMPLETE_FAILS_SILENTLY_ON.indexOf(data.code) == -1){
+            $(document).trigger('error', data.error);
+          }
         }
         else {
           $.totalStorage('columns_' + databaseName + '_' + tableName, (data.columns ? data.columns.join(" ") : ""));
@@ -89,7 +91,9 @@ function hac_getTableColumns(databaseName, tableName, textScanned, callback) {
       table: tableName,
       onDataReceived: function (data) {
         if (data.error) {
-          $(document).trigger('error', data.error);
+          if (typeof HIVE_AUTOCOMPLETE_FAILS_SILENTLY_ON == undefined || data.code == null || HIVE_AUTOCOMPLETE_FAILS_SILENTLY_ON.indexOf(data.code) == -1){
+            $(document).trigger('error', data.error);
+          }
         }
         else {
           $.totalStorage('columns_' + databaseName + '_' + tableName, (data.columns ? data.columns.join(" ") : ""));
@@ -117,7 +121,9 @@ function hac_getTables(databaseName, callback) {
       database: databaseName,
       onDataReceived: function (data) {
         if (data.error) {
-          $(document).trigger('error', data.error);
+          if (typeof HIVE_AUTOCOMPLETE_FAILS_SILENTLY_ON == undefined || data.code == null || HIVE_AUTOCOMPLETE_FAILS_SILENTLY_ON.indexOf(data.code) == -1){
+            $(document).trigger('error', data.error);
+          }
         }
         else {
           $.totalStorage('tables_' + databaseName, data.tables.join(" "));
@@ -130,7 +136,9 @@ function hac_getTables(databaseName, callback) {
       database: databaseName,
       onDataReceived: function (data) {
         if (data.error) {
-          $(document).trigger('error', data.error);
+          if (typeof HIVE_AUTOCOMPLETE_FAILS_SILENTLY_ON == undefined || data.code == null || HIVE_AUTOCOMPLETE_FAILS_SILENTLY_ON.indexOf(data.code) == -1){
+            $(document).trigger('error', data.error);
+          }
         }
         else {
           $.totalStorage('tables_' + databaseName, data.tables.join(" "));

+ 10 - 9
apps/filebrowser/src/filebrowser/templates/display.mako

@@ -30,14 +30,6 @@
 
 ${ commonheader(_('%(filename)s - File Viewer') % dict(filename=truncate(filename)), 'filebrowser', user) | n,unicode }
 
-
-
-<div class="container-fluid">
-  % if breadcrumbs:
-        ${fb_components.breadcrumbs(path, breadcrumbs)}
-  %endif
-</div>
-
 <div class="container-fluid">
   <div class="row-fluid">
     <div class="span2">
@@ -92,7 +84,13 @@ ${ commonheader(_('%(filename)s - File Viewer') % dict(filename=truncate(filenam
       </div>
     </div>
     <div class="span10">
-      % if not view['compression'] or view['compression'] in ("none", "avro"):
+      <div class="card" style="margin-top: 0">
+      % if breadcrumbs:
+        ${fb_components.breadcrumbs(path, breadcrumbs)}
+      %endif
+        <div class="card-body">
+          <p>
+            % if not view['compression'] or view['compression'] in ("none", "avro"):
         <div class="pagination">
           <ul>
               <li class="first-block prev disabled"><a href="javascript:void(0);" data-bind="click: firstBlock">${_('First Block')}</a></li>
@@ -160,6 +158,9 @@ ${ commonheader(_('%(filename)s - File Viewer') % dict(filename=truncate(filenam
           </ul>
         </div>
       % endif
+          </p>
+        </div>
+      </div>
     </div>
   </div>
 </div>

+ 27 - 28
apps/filebrowser/src/filebrowser/templates/edit.mako

@@ -33,36 +33,35 @@ ${ commonheader(_('%(filename)s - File Viewer') % dict(filename=truncate(filenam
 
 
 <div class="container-fluid">
-    % if breadcrumbs:
-        ${fb_components.breadcrumbs(path, breadcrumbs)}
-    %endif
-</div>
-
-<div class="container-fluid">
-<div class="well" >
-    <form class="form-stacked" method="post" action="${url('filebrowser.views.save_file')}">
-    <div class="toolbar">
-        <a class="btn" href="${url('filebrowser.views.view', path=dirname_enc)}"><i class="icon-file-text"></i> ${_('Browse location')}</a>
+  <div class="row-fluid">
+    <div class="span12">
+      <div class="card">
+        % if breadcrumbs:
+          ${fb_components.breadcrumbs(path, breadcrumbs)}
+        %endif
+        <div class="card-body" style="margin-top: -20px">
+            <form class="form-stacked" method="post" action="${url('filebrowser.views.save_file')}">
+              % if form.errors:
+              <div class="alert-message">
+                % for field in form:
+                  % if len(field.errors):
+                    ${unicode(field.errors) | n}
+                  % endif
+                % endfor
+              </div>
+              % endif
+              ${edit.render_field(form["path"], hidden=True, notitle=True)}
+              ${edit.render_field(form["encoding"], hidden=True, notitle=True)}
+              <div style="width: 100%; height: 100%;">${edit.render_field(form["contents"], tag="textarea", nolabel=True, notitle=True, attrs=dict(
+                style="width:100%; height:400px;")) | n}</div>
+              <input class="btn btn-primary" type="submit" name="save" value="${_('Save')}">
+              <a id="saveAsBtn" class="btn">${_('Save as')}</a>
+            </form>
+          <br/>
+        </div>
+      </div>
     </div>
-    <br/>
-
-% if form.errors:
-  <div class="alert-message">
-    % for field in form:
-      % if len(field.errors):
-       ${unicode(field.errors) | n}
-      % endif
-    % endfor
   </div>
-% endif
-        ${edit.render_field(form["path"], hidden=True, notitle=True)}
-        ${edit.render_field(form["encoding"], hidden=True, notitle=True)}
-
-        <div style="width: 100%; height: 100%;">${edit.render_field(form["contents"], tag="textarea", notitle=True, attrs=dict(
-          style="width:100%; height:400px;")) | n}</div>
-        <input class="btn btn-primary" type="submit" name="save" value="${_('Save')}">
-        <a id="saveAsBtn" class="btn">${_('Save as')}</a>
-    </form>
 </div>
 
 

+ 1 - 1
apps/filebrowser/src/filebrowser/templates/fb_components.mako

@@ -38,7 +38,7 @@ from django.utils.translation import ugettext as _
         % else:
         <li><a href="${url('filebrowser.views.view', path=urlencode(path))}?default_to_home"><i class="icon-home"></i> ${_('Home')}</a></li>
         <li>
-            <ul class="hueBreadcrumb">
+            <ul class="hueBreadcrumb" style="padding-right:40px; padding-top: 12px">
                     % for breadcrumb_item in breadcrumbs:
                     <% label = breadcrumb_item['label'] %>
                     %if label == '/':

+ 3 - 1
apps/filebrowser/src/filebrowser/templates/listdir.mako

@@ -46,7 +46,7 @@ ${ commonheader(None, 'filebrowser', user) | n,unicode }
             <div id="ch-dropdown" class="btn-group" style="vertical-align: middle">
               <button href="#" class="btn dropdown-toggle" title="${_('Chown / Chmod')}" data-toggle="dropdown" data-bind="visible: !inTrash(), enable: selectedFiles().length > 0">
                 <i class="icon-user"></i> ${_('Chmod / Chown')}
-                <span class="caret"></span>
+                <span class="caret" style="line-height: 29px"></span>
               </button>
               <ul class="dropdown-menu" style="top: auto">
                 <li><a href="#" title="${_('Change owner/group')}" data-bind="visible: !inTrash(), click: changeOwner, enable: selectedFiles().length > 0"><i class="icon-user"></i> ${_('Change owner / group')}</a></li>
@@ -115,7 +115,9 @@ ${ commonheader(None, 'filebrowser', user) | n,unicode }
         ${fb_components.breadcrumbs(path, breadcrumbs, True)}
       %endif
 
+      <div style="padding-left: 6px">
         ${dir.list_table_browser(files, path_enc, current_request_path, cwd_set)}
+      </div>
     </div>
   </div>
 </div>

+ 6 - 6
apps/oozie/src/oozie/templates/editor/edit_workflow.mako

@@ -473,9 +473,9 @@ ${ controls.decision_form(node_form, link_form, default_link_form, 'decision', T
 
       <div class="row-fluid node-action-bar">
         <div class="span12" style="text-align:right">
-          <a class="btn btn-mini edit-node-link" title="${ _('Edit') }" rel="tooltip" data-bind="attr: { 'data-node-type': node_type() }"><i class="icon-pencil"></i></a>
-          <a class="btn btn-mini clone-node-btn" title="${ _('Copy') }" rel="tooltip"><i class="icon-copy"></i></a>
-          <a class="btn btn-mini delete-node-btn" title="${ _('Delete') }" rel="tooltip"><i class="icon-trash"></i></a>
+          <a class="btn btn-mini edit-node-link" title="${ _('Edit') }" relz="tooltip" data-bind="attr: { 'data-node-type': node_type() }"><i class="icon-pencil"></i></a>
+          <a class="btn btn-mini clone-node-btn" title="${ _('Copy') }" relz="tooltip"><i class="icon-copy"></i></a>
+          <a class="btn btn-mini delete-node-btn" title="${ _('Delete') }" relz="tooltip"><i class="icon-trash"></i></a>
           &nbsp;
         </div>
       </div>
@@ -498,8 +498,8 @@ ${ controls.decision_form(node_form, link_form, default_link_form, 'decision', T
 
       <div class="row-fluid node-action-bar">
         <div class="span12" style="text-align:right">
-          <a class="btn btn-mini edit-node-link" title="${ _('Edit') }" rel="tooltip" data-bind="attr: { 'data-node-type': node_type() }"><i class="icon-pencil"></i></a>
-          <a class="btn btn-mini convert-node-link" title="${ _('Convert to Decision') }" data-bind="attr: { 'data-node-type': node_type() }" rel="tooltip"><i class="icon-wrench"></i></a>
+          <a class="btn btn-mini edit-node-link" title="${ _('Edit') }" relz="tooltip" data-bind="attr: { 'data-node-type': node_type() }"><i class="icon-pencil"></i></a>
+          <a class="btn btn-mini convert-node-link" title="${ _('Convert to Decision') }" data-bind="attr: { 'data-node-type': node_type() }" relz="tooltip"><i class="icon-wrench"></i></a>
           &nbsp;
         </div>
       </div>
@@ -533,7 +533,7 @@ ${ controls.decision_form(node_form, link_form, default_link_form, 'decision', T
 
       <div class="row-fluid node-action-bar">
         <div class="span12" style="text-align:right">
-          <a class="btn btn-mini edit-node-link" title="${ _('Edit') }" data-bind="attr: { 'data-node-type': node_type() }" rel="tooltip"><i class="icon-pencil"></i></a>
+          <a class="btn btn-mini edit-node-link" title="${ _('Edit') }" data-bind="attr: { 'data-node-type': node_type() }" relz="tooltip"><i class="icon-pencil"></i></a>
           &nbsp;
         </div>
       </div>

+ 6 - 1
apps/oozie/static/js/workflow.js

@@ -704,7 +704,12 @@ var WorkflowModule = function($, NodeModelChooser, Node, ForkNode, DecisionNode,
 
       methodChooser(self.registry.get(self.start()), self.nodes, false, true);
       $(".tooltip").remove();
-      $("*[rel=tooltip]").tooltip();
+      $("[relz=tooltip]").tooltip({placement: "left", delay: 0});
+      $("[relz=tooltip]").hover(function () {
+        $(".tooltip").css("left", parseInt($(".tooltip").css("left")) - 10 + "px");
+      }, function () {
+        $(".tooltip").remove();
+      });
     },
 
     rebuild: function() {

+ 5 - 2
apps/pig/src/pig/api.py

@@ -214,8 +214,11 @@ class OozieApi:
         get_copy = request.GET.copy() # Hacky, would need to refactor JobBrowser get logs
         get_copy['format'] = 'python'
         request.GET = get_copy
-        logs, workflow_action = self.get_log(request, job)
-        progress = workflow_action[0]['progress']
+        try:
+          logs, workflow_action = self.get_log(request, job)
+          progress = workflow_action[0]['progress']
+        except Exception:
+          progress = 0
       else:
         progress = 100
 

+ 7 - 19
apps/pig/src/pig/templates/app.mako

@@ -618,6 +618,7 @@ ${ commonheader(None, "pig", user, "100px") | n,unicode }
   ko.applyBindings(viewModel);
 
   var HIVE_AUTOCOMPLETE_BASE_URL = "${ autocomplete_base_url | n,unicode }";
+  var HIVE_AUTOCOMPLETE_FAILS_SILENTLY_ON = [503]; // error codes from beeswax/views.py - autocomplete
 
   var codeMirror;
 
@@ -866,15 +867,11 @@ ${ commonheader(None, "pig", user, "100px") | n,unicode }
       $("#runScriptBtn").button("loading");
       $("#withoutLogs").removeClass("hide");
       $("#withLogs").addClass("hide").text("");
-      showAlert("${_('Running')} <b>" + viewModel.currentScript().name() + "</b>...", "info");
+      showAlert("${_('Running')} <b>" + viewModel.currentScript().name() + "</b>...");
     });
 
     $(document).on("saved", function () {
-      showAlert("<b>" + viewModel.currentScript().name() + "</b> ${_('has been saved correctly.')}", "success");
-    });
-
-    $(document).on("error", function () {
-      showAlert("<b>${_('There was an error with your request!')}</b>", "error");
+      showAlert("<b>" + viewModel.currentScript().name() + "</b> ${_('has been saved correctly.')}");
     });
 
     $(document).on("refreshDashboard", function () {
@@ -919,7 +916,7 @@ ${ commonheader(None, "pig", user, "100px") | n,unicode }
     $(window).on("resize", function () {
       window.clearTimeout(_resizeTimeout);
       _resizeTimeout = window.setTimeout(function () {
-        codeMirror.setSize("100%", $(window).height() - 190);
+        codeMirror.setSize("100%", $(window).height() - 276);
       }, 100);
     });
 
@@ -1016,7 +1013,7 @@ ${ commonheader(None, "pig", user, "100px") | n,unicode }
     function showMainSection(mainSection, includeGA) {
       window.setTimeout(function () {
         codeMirror.refresh();
-        codeMirror.setSize("100%", $(window).height() - 190);
+        codeMirror.setSize("100%", $(window).height() - 276);
       }, 100);
 
       if ($("#" + mainSection).is(":hidden")) {
@@ -1178,17 +1175,8 @@ ${ commonheader(None, "pig", user, "100px") | n,unicode }
     }
   };
 
-  var _bottomAlertFade = -1;
-  function showAlert(msg, extraClass) {
-    var klass = "alert ";
-    if (extraClass != null && extraClass != undefined) {
-      klass += "alert-" + extraClass;
-    }
-    $(".bottomAlert").attr("class", "bottomAlert " + klass).html(msg).show();
-    window.clearTimeout(_bottomAlertFade);
-    _bottomAlertFade = window.setTimeout(function () {
-      $(".bottomAlert").fadeOut();
-    }, 3000);
+  function showAlert(msg) {
+    $(document).trigger("info", msg);
   }
 </script>
 

+ 13 - 10
apps/useradmin/static/css/useradmin.css

@@ -52,14 +52,6 @@ input[type=submit] {
   margin-left: 50px;
 }
 
-.form-actions {
-  position: fixed;
-  bottom: 0;
-  left: 0;
-  width: 100%;
-  margin: 0;
-}
-
 .nav {
   margin-bottom: 0;
   margin-top: 20px;
@@ -70,5 +62,16 @@ input[type=submit] {
 }
 
 .form-actions {
-  padding-left: 20px !important;
-}
+  padding-left: 0 !important;
+}
+
+@media all and (max-height: 800px) {
+    .form-actions {
+      position: fixed;
+      bottom: 0;
+      left: 0;
+      width: 100%;
+      margin: 0;
+      padding-left: 20px !important;
+    }
+  }

+ 4 - 0
desktop/core/static/ext/css/bootplus.css

@@ -2723,6 +2723,10 @@ a.btn {
   line-height: 29px;
 }
 
+a.btn-mini {
+  line-height: 19px;
+}
+
 .btn-large {
   height: 54px;
   min-height: 54px;

+ 4 - 4
desktop/core/static/js/jquery.notify.js

@@ -45,7 +45,7 @@
 
     Plugin.prototype.show = function () {
         var _this = this;
-        var MARGIN = 6;
+        var MARGIN = 20;
         var el = $("#jHueNotify").clone();
         el.removeAttr("id");
 
@@ -78,7 +78,7 @@
             el.find(".close").click(function(){
                 el.fadeOut();
                 el.nextAll(".jHueNotify").animate({
-                    top:'-=' + (el.outerHeight() + MARGIN)
+                    top:'-=' + (el.outerHeight() + MARGIN/3)
                 }, 200);
                 el.remove();
             }).show();
@@ -88,7 +88,7 @@
             var t = window.setTimeout(function(){
                 el.fadeOut();
                 el.nextAll(".jHueNotify").animate({
-                    top:'-=' + (el.outerHeight() + MARGIN)
+                    top:'-=' + (el.outerHeight() + MARGIN/3)
                 }, 200);
                 el.remove();
 
@@ -98,7 +98,7 @@
                 $(this).stop(true);
                 $(this).fadeOut();
                 $(this).nextAll(".jHueNotify").animate({
-                    top:'-=' + ($(this).outerHeight() + MARGIN)
+                    top:'-=' + ($(this).outerHeight() + MARGIN/3)
                 }, 200);
             });
             el.show();

+ 4 - 0
tools/bootplus/less/bootplus/buttons.less

@@ -81,6 +81,10 @@ a.btn {
    line-height: 29px;
 }
 
+a.btn-mini {
+   line-height: 19px;
+}
+
 
 // Button Sizes
 // --------------------------------------------------