PluginStateInfo.tsx 806 B

123456789101112131415161718192021222324252627282930313233
  1. import React, { FC } from 'react';
  2. import { PluginState, AlphaNotice } from '@grafana/ui';
  3. import { css } from 'emotion';
  4. interface Props {
  5. state?: PluginState;
  6. }
  7. function getPluginStateInfoText(state?: PluginState): string | null {
  8. switch (state) {
  9. case PluginState.alpha:
  10. return 'Alpha Plugin: This plugin is a work in progress and updates may include breaking changes';
  11. case PluginState.beta:
  12. return 'Beta Plugin: There could be bugs and minor breaking changes to this plugin';
  13. }
  14. return null;
  15. }
  16. const PluginStateinfo: FC<Props> = props => {
  17. const text = getPluginStateInfoText(props.state);
  18. return (
  19. <AlphaNotice
  20. state={props.state}
  21. text={text}
  22. className={css`
  23. margin-left: 16px;
  24. `}
  25. />
  26. );
  27. };
  28. export default PluginStateinfo;