PluginDetailsDisabledError.tsx 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import React, { ReactElement } from 'react';
  2. import { PluginErrorCode } from '@grafana/data';
  3. import { selectors } from '@grafana/e2e-selectors';
  4. import { Alert } from '@grafana/ui';
  5. import { CatalogPlugin } from '../types';
  6. type Props = {
  7. className?: string;
  8. plugin: CatalogPlugin;
  9. };
  10. export function PluginDetailsDisabledError({ className, plugin }: Props): ReactElement | null {
  11. if (!plugin.isDisabled) {
  12. return null;
  13. }
  14. return (
  15. <Alert
  16. severity="error"
  17. title="Plugin disabled"
  18. className={className}
  19. aria-label={selectors.pages.PluginPage.disabledInfo}
  20. >
  21. {renderDescriptionFromError(plugin.error)}
  22. <p>Please contact your server administrator to get this resolved.</p>
  23. <a
  24. href="https://grafana.com/docs/grafana/latest/administration/cli/#plugins-commands"
  25. className="external-link"
  26. target="_blank"
  27. rel="noreferrer"
  28. >
  29. Read more about managing plugins
  30. </a>
  31. </Alert>
  32. );
  33. }
  34. function renderDescriptionFromError(error?: PluginErrorCode): ReactElement {
  35. switch (error) {
  36. case PluginErrorCode.modifiedSignature:
  37. return (
  38. <p>
  39. Grafana Labs checks each plugin to verify that it has a valid digital signature. While doing this, we
  40. discovered that the content of this plugin does not match its signature. We can not guarantee the trustworthy
  41. of this plugin and have therefore disabled it. We recommend you to reinstall the plugin to make sure you are
  42. running a verified version of this plugin.
  43. </p>
  44. );
  45. case PluginErrorCode.invalidSignature:
  46. return (
  47. <p>
  48. Grafana Labs checks each plugin to verify that it has a valid digital signature. While doing this, we
  49. discovered that it was invalid. We can not guarantee the trustworthy of this plugin and have therefore
  50. disabled it. We recommend you to reinstall the plugin to make sure you are running a verified version of this
  51. plugin.
  52. </p>
  53. );
  54. case PluginErrorCode.missingSignature:
  55. return (
  56. <p>
  57. Grafana Labs checks each plugin to verify that it has a valid digital signature. While doing this, we
  58. discovered that there is no signature for this plugin. We can not guarantee the trustworthy of this plugin and
  59. have therefore disabled it. We recommend you to reinstall the plugin to make sure you are running a verified
  60. version of this plugin.
  61. </p>
  62. );
  63. default:
  64. return (
  65. <p>
  66. We failed to run this plugin due to an unkown reason and have therefor disabled it. We recommend you to
  67. reinstall the plugin to make sure you are running a working version of this plugin.
  68. </p>
  69. );
  70. }
  71. }