jupyterlab-emrys
Version:
A computational environment for Jupyter. Powered by Emrys
47 lines (46 loc) • 1.32 kB
JavaScript
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
;
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var dialog_1 = require('../dialog');
__export(require('../utils'));
/**
* The class name added to FileBrowser instances.
*/
exports.FILE_BROWSER_CLASS = 'jp-FileBrowser';
/**
* The class name added to drop targets.
*/
exports.DROP_TARGET_CLASS = 'jp-mod-dropTarget';
/**
* The class name added to selected rows.
*/
exports.SELECTED_CLASS = 'jp-mod-selected';
/**
* The mime type for a contents drag object.
*/
exports.CONTENTS_MIME = 'application/x-jupyter-icontents';
/**
* An error message dialog to show in the filebrowser widget.
*/
function showErrorMessage(host, title, error) {
console.error(error);
if (!host.isAttached) {
return;
}
// Find the file browser node.
var node = host.node;
while (!node.classList.contains(exports.FILE_BROWSER_CLASS)) {
node = node.parentElement;
}
var options = {
title: title,
body: error.message || "File " + title,
buttons: [dialog_1.okButton],
okText: 'DISMISS'
};
return dialog_1.showDialog(options).then(function () { });
}
exports.showErrorMessage = showErrorMessage;