소스 검색

HUE-1913 [impala] invalidate metadata breaks the editor

Add an empty column list instead of null.
Hide chart and column tabs when no result
(better to hide for no result instead of no columns for now and an empty
query has no results so no results.column)
Romain Rigaux 11 년 전
부모
커밋
80ecf51fdb
2개의 변경된 파일7개의 추가작업 그리고 4개의 파일을 삭제
  1. 6 3
      apps/beeswax/src/beeswax/templates/execute.mako
  2. 1 1
      apps/beeswax/static/js/beeswax.vm.js

+ 6 - 3
apps/beeswax/src/beeswax/templates/execute.mako

@@ -282,9 +282,9 @@ ${layout.menubar(section='query')}
         <li><a href="#log" data-toggle="tab">${_('Log')}</a></li>
         <!-- /ko -->
         <!-- ko if: !design.explain() && !design.isRunning() -->
-        <li><a href="#columns" data-toggle="tab">${_('Columns')}</a></li>
+        <li data-bind="css: {'hide': $root.design.results.empty()}"><a href="#columns" data-toggle="tab">${_('Columns')}</a></li>
         <li><a href="#results" data-toggle="tab">${_('Results')}</a></li>
-        <li><a href="#chart" data-toggle="tab">${_('Chart')}</a></li>
+        <li data-bind="css: {'hide': $root.design.results.empty()}"><a href="#chart" data-toggle="tab">${_('Chart')}</a></li>
         <!-- /ko -->
         <!-- ko if: design.explain() && !design.isRunning() -->
         <li><a href="#explanation" data-toggle="tab">${_('Explanation')}</a></li>
@@ -295,16 +295,19 @@ ${layout.menubar(section='query')}
         <div class="tab-pane" id="query">
           <pre data-bind="text: viewModel.design.statement()"></pre>
         </div>
+
         <!-- ko if: design.explain() -->
         <div class="tab-pane" id="explanation">
           <pre data-bind="text: $root.design.results.explanation()"></pre>
         </div>
         <!-- /ko -->
+
         <!-- ko if: !design.explain() -->
         <div class="active tab-pane" id="log">
           <pre data-bind="text: $root.design.watch.logs().join('\n')"></pre>
         </div>
-        <div class="tab-pane" id="columns">
+
+        <div class="tab-pane" id="columns" data-bind="css: {'hide': $root.design.results.empty()}">
           <div data-bind="visible: $root.design.results.columns().length > 10">
             <input id="columnFilter" class="input-xlarge" type="text" placeholder="${_('Filter for column name or type...')}" />
           </div>

+ 1 - 1
apps/beeswax/static/js/beeswax.vm.js

@@ -627,7 +627,7 @@ function BeeswaxViewModel(server) {
           self.design.isRunning(false);
           self.design.isFinished(data.is_finished);
           if (self.design.results.columns().length == 0){
-            self.design.results.columns(data.columns);
+            self.design.results.columns(data.columns ? data.columns : []); // Some querysets have empty or null for columns
           }
           self.design.results.rows.push.apply(self.design.results.rows, data.results);
           self.design.results.empty(self.design.results.rows().length == 0);