dialog.tsx 1011 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright (c) Jupyter Development Team.
  2. // Distributed under the terms of the Modified BSD License.
  3. import { Dialog, showDialog } from '@jupyterlab/apputils';
  4. import * as React from 'react';
  5. /**
  6. * Show a dialog box reporting an error during installation of an extension.
  7. *
  8. * @param name The name of the extension
  9. * @param errorMessage Any error message giving details about the failure.
  10. */
  11. export function reportInstallError(name: string, errorMessage?: string) {
  12. let entries = [];
  13. entries.push(
  14. <p>
  15. An error occurred installing <code>{name}</code>.
  16. </p>
  17. );
  18. if (errorMessage) {
  19. entries.push(
  20. <p>
  21. <span className="jp-extensionmanager-dialog-subheader">
  22. Error message:
  23. </span>
  24. </p>,
  25. <pre>{errorMessage.trim()}</pre>
  26. );
  27. }
  28. let body = <div className="jp-extensionmanager-dialog">{entries}</div>;
  29. void showDialog({
  30. title: 'Extension Installation Error',
  31. body,
  32. buttons: [Dialog.warnButton({ label: 'OK' })]
  33. });
  34. }