Browse Source

[spark] Also hide charts when clearing all snippets

Romain Rigaux 10 năm trước cách đây
mục cha
commit
bc402e9

+ 1 - 1
apps/spark/src/spark/templates/editor.mako

@@ -495,7 +495,7 @@ ${ commonheader(_('Query'), app_name, user, "68px") | n,unicode }
           </div>
         </div>
 
-        <div class="row-fluid" data-bind="visible: showChart()" style="max-height: 400px; margin-top: 4px">
+        <div class="row-fluid" data-bind="visible: status() != 'ready' && showChart()" style="max-height: 400px; margin-top: 4px">
           <div data-bind="visible: isLeftPanelVisible, css:{'span2': isLeftPanelVisible, 'hidden': ! isLeftPanelVisible()}">
             <div class="toggle-left-panel" style="float: right; margin-right: -30px; height: 400px; line-height: 400px; margin-top:0" data-bind="click: toggleLeftPanel">
               <a title="${_('Hide settings')}" class="pointer">

+ 5 - 4
apps/spark/static/js/spark.ko.js

@@ -133,7 +133,7 @@ var Snippet = function (vm, notebook, snippet) {
       var match = ko.utils.arrayFirst(self.variables(), function (_var) {
         return _var.name() == name;
       });
-      if (!match) {
+      if (! match) {
         toAdd.push(name);
       }
     });
@@ -141,7 +141,7 @@ var Snippet = function (vm, notebook, snippet) {
       var match = ko.utils.arrayFirst(newVal, function (name) {
         return _var.name() == name;
       });
-      if (!match) {
+      if (! match) {
         toDelete.push(_var);
       }
     });
@@ -593,9 +593,10 @@ var Notebook = function (vm, notebook) {
   };
   
   self.clearResults = function () {
-	$.each(self.snippets(), function(index, snippet) {
+    $.each(self.snippets(), function(index, snippet) {
       snippet.result.clear();
-	});
+      snippet.status('ready');
+    });
   };
 }