PanelPluginNotFound.tsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 { PanelProps, PanelPlugin, PluginType } from '@grafana/ui';
  9. interface Props {
  10. pluginId: string;
  11. }
  12. class PanelPluginNotFound extends PureComponent<Props> {
  13. constructor(props: 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): PanelPlugin {
  31. const NotFound = class NotFound extends PureComponent<PanelProps> {
  32. render() {
  33. return <PanelPluginNotFound pluginId={id} />;
  34. }
  35. };
  36. const plugin = new PanelPlugin(NotFound);
  37. plugin.meta = {
  38. id: id,
  39. name: id,
  40. sort: 100,
  41. type: PluginType.panel,
  42. module: '',
  43. baseUrl: '',
  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. };
  59. return plugin;
  60. }