Przeglądaj źródła

[spark] Improved UX for automatic add of snippet after execute

- It now waits until all results are in before adding the new snippet
- No new snippet on failure
- No more automatic scroll to the new snippet
Johan Ahlen 10 lat temu
rodzic
commit
f096ce0e98
1 zmienionych plików z 2 dodań i 6 usunięć
  1. 2 6
      apps/spark/src/spark/static/spark/js/spark.ko.js

+ 2 - 6
apps/spark/src/spark/static/spark/js/spark.ko.js

@@ -389,10 +389,6 @@ var Snippet = function (vm, notebook, snippet) {
 
         self.result.hasResultset(data.handle.has_result_set);
         self.checkStatus();
-
-        if (notebook.snippets()[notebook.snippets().length - 1] == self) {
-          notebook.newSnippet();
-        }
       } else {
         self._ajaxError(data, self.execute);
       }
@@ -443,6 +439,8 @@ var Snippet = function (vm, notebook, snippet) {
           setTimeout(function () {
             self.fetchResultData(rows, false);
           }, 500);
+        } else if (notebook.snippets()[notebook.snippets().length - 1] == self) {
+          notebook.newSnippet();
         }
       } else {
         self._ajaxError(data);
@@ -743,8 +741,6 @@ var Notebook = function (vm, notebook) {
       if (lastSnippet.ace() != null) {
         lastSnippet.ace().focus();
       }
-
-      $(".right-panel").scrollTop($(".right-panel").prop('scrollHeight'));
     }, 100);
 
     logGA('/add_snippet/' + self.selectedSnippet());