How to use the @jupyterlab/apputils.Dialog.cancelButton function in @jupyterlab/apputils

To help you get started, we’ve selected a few @jupyterlab/apputils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yuvipanda / simplest-notebook / packages / console-extension / src / index.ts View on Github external
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
github jupyterlab / jupyterlab-data-explorer / jupyterlab / packages / application-extension / src / index.tsx View on Github external
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 =&gt; (result.button.accept ? build() : undefined));
      });
    }
github jupyterlab / jupyterlab / packages / application-extension / src / index.tsx View on Github external
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) {
github wandb / client / wandb / jupyter / lab / js / src / index.ts View on Github external
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);
github databrickslabs / jupyterlab-integration / extensions / databrickslabs_jupyterlab_statusbar / src / dbstatus.tsx View on Github external
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;
      }
    }
    /**
github jupyterlab / jupyterlab / packages / filebrowser / src / opendialog.ts View on Github external
export function getOpenFiles(
    options: IFileOptions
  ): Promise&gt; {
    let dialogOptions: Partial&gt; = {
      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();
  }
github jupyterlab / jupyterlab / packages / docregistry / src / context.ts View on Github external
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 =&gt; {
      if (this.isDisposed) {
        return Promise.reject(new Error('Disposed'));
      }
      if (result.button.label === 'Overwrite') {
        return this._manager.contents.delete(path).then(() =&gt; {
          return this._finishSaveAs(path);
        });
      }
    });
  }
github legion-platform / legion / legion / jupyterlab-plugin / src / components / dialogs / base.ts View on Github external
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'
      })
    ]
  });
}
github jupyterlab / jupyterlab / packages / docregistry / src / context.ts View on Github external
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 =&gt; {
      if (result.button.label === 'Save') {
        return result.value;
      }
      return;
    });
  }