Browse Source

HUE-8399 [editor] Various improvements for embedded mode

- Importer hidden
- Removed reference to Hive from refresh
- Presentation mode hidden
- Query id links in the log hidden
- File option for querying hidden
- Result download hidden
- Clear query history link hidden
- Hide session link in session settings
- Set width of monospace-preload to 0
- Hide favourite app star
- Fix assist refresh alignment and overlap

(cherry picked from commit 2a71c932fa3e85192c169607407a510074dad799)
Johan Ahlen 7 years ago
parent
commit
21bfcf1161

+ 6 - 3
desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

@@ -1512,10 +1512,13 @@
         $element.popover('show');
         var $tip = $element.data('popover').$tip;
         if (HUE_CONTAINER !== 'body') {
+          $tip.css({ 'position': 'fixed', 'z-index': 2000 });
           $tip.appendTo(HUE_CONTAINER);
-          var tipOffset = $tip.offset();
-          var containerOffset = $(HUE_CONTAINER).offset();
-          $tip.offset({ left: tipOffset.left - containerOffset.left, top: tipOffset.top - containerOffset.top });
+
+          $tip.offset({
+            left: $element.offset().left + $element.outerWidth(true) + 10,
+            top: $element.offset().top + ($element.outerHeight(true) / 2) - ($tip.outerHeight(true) / 2)
+          });
         }
         ko.cleanNode($tip.get(0));
         ko.applyBindings(viewModel, $tip.get(0));

+ 4 - 4
desktop/core/src/desktop/templates/assist.mako

@@ -758,12 +758,12 @@ from desktop.views import _ko
     </label>
     <label class="radio">
       <input type="radio" name="refreshImpala" value="invalidate" data-bind="checked: invalidateOnRefresh" />
-      ${ _('Perform incremental metadata update') }
+      ${ _('Perform incremental metadata update.') }
     </label>
-    <div class="assist-invalidate-description">${ _('This will sync missing tables in Hive.') }</div>
+    <div class="assist-invalidate-description">${ _('This will sync missing tables.') }</div>
     <label class="radio">
       <input type="radio" name="refreshImpala" value="invalidateAndFlush" data-bind="checked: invalidateOnRefresh"  />
-      ${ _('Invalidate all metadata and rebuild index') }
+      ${ _('Invalidate all metadata and rebuild index.') }
     </label>
     <div class="assist-invalidate-description">${ _('WARNING: This can be both resource and time-intensive.') }</div>
     <div style="width: 100%; display: inline-block; margin-top: 5px;"><button class="pull-right btn btn-primary" data-bind="css: { 'btn-primary': invalidateOnRefresh() !== 'invalidateAndFlush', 'btn-danger': invalidateOnRefresh() === 'invalidateAndFlush' }, click: function (data, event) { huePubSub.publish('close.popover'); triggerRefresh(data, event); }, clickBubble: false">${ _('Refresh') }</button></div>
@@ -773,7 +773,7 @@ from desktop.views import _ko
     <div class="assist-db-header-actions">
       <!-- ko ifnot: loading -->
       <span class="assist-tables-counter">(<span data-bind="text: filteredEntries().length"></span>)</span>
-      % if hasattr(ENABLE_NEW_CREATE_TABLE, 'get') and ENABLE_NEW_CREATE_TABLE.get():
+      % if hasattr(ENABLE_NEW_CREATE_TABLE, 'get') and ENABLE_NEW_CREATE_TABLE.get() and not IS_EMBEDDED.get():
         <!-- ko if: sourceType === 'hive' || sourceType === 'impala' -->
         <!-- ko if: typeof databaseName !== 'undefined' -->
           <a class="inactive-action" data-bind="hueLink: '${ url('indexer:importer_prefill', source_type='all', target_type='table') }' + databaseName + '/?sourceType=' + sourceType" title="${_('Create table')}" href="javascript:void(0)">

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

@@ -1815,7 +1815,7 @@ ${ commonHeaderFooterComponents.footer(messages) }
 </div>
 % endif
 
-<div class="monospace-preload" style="opacity: 0">
+<div class="monospace-preload" style="opacity: 0; height: 0; width: 0;">
   ${ _('Hue and the Hue logo are trademarks of Cloudera, Inc.') }
   <b>Query. Explore. Repeat.</b>
 </div>

+ 11 - 3
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -192,7 +192,9 @@ ${ sqlSyntaxDropdown.sqlSyntaxDropdown() }
                 <!-- ko case: 'text' -->Text<!-- /ko -->
                 <!-- ko case: $default -->SQL<!-- /ko -->
               <!-- /ko -->
+              % if not IS_EMBEDDED.get():
               <!-- ko component: { name: 'hue-favorite-app', params: { hue4: IS_HUE_4, app: 'editor', interpreter: editorType() }} --><!-- /ko -->
+              % endif
               </a>
             <!-- /ko -->
             <!-- ko ifnot: editorMode -->
@@ -249,7 +251,7 @@ ${ sqlSyntaxDropdown.sqlSyntaxDropdown() }
 
 <script type="text/html" id="notebook-menu-buttons-${ suffix }">
   <div class="pull-right margin-right-10">
-  % if ENABLE_PRESENTATION.get():
+  % if ENABLE_PRESENTATION.get() and not IS_EMBEDDED.get():
     <!-- ko with: selectedNotebook() -->
       <div class="btn-group">
         <a class="btn" data-bind="click: function() { isPresentationMode(!isPresentationMode()); },
@@ -590,11 +592,13 @@ ${ sqlSyntaxDropdown.sqlSyntaxDropdown() }
         % if conf.USE_DEFAULT_CONFIGURATION.get():
           <a class="inactive-action pointer margin-left-10" title="${ _('Save session settings as default') }" rel="tooltip" data-bind="click: function() { $parent.saveDefaultUserProperties($data) }"><i class="fa fa-save"></i> ${ _('Set as default settings') }</a>
         % endif
+        % if not IS_EMBEDDED.get():
         <!-- ko if: type() == 'impala' && typeof http_addr != 'undefined' -->
           <a class="margin-left-10" data-bind="attr: {'href': http_addr()}" target="_blank">
             <span data-bind="text: http_addr().replace(/^(https?):\/\//, '')"></span> <i class="fa fa-external-link"></i>
           </a>
         <!-- /ko -->
+        % endif
       </div>
       % if conf.USE_DEFAULT_CONFIGURATION.get():
       <div style="width:100%;">
@@ -631,6 +635,7 @@ ${ sqlSyntaxDropdown.sqlSyntaxDropdown() }
   <div class="snippet-log-container margin-bottom-10" data-bind="visible: showLogs() && status() != 'ready' && status() != 'loading'" style="display: none;">
     <div data-bind="delayedOverflow: 'slow', css: resultsKlass" style="margin-top: 5px; position: relative;">
       <a href="javascript: void(0)" class="inactive-action close-logs-overlay" data-bind="click: function(){ showLogs(false) }">&times;</a>
+      %if not IS_EMBEDDED.get():
       <ul data-bind="visible: jobs().length > 0, foreach: jobs" class="unstyled jobs-overlay">
         <li data-bind="attr: {'id': $data.name.substr(4)}">
           %if is_embeddable:
@@ -646,6 +651,7 @@ ${ sqlSyntaxDropdown.sqlSyntaxDropdown() }
           <div class="clearfix"></div>
         </li>
       </ul>
+      %endif
       <span data-bind="visible: !$root.isPresentationMode() || !$root.isHidingCode()">
         <pre data-bind="visible: result.logs() && result.logs().length == 0" class="logs logs-bigger">${ _('No logs available at this moment.') }</pre>
         <pre data-bind="visible: result.logs() && result.logs().length > 0, text: result.logs, logScroller: result.logs, logScrollerVisibilityEvent: showLogs" class="logs logs-bigger logs-populated"></pre>
@@ -684,7 +690,9 @@ ${ sqlSyntaxDropdown.sqlSyntaxDropdown() }
           <a class="inactive-action" href="#queryHistory" data-toggle="tab">${_('Query History')}
             <div class="inline-block inactive-action margin-left-10 pointer" title="${_('Search the query history')}" data-bind="click: function(data, e){ $parent.historyFilterVisible(!$parent.historyFilterVisible()); if ($parent.historyFilterVisible()) { window.setTimeout(function(){ $(e.target).parent().siblings('input').focus(); }, 0); } else { $parent.historyFilter('') }}"><i class="snippet-icon fa fa-search"></i></div>
             <input class="input-small inline-tab-filter" type="text" data-bind="visible: $parent.historyFilterVisible, clearable: $parent.historyFilter, valueUpdate:'afterkeydown'" placeholder="${ _('Search...') }">
+            % if not IS_EMBEDDED.get():
             <div class="inline-block inactive-action pointer" title="${_('Clear the query history')}" data-target="#clearHistoryModal${ suffix }" data-toggle="modal" rel="tooltip" data-bind="visible: $parent.history().length > 0"><i class="snippet-icon fa fa-calendar-times-o"></i></div>
+            %endif
           </a>
         </li>
         % if not IS_EMBEDDED.get():
@@ -945,7 +953,7 @@ ${ sqlSyntaxDropdown.sqlSyntaxDropdown() }
 
 
 <script type="text/html" id="snippet-header-statement-type${ suffix }">
-  % if ENABLE_EXTERNAL_STATEMENT.get():
+  % if ENABLE_EXTERNAL_STATEMENT.get() and not IS_EMBEDDED.get():
   <!-- ko if: isSqlDialect() -->
     <div class="margin-left-10 statement-type-selector" data-bind="component: { name: 'hue-drop-down', params: { value: statementType, entries: statementTypes, linkTitle: '${ _ko('Statement type') }' } }" style="display: inline-block"></div>
   <!-- /ko -->
@@ -1921,7 +1929,7 @@ ${ sqlSyntaxDropdown.sqlSyntaxDropdown() }
       </a>
     </div>
 
-    % if conf.ENABLE_DOWNLOAD.get():
+    % if conf.ENABLE_DOWNLOAD.get() and not IS_EMBEDDED.get():
     <div data-bind="component: { name: 'downloadSnippetResults', params: { gridSideBtn: false, snippet: $data, notebook: $parent } }" style="display:inline-block;"></div>
     % endif
   </div>