Browse Source

[spark] Show text result as text and not a table

Romain Rigaux 10 years ago
parent
commit
8ce2995

+ 0 - 2
apps/beeswax/src/beeswax/data_export.py

@@ -14,8 +14,6 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # See the License for the specific language governing permissions and
 # limitations under the License.
 # limitations under the License.
-#
-# Handling of data export
 
 
 import logging
 import logging
 import time
 import time

+ 3 - 0
apps/spark/src/spark/models.py

@@ -368,6 +368,9 @@ class SparkApi():
         msg = ''.join(tb)
         msg = ''.join(tb)
 
 
       raise QueryError(msg)
       raise QueryError(msg)
+    
+  def download(self, notebook, snippet, format):
+    return NotImplementedError()
 
 
   def cancel(self, notebook, snippet):
   def cancel(self, notebook, snippet):
     api = get_spark_api(self.user)
     api = get_spark_api(self.user)

+ 13 - 3
apps/spark/src/spark/templates/editor.mako

@@ -440,14 +440,24 @@ ${ commonheader(_('Query'), app_name, user, "68px") | n,unicode }
           ${ _('Success but empty results.') }
           ${ _('Success but empty results.') }
         </div>
         </div>
 
 
-        <div class="row-fluid" data-bind="visible: result.hasSomeResults() && showGrid()" style="max-height: 400px; margin-top: 4px">
-          <div data-bind="visible: isLeftPanelVisible, css:{'span2': isLeftPanelVisible, 'hidden': !isLeftPanelVisible()}">
+        <!-- ko if: result.hasSomeResults() && result.type() != 'table' -->
+        <div class="row-fluid" style="max-height: 400px; margin-top: 50px">
+          <pre data-bind="text: result.data()[0][1]">            
+          </pre>
+        </div>
+        <!-- /ko -->
+
+        <div class="row-fluid" data-bind="visible: result.hasSomeResults() && result.type() == 'table' && showGrid()" style="max-height: 400px; margin-top: 4px">
+          <div data-bind="visible: isLeftPanelVisible, css:{'span2': isLeftPanelVisible, 'hidden': ! isLeftPanelVisible()}">
             <ul class="nav nav-list" style="border: none; background-color: #FFF">              
             <ul class="nav nav-list" style="border: none; background-color: #FFF">              
               <li class="nav-header pointer" data-bind="click: toggleLeftPanel" title="${_('Hide columns')}">${_('columns')}</li>
               <li class="nav-header pointer" data-bind="click: toggleLeftPanel" title="${_('Hide columns')}">${_('columns')}</li>
               </a>
               </a>
             </ul>
             </ul>
             <ul class="unstyled" data-bind="foreach: result.meta">
             <ul class="unstyled" data-bind="foreach: result.meta">
-              <li data-bind="visible: name != ''"><input type="checkbox" checked="checked" data-bind="event: { change: function(){toggleColumn($element, $index());}}" /> <a class="pointer" data-bind="text: $data.name, click: function(){ scrollToColumn($element, $index()); }"></a></li>
+              <li data-bind="visible: name != ''">
+                <input type="checkbox" checked="checked" data-bind="event: { change: function(){toggleColumn($element, $index());}}" />
+                <a class="pointer" data-bind="text: $data.name, click: function(){ scrollToColumn($element, $index()); }"></a>
+              </li>
             </ul>
             </ul>
           </div>
           </div>
           <div data-bind="css: {'span10': isLeftPanelVisible, 'span12 nomargin': !isLeftPanelVisible()}">
           <div data-bind="css: {'span10': isLeftPanelVisible, 'span12 nomargin': !isLeftPanelVisible()}">