Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
execute: args => {
const current = getCurrent(args);
if (!current) {
return;
}
return showDialog({
title: 'Shutdown the console?',
body: `Are you sure you want to close "${current.title.label}"?`,
buttons: [Dialog.cancelButton(), Dialog.warnButton()]
}).then(result => {
if (result.button.accept) {
current.console.session.shutdown().then(() => {
current.dispose();
});
} else {
return false;
}
});
},
isEnabled
if (response.status !== 'needed') {
return;
}
const body = (
<div>
JupyterLab build is suggested:
<br>
<pre>{response.message}</pre>
</div>
);
showDialog({
title: 'Build Recommended',
body,
buttons: [Dialog.cancelButton(), Dialog.okButton({ label: 'BUILD' })]
}).then(result => (result.button.accept ? build() : undefined));
});
}
return builder.build().then(() => {
return showDialog({
title: 'Build Complete',
body: 'Build successfully completed, reload page?',
buttons: [Dialog.cancelButton(),
Dialog.warnButton({ label: 'RELOAD' })]
});
}).then(result => {
if (result.button.accept) {
execute: args => {
let path =
typeof args.path === "undefined" ? "" : (args.path as string);
if (path === "") {
showDialog({
body: new OpenIFrameWidget(),
buttons: [
Dialog.cancelButton(),
Dialog.okButton({ label: "GO" })
],
focusNodeSelector: "input",
title: "Open site"
}).then(result => {
if (result.button.label === "CANCEL") {
return;
}
if (!result.value) {
return null;
}
path = result.value as string;
widget = new IFrameWidget(path);
app.shell.add(widget);
app.shell.activateById(widget.id);
this._dialog_shown = true;
var title, body, label;
if (status === "UNREACHABLE") {
title = "Cluster not reachable";
body = "Cluster cannot be reached. Check cluster or your network (e.g. VPN) and then press 'Restart' to restart the kernel or cluster";
label = "Restart";
} else {
title = "Reconfigure cluster";
body = "Reconfigure the cluster, i.e. fix ssh config, install libs, and create Spark Context";
label = "Reconfigure";
}
showDialog({
title: title,
body: body,
buttons: [
Dialog.cancelButton(),
Dialog.warnButton({ label: label })
]
}).then(result => {
if (result.button.accept) {
let context = this._notebookTracker.currentWidget.sessionContext;
this._notebookTracker.currentWidget.sessionContext.kernelDisplayName
let id = context.session.kernel.id;
let name = context.kernelDisplayName;
Private.request("/databrickslabs-jupyterlab-start", name, id)
this.counter.reset();
}
})
this._dialog_shown = false;
}
}
/**
export function getOpenFiles(
options: IFileOptions
): Promise> {
let dialogOptions: Partial> = {
title: options.title,
buttons: [
Dialog.cancelButton(),
Dialog.okButton({
label: 'Select'
})
],
focusNodeSelector: options.focusNodeSelector,
host: options.host,
renderer: options.renderer,
body: new OpenDialog(
options.iconRegistry,
options.manager,
options.filter
)
};
let dialog = new Dialog(dialogOptions);
return dialog.launch();
}
private _maybeOverWrite(path: string): Promise {
let body = `"${path}" already exists. Do you want to replace it?`;
let overwriteBtn = Dialog.warnButton({ label: 'Overwrite' });
return showDialog({
title: 'File Overwrite?',
body,
buttons: [Dialog.cancelButton(), overwriteBtn]
}).then(result => {
if (this.isDisposed) {
return Promise.reject(new Error('Disposed'));
}
if (result.button.label === 'Overwrite') {
return this._manager.contents.delete(path).then(() => {
return this._finishSaveAs(path);
});
}
});
}
export function showPromptDialog(
title: string,
body: string,
confirm: string,
warn: boolean
) {
return showDialog({
title: title,
body: new PromptDialog(body),
buttons: [
Dialog.cancelButton(),
Dialog.okButton({
label: confirm,
displayType: warn ? 'warn' : 'default'
})
]
});
}
export function getSavePath(path: string): Promise {
let saveBtn = Dialog.okButton({ label: 'Save' });
return showDialog({
title: 'Save File As..',
body: new SaveWidget(path),
buttons: [Dialog.cancelButton(), saveBtn]
}).then(result => {
if (result.button.label === 'Save') {
return result.value;
}
return;
});
}