Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Kernel.prototype.interrupt = function (success, error) {
this.events.trigger('kernel_interrupting.Kernel', {kernel: this});
var that = this;
var on_success = function (data, status, xhr) {
/**
* get kernel info so we know what state the kernel is in
*/
that.kernel_info();
if (success) {
success(data, status, xhr);
}
};
var url = utils.url_join_encode(this.kernel_url, 'interrupt');
$.ajax(url, {
processData: false,
cache: false,
type: "POST",
contentType: false, // there's no data with this
dataType: "json",
success: this._on_success(on_success),
error: this._on_error(error)
});
};
SaveWidget.prototype.update_address_bar = function (path) {
var state = {path : path};
window.history.replaceState(state, "", utils.url_join_encode(
this.editor.base_url,
"edit",
path)
);
};
TerminalList.prototype.load_terminals = function() {
var url = utils.url_join_encode(this.base_url, 'api/terminals');
$.ajax(url, {
type: "GET",
cache: false,
dataType: "json",
success: $.proxy(this.terminals_loaded, this),
error : utils.log_ajax_error
});
};
TerminalList.prototype.add_link = function(name, item) {
item.data('term-name', name);
item.find(".item_name").text("terminals/" + name);
item.find(".item_icon").addClass("fa fa-terminal");
var link = item.find("a.item_link")
.attr('href', utils.url_join_encode(this.base_url, "terminals", name));
link.attr('target', IPython._target||'_blank');
this.add_shutdown_button(name, item);
};
MenuBar.prototype._nbconvert = function (format, download) {
download = download || false;
var notebook_path = this.notebook.notebook_path;
var url = utils.url_join_encode(
this.base_url,
'nbconvert',
format,
notebook_path
) + "?download=" + download.toString();
var w = window.open('', IPython._target);
if (this.notebook.dirty) {
this.notebook.save_notebook().then(function() {
w.location = url;
});
} else {
w.location = url;
}
};
function (data) {
w.location = utils.url_join_encode(
base_url, 'notebooks', data.path
);
},
function(error) {
function (data) {
var url = utils.url_join_encode(
that.notebook.base_url, 'notebooks', data.path
);
url += "?kernel_name=" + kernel_name;
w.location = url;
},
function(error) {
SaveWidget.prototype.update_address_bar = function(){
var base_url = this.notebook.base_url;
var path = this.notebook.notebook_path;
var state = {path : path};
window.history.replaceState(state, "", utils.url_join_encode(
base_url,
"notebooks",
path)
);
};
Session.prototype._update_model = function (data) {
if (data && data.id) {
this.id = data.id;
this.session_url = utils.url_join_encode(this.session_service_url, this.id);
}
if (data && data.notebook) {
this.notebook_model.path = data.notebook.path;
}
if (data && data.kernel) {
this.kernel_model.name = data.kernel.name;
this.kernel_model.id = data.kernel.id;
}
};
ConfigSection.prototype.api_url = function() {
return utils.url_join_encode(this.base_url, 'api/config', this.section_name);
};