|
|
@@ -38,6 +38,11 @@ import {
|
|
|
ASSIST_GET_SOURCE_EVENT,
|
|
|
ASSIST_SET_SOURCE_EVENT
|
|
|
} from 'ko/components/assist/events';
|
|
|
+import {
|
|
|
+ GLOBAL_ERROR_TOPIC,
|
|
|
+ GLOBAL_INFO_TOPIC,
|
|
|
+ GLOBAL_WARNING_TOPIC
|
|
|
+} from 'reactComponents/AlertComponent/events';
|
|
|
import { POST_FROM_LOCATION_WORKER_EVENT } from 'sql/workers/events';
|
|
|
import {
|
|
|
ACTIVE_STATEMENT_CHANGED_EVENT,
|
|
|
@@ -1654,7 +1659,7 @@ class Snippet {
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
- huePubSub.publish('hue.global.error', { message: data.message });
|
|
|
+ huePubSub.publish(GLOBAL_ERROR_TOPIC, { message: data.message });
|
|
|
self.status('failed');
|
|
|
}
|
|
|
};
|
|
|
@@ -1778,7 +1783,7 @@ class Snippet {
|
|
|
self.previousChartOptions = vm.getPreviousChartOptions(self);
|
|
|
$(document).trigger('executeStarted', { vm: vm, snippet: self });
|
|
|
self.lastExecuted(now);
|
|
|
- $('.jHueNotify').remove();
|
|
|
+ huePubSub.publish('hide.global.alerts');
|
|
|
hueAnalytics.log('notebook', 'execute/' + self.type());
|
|
|
|
|
|
notebook.forceHistoryInitialHeight(true);
|
|
|
@@ -1942,7 +1947,7 @@ class Snippet {
|
|
|
.fail((xhr, textStatus, errorThrown) => {
|
|
|
if (self.statusForButtons() != 'canceled' && xhr.status !== 502) {
|
|
|
// No error when manually canceled
|
|
|
- huePubSub.publish('hue.global.error', { message: xhr.responseText });
|
|
|
+ huePubSub.publish(GLOBAL_ERROR_TOPIC, { message: xhr.responseText });
|
|
|
}
|
|
|
self.status('failed');
|
|
|
self.statusForButtons('executed');
|
|
|
@@ -2126,13 +2131,13 @@ class Snippet {
|
|
|
self.showSqlAnalyzer(true);
|
|
|
self.hasSuggestion(true);
|
|
|
} else {
|
|
|
- huePubSub.publish('hue.global.error', { message: data.message });
|
|
|
+ huePubSub.publish(GLOBAL_ERROR_TOPIC, { message: data.message });
|
|
|
}
|
|
|
}
|
|
|
)
|
|
|
.fail((xhr, textStatus, errorThrown) => {
|
|
|
if (xhr.status !== 502) {
|
|
|
- huePubSub.publish('hue.global.error', { message: xhr.responseText });
|
|
|
+ huePubSub.publish(GLOBAL_ERROR_TOPIC, { message: xhr.responseText });
|
|
|
}
|
|
|
})
|
|
|
.always(() => {
|
|
|
@@ -2204,7 +2209,7 @@ class Snippet {
|
|
|
)
|
|
|
.fail((xhr, textStatus, errorThrown) => {
|
|
|
if (xhr.status !== 502) {
|
|
|
- huePubSub.publish('hue.global.error', { message: xhr.responseText });
|
|
|
+ huePubSub.publish(GLOBAL_ERROR_TOPIC, { message: xhr.responseText });
|
|
|
}
|
|
|
})
|
|
|
.always(() => {
|
|
|
@@ -2298,12 +2303,12 @@ class Snippet {
|
|
|
if (data.status == 0) {
|
|
|
self.result.meta(data.result.meta);
|
|
|
} else {
|
|
|
- huePubSub.publish('hue.global.error', { message: data.message });
|
|
|
+ huePubSub.publish(GLOBAL_ERROR_TOPIC, { message: data.message });
|
|
|
}
|
|
|
}
|
|
|
).fail((xhr, textStatus, errorThrown) => {
|
|
|
if (xhr.status !== 502) {
|
|
|
- huePubSub.publish('hue.global.error', { message: xhr.responseText });
|
|
|
+ huePubSub.publish(GLOBAL_ERROR_TOPIC, { message: xhr.responseText });
|
|
|
}
|
|
|
self.status('failed');
|
|
|
});
|
|
|
@@ -2329,16 +2334,10 @@ class Snippet {
|
|
|
}
|
|
|
} else if (data.status == 5) {
|
|
|
// No supported yet for this snippet
|
|
|
- } else {
|
|
|
- //$(document).trigger("error", data.message);
|
|
|
- //huePubSub.publish('hue.global.error', {message: data.message});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- ).fail((xhr, textStatus, errorThrown) => {
|
|
|
- //$(document).trigger("error", xhr.responseText);
|
|
|
- //huePubSub.publish('hue.global.error', {message: xhr.responseText});
|
|
|
- });
|
|
|
+ );
|
|
|
};
|
|
|
|
|
|
self.checkStatus = function () {
|
|
|
@@ -2419,7 +2418,7 @@ class Snippet {
|
|
|
).fail((xhr, textStatus, errorThrown) => {
|
|
|
if (xhr.stausText !== 'abort') {
|
|
|
if (xhr.status !== 502) {
|
|
|
- huePubSub.publish('hue.global.error', { message: xhr.responseText || textStatus });
|
|
|
+ huePubSub.publish(GLOBAL_ERROR_TOPIC, { message: xhr.responseText || textStatus });
|
|
|
}
|
|
|
self.status('failed');
|
|
|
notebook.isExecutingAll(false);
|
|
|
@@ -2494,7 +2493,7 @@ class Snippet {
|
|
|
)
|
|
|
.fail((xhr, textStatus, errorThrown) => {
|
|
|
if (xhr.status !== 502) {
|
|
|
- huePubSub.publish('hue.global.error', { message: xhr.responseText });
|
|
|
+ huePubSub.publish(GLOBAL_ERROR_TOPIC, { message: xhr.responseText });
|
|
|
}
|
|
|
self.statusForButtons('canceled');
|
|
|
self.status('failed');
|
|
|
@@ -2522,13 +2521,7 @@ class Snippet {
|
|
|
// self._ajaxError(data);
|
|
|
}
|
|
|
}
|
|
|
- ).fail((xhr, textStatus, errorThrown) => {
|
|
|
- if (xhr.status !== 502) {
|
|
|
- // $(document).trigger("error", xhr.responseText);
|
|
|
- //huePubSub.publish('hue.global.error', {message: xhr.responseText});
|
|
|
- }
|
|
|
- // self.status('failed'); // Can conflict with slow close and new query execution
|
|
|
- });
|
|
|
+ );
|
|
|
};
|
|
|
|
|
|
self.clearActiveExecuteRequests = function () {
|
|
|
@@ -2632,7 +2625,7 @@ class Snippet {
|
|
|
).fail((xhr, textStatus, errorThrown) => {
|
|
|
if (xhr.statusText !== 'abort') {
|
|
|
if (xhr.status !== 502) {
|
|
|
- huePubSub.publish('hue.global.error', { message: xhr.responseText || textStatus });
|
|
|
+ huePubSub.publish(GLOBAL_ERROR_TOPIC, { message: xhr.responseText || textStatus });
|
|
|
}
|
|
|
self.status('failed');
|
|
|
}
|
|
|
@@ -2652,14 +2645,14 @@ class Snippet {
|
|
|
},
|
|
|
data => {
|
|
|
if (data.status == 0) {
|
|
|
- $(document).trigger(
|
|
|
- 'info',
|
|
|
- data.upload_history[self.type()].count +
|
|
|
+ huePubSub.publish(GLOBAL_INFO_TOPIC, {
|
|
|
+ message:
|
|
|
+ data.upload_history[self.type()].count +
|
|
|
' queries uploaded successfully. Processing them...'
|
|
|
- );
|
|
|
+ });
|
|
|
self.watchUploadStatus(data.upload_history[self.type()].status.workloadId);
|
|
|
} else {
|
|
|
- huePubSub.publish('hue.global.error', { message: data.message });
|
|
|
+ huePubSub.publish(GLOBAL_ERROR_TOPIC, { message: data.message });
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
@@ -2675,7 +2668,7 @@ class Snippet {
|
|
|
self.uploadTableStats = function (options) {
|
|
|
hueAnalytics.log('notebook', 'load_table_stats');
|
|
|
if (options.showProgress) {
|
|
|
- huePubSub.publish('hue.global.info', { message: 'Preparing table data...' });
|
|
|
+ huePubSub.publish(GLOBAL_INFO_TOPIC, { message: 'Preparing table data...' });
|
|
|
}
|
|
|
|
|
|
$.post(
|
|
|
@@ -2694,19 +2687,19 @@ class Snippet {
|
|
|
data => {
|
|
|
if (data.status == 0) {
|
|
|
if (options.showProgress) {
|
|
|
- $(document).trigger(
|
|
|
- 'info',
|
|
|
- $.map(options.activeTables, table => {
|
|
|
- return table.tableName;
|
|
|
- }) + ' stats sent to analyse'
|
|
|
- );
|
|
|
+ huePubSub.publish(GLOBAL_INFO_TOPIC, {
|
|
|
+ message:
|
|
|
+ $.map(options.activeTables, table => {
|
|
|
+ return table.tableName;
|
|
|
+ }) + ' stats sent to analyse'
|
|
|
+ });
|
|
|
}
|
|
|
if (data.upload_table_ddl && options.showProgress) {
|
|
|
// With showProgress only currently as can be very slow
|
|
|
self.watchUploadStatus(data.upload_table_ddl.status.workloadId, options.showProgress);
|
|
|
}
|
|
|
} else if (options.showProgress) {
|
|
|
- huePubSub.publish('hue.global.error', { message: data.message });
|
|
|
+ huePubSub.publish(GLOBAL_ERROR_TOPIC, { message: data.message });
|
|
|
}
|
|
|
}
|
|
|
).always(() => {
|
|
|
@@ -2725,7 +2718,7 @@ class Snippet {
|
|
|
data => {
|
|
|
if (data.status == 0) {
|
|
|
if (showProgress) {
|
|
|
- huePubSub.publish('hue.global.info', {
|
|
|
+ huePubSub.publish(GLOBAL_INFO_TOPIC, {
|
|
|
message: 'Query processing: ' + data.upload_status.status.state
|
|
|
});
|
|
|
}
|
|
|
@@ -2734,19 +2727,19 @@ class Snippet {
|
|
|
self.watchUploadStatus(workloadId);
|
|
|
}, 2000);
|
|
|
} else if (showProgress) {
|
|
|
- $(document).trigger(
|
|
|
- 'warn',
|
|
|
- data.upload_status.status.statusMsg +
|
|
|
+ huePubSub.publish(GLOBAL_WARNING_TOPIC, {
|
|
|
+ message:
|
|
|
+ data.upload_status.status.statusMsg +
|
|
|
(data.upload_status.status.failedQueries > 0
|
|
|
? '. ' +
|
|
|
data.upload_status.status.failQueryDetails.map(query => {
|
|
|
return query.error;
|
|
|
})
|
|
|
: '')
|
|
|
- );
|
|
|
+ });
|
|
|
}
|
|
|
} else if (showProgress) {
|
|
|
- huePubSub.publish('hue.global.error', { message: data.message });
|
|
|
+ huePubSub.publish(GLOBAL_ERROR_TOPIC, { message: data.message });
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
@@ -2767,7 +2760,7 @@ class Snippet {
|
|
|
// eslint-disable-next-line no-restricted-syntax
|
|
|
console.log(data.statement_similarity);
|
|
|
} else {
|
|
|
- huePubSub.publish('hue.global.error', { message: data.message });
|
|
|
+ huePubSub.publish(GLOBAL_ERROR_TOPIC, { message: data.message });
|
|
|
}
|
|
|
}
|
|
|
);
|