|
@@ -802,8 +802,6 @@
|
|
|
_snippet.status('loading');
|
|
_snippet.status('loading');
|
|
|
self.createSession(new Session(vm, {'type': _snippet.type()}));
|
|
self.createSession(new Session(vm, {'type': _snippet.type()}));
|
|
|
}, 200);
|
|
}, 200);
|
|
|
- } else {
|
|
|
|
|
- _snippet.status('ready');
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
_snippet.init();
|
|
_snippet.init();
|
|
@@ -834,30 +832,30 @@
|
|
|
$.post("/notebook/api/create_session", {
|
|
$.post("/notebook/api/create_session", {
|
|
|
notebook: ko.mapping.toJSON(self.getContext()),
|
|
notebook: ko.mapping.toJSON(self.getContext()),
|
|
|
session: ko.mapping.toJSON(session) // e.g. {'type': 'hive', 'properties': [{'name': driverCores', 'value', '2'}]}
|
|
session: ko.mapping.toJSON(session) // e.g. {'type': 'hive', 'properties': [{'name': driverCores', 'value', '2'}]}
|
|
|
- }, function (data) {
|
|
|
|
|
- if (data.status == 0) {
|
|
|
|
|
- ko.mapping.fromJS(data.session, {}, session);
|
|
|
|
|
- if (self.getSession(session.type()) == null) {
|
|
|
|
|
- self.addSession(session);
|
|
|
|
|
|
|
+ }, function (data) {
|
|
|
|
|
+ if (data.status == 0) {
|
|
|
|
|
+ ko.mapping.fromJS(data.session, {}, session);
|
|
|
|
|
+ if (self.getSession(session.type()) == null) {
|
|
|
|
|
+ self.addSession(session);
|
|
|
|
|
+ }
|
|
|
|
|
+ $.each(self.getSnippets(session.type()), function(index, snippet) {
|
|
|
|
|
+ snippet.status('ready');
|
|
|
|
|
+ });
|
|
|
|
|
+ if (callback) {
|
|
|
|
|
+ setTimeout(callback, 500);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (data.status == 401) {
|
|
|
|
|
+ $(document).trigger("showAuthModal", {'type': session.type()});
|
|
|
}
|
|
}
|
|
|
- $.each(self.getSnippets(session.type()), function(index, snippet) {
|
|
|
|
|
- snippet.status('ready');
|
|
|
|
|
- });
|
|
|
|
|
- if (callback) {
|
|
|
|
|
- setTimeout(callback, 500);
|
|
|
|
|
|
|
+ else {
|
|
|
|
|
+ fail(data.message);
|
|
|
}
|
|
}
|
|
|
- } else if (data.status == 401) {
|
|
|
|
|
- $(document).trigger("showAuthModal", {'type': session.type()});
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- fail(data.message);
|
|
|
|
|
- }
|
|
|
|
|
- }).fail(function (xhr) {
|
|
|
|
|
- fail(xhr.responseText);
|
|
|
|
|
- }).complete(function(xhr, status) {
|
|
|
|
|
- self.creatingSessionLocks.remove(session.type());
|
|
|
|
|
- })
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ }).fail(function (xhr) {
|
|
|
|
|
+ fail(xhr.responseText);
|
|
|
|
|
+ }).complete(function(xhr, status) {
|
|
|
|
|
+ self.creatingSessionLocks.remove(session.type());
|
|
|
|
|
+ })
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
self.authSession = function () {
|
|
self.authSession = function () {
|
|
|
self.createSession(new Session(vm, {
|
|
self.createSession(new Session(vm, {
|
|
@@ -1125,7 +1123,7 @@
|
|
|
$(document).trigger("editingToggled");
|
|
$(document).trigger("editingToggled");
|
|
|
});
|
|
});
|
|
|
self.toggleEditing = function () {
|
|
self.toggleEditing = function () {
|
|
|
- self.isEditing(!self.isEditing());
|
|
|
|
|
|
|
+ self.isEditing(! self.isEditing());
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
self.authSessionUsername = ko.observable(); // UI popup
|
|
self.authSessionUsername = ko.observable(); // UI popup
|