|
|
@@ -917,6 +917,10 @@ var EditorViewModel = (function() {
|
|
|
}
|
|
|
else if (data.status == -3) { // Statement expired
|
|
|
self.status('expired');
|
|
|
+ if (data.message) {
|
|
|
+ self.errors.push({message: data.message, line: null, col: null});
|
|
|
+ huePubSub.publish('editor.snippet.result.normal', self);
|
|
|
+ }
|
|
|
}
|
|
|
else if (data.status == -4) { // Operation timed out
|
|
|
notebook.retryModalCancel = function () {
|
|
|
@@ -1249,28 +1253,32 @@ var EditorViewModel = (function() {
|
|
|
self.isFetchingData = false;
|
|
|
self.fetchResultData = function (rows, startOver) {
|
|
|
if (! self.isFetchingData) {
|
|
|
- startLongOperationTimeout();
|
|
|
- self.isFetchingData = true;
|
|
|
- logGA('fetchResult/' + rows + '/' + startOver);
|
|
|
- $.post("/notebook/api/fetch_result_data", {
|
|
|
- notebook: ko.mapping.toJSON(notebook.getContext()),
|
|
|
- snippet: ko.mapping.toJSON(self.getContext()),
|
|
|
- rows: rows,
|
|
|
- startOver: startOver
|
|
|
- }, function (data) {
|
|
|
- stopLongOperationTimeout();
|
|
|
- data = JSON.bigdataParse(data);
|
|
|
- if (data.status == 0) {
|
|
|
- self.loadData(data.result, rows);
|
|
|
- } else {
|
|
|
- self._ajaxError(data, function() {self.isFetchingData = false; self.fetchResultData(rows, startOver); });
|
|
|
- $(document).trigger("renderDataError", {snippet: self});
|
|
|
- }
|
|
|
- }, 'text').fail(function (xhr, textStatus, errorThrown) {
|
|
|
- $(document).trigger("error", xhr.responseText);
|
|
|
- }).always(function () {
|
|
|
- self.isFetchingData = false;
|
|
|
- });
|
|
|
+ if( self.status() == 'available') {
|
|
|
+ startLongOperationTimeout();
|
|
|
+ self.isFetchingData = true;
|
|
|
+ logGA('fetchResult/' + rows + '/' + startOver);
|
|
|
+ $.post("/notebook/api/fetch_result_data", {
|
|
|
+ notebook: ko.mapping.toJSON(notebook.getContext()),
|
|
|
+ snippet: ko.mapping.toJSON(self.getContext()),
|
|
|
+ rows: rows,
|
|
|
+ startOver: startOver
|
|
|
+ }, function (data) {
|
|
|
+ stopLongOperationTimeout();
|
|
|
+ data = JSON.bigdataParse(data);
|
|
|
+ if (data.status == 0) {
|
|
|
+ self.loadData(data.result, rows);
|
|
|
+ } else {
|
|
|
+ self._ajaxError(data, function() {self.isFetchingData = false; self.fetchResultData(rows, startOver); });
|
|
|
+ $(document).trigger("renderDataError", {snippet: self});
|
|
|
+ }
|
|
|
+ }, 'text').fail(function (xhr, textStatus, errorThrown) {
|
|
|
+ $(document).trigger("error", xhr.responseText);
|
|
|
+ }).always(function () {
|
|
|
+ self.isFetchingData = false;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ huePubSub.publish('editor.snippet.result.normal', self);
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
|