PanelPluginNotFound.tsx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // Libraries
  2. import _ from 'lodash';
  3. import React, { PureComponent } from 'react';
  4. // Components
  5. import { AlertBox } from 'app/core/components/AlertBox/AlertBox';
  6. // Types
  7. import { AppNotificationSeverity } from 'app/types';
  8. import { PanelPluginMeta, PanelProps, PanelPlugin, PluginType } from '@grafana/ui';
  9. interface Props {
  10. pluginId: string;
  11. }
  12. class PanelPluginNotFound extends PureComponent<Props> {
  13. constructor(props) {
  14. super(props);
  15. }
  16. render() {
  17. const style = {
  18. display: 'flex',
  19. alignItems: 'center',
  20. justifyContent: 'center',
  21. height: '100%',
  22. };
  23. return (
  24. <div style={style}>
  25. <AlertBox severity={AppNotificationSeverity.Error} title={`Panel plugin not found: ${this.props.pluginId}`} />
  26. </div>
  27. );
  28. }
  29. }
  30. export function getPanelPluginNotFound(id: string): PanelPluginMeta {
  31. const NotFound = class NotFound extends PureComponent<PanelProps> {
  32. render() {
  33. return <PanelPluginNotFound pluginId={id} />;
  34. }
  35. };
  36. return {
  37. id: id,
  38. name: id,
  39. sort: 100,
  40. type: PluginType.panel,
  41. module: '',
  42. baseUrl: '',
  43. dataFormats: [],
  44. info: {
  45. author: {
  46. name: '',
  47. },
  48. description: '',
  49. links: [],
  50. logos: {
  51. large: '',
  52. small: '',
  53. },
  54. screenshots: [],
  55. updated: '',
  56. version: '',
  57. },
  58. panelPlugin: new PanelPlugin(NotFound),
  59. angularPlugin: null,
  60. };
  61. }