Răsfoiți Sursa

HUE-9066 [gist] Adding link button in sub execute dropdown

Romain 6 ani în urmă
părinte
comite
f8804e8832

+ 9 - 0
desktop/core/src/desktop/js/apps/notebook2/components/ko.snippetEditorActions.js

@@ -39,6 +39,13 @@ const TEMPLATE = `
           <i class="fa fa-fw fa-map-o"></i> ${I18n('Explain')}
         </a>
       </li>
+      <li>
+        <a href="javascript:void(0)" data-bind="click: format, css: { 'disabled': !createGistEnabled() }" title="${I18n(
+          'Create a gist link for sharing the selected SQL queries'
+        )}">
+          <i class="fa fa-wf fa-link"></i> ${I18n('Share')}
+        </a>
+      </li>
       <li>
         <a href="javascript:void(0)" data-bind="click: format, css: { 'disabled': !formatEnabled() }" title="${I18n(
           'Format the current SQL query'
@@ -93,6 +100,8 @@ class SnippetEditorActions {
       () => this.snippet.type() === 'hive' || this.snippet.type() === 'impala'
     );
 
+    this.createGistEnabled = ko.pureComputed(() => this.snippet.statement() !== '');
+
     this.explainEnabled = ko.pureComputed(
       () =>
         this.snippet.isReady() &&

+ 1 - 0
desktop/core/src/desktop/templates/global_js_constants.mako

@@ -286,6 +286,7 @@
     'Foreign key': '${_('Foreign key')}',
     'Foreign keys': '${_('Foreign keys')}',
     'Format the current SQL query': '${ _('Format the current SQL query') }',
+    'Create a gist link for sharing the selected SQL queries': '${ _('Create a gist link for sharing the selected SQL queries') }',
     'Format': '${ _('Format') }',
     'France': '${ _('France') }',
     'Functions': '${ _('Functions') }',

+ 5 - 0
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -1793,6 +1793,11 @@ ${ sqlSyntaxDropdown.sqlSyntaxDropdown() }
             <i class="fa fa-fw fa-map-o"></i> ${_('Explain')}
           </a>
         </li>
+        <li>
+          <a href="javascript:void(0)" data-bind="click: clear, css: {'disabled': ! isReady() }" title="${ _('Create a gist link for sharing the selected SQL queries') }">
+            <i class="fa fa-fw fa-link"></i> ${_('Share')}
+          </a>
+        </li>
         <!-- ko if: formatEnabled -->
         <li>
           <a href="javascript:void(0)" data-bind="click: format, css: {'disabled': ! isReady() }" title="${ _('Format the current SQL query') }">