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 { PanelPlugin, AppNotificationSeverity } from 'app/types';
  8. import { PanelProps, ReactPanelPlugin } 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): PanelPlugin {
  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. module: '',
  41. baseUrl: '',
  42. dataFormats: [],
  43. info: {
  44. author: {
  45. name: '',
  46. },
  47. description: '',
  48. links: [],
  49. logos: {
  50. large: '',
  51. small: '',
  52. },
  53. screenshots: [],
  54. updated: '',
  55. version: '',
  56. },
  57. reactPlugin: new ReactPanelPlugin(NotFound),
  58. angularPlugin: null,
  59. };
  60. }