Просмотр исходного кода

HUE-3549 [editor] Conflict when running explain query on a running query

Romain Rigaux 9 лет назад
Родитель
Сommit
30565e851a

+ 5 - 0
desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

@@ -662,6 +662,11 @@
 
     self.explain = function () {
       logGA('explain');
+
+      if (self.statement() == '' || self.status() == 'running' || self.status() === 'loading') {
+        return;
+      }
+
       self.result.clear();
       self.status('ready');
 

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

@@ -1138,17 +1138,17 @@ ${ hueIcons.symbols() }
 
       <ul class="dropdown-menu less-padding">
         <li>
-          <a href="javascript:void(0)" data-bind="click: explain" title="${ _('Explain the current SQL query') }">
+          <a href="javascript:void(0)" data-bind="click: explain, style: { color: statement() === '' || status() === 'running' || status() === 'loading' ? '#999' : ''}, css: {'disabled': statement() === '' || status() === 'running' || status() === 'loading' }" title="${ _('Explain the current SQL query') }">
             <i class="fa fa-fw fa-map-o"></i> ${_('Explain')}
           </a>
         </li>
         <li>
-          <a href="javascript:void(0)" data-bind="click: format, css: {'disabled': statement() === '' || status() === 'running' || status() === 'loading' }" title="${ _('Format the current SQL query') }">
+          <a href="javascript:void(0)" data-bind="click: format, css: {'disabled': statement() === '' }" title="${ _('Format the current SQL query') }">
             <i class="fa fa-fw fa-indent"></i> ${_('Format')}
           </a>
         </li>
         <li>
-          <a href="javascript:void(0)" data-bind="click: clear" title="${ _('Clear the current editor') }">
+          <a href="javascript:void(0)" data-bind="click: clear, css: {'disabled': statement() === '' }" title="${ _('Clear the current editor') }">
             <i class="fa fa-fw fa-eraser"></i> ${_('Clear')}
           </a>
         </li>