PluginDetailsHeaderSignature.tsx 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { css } from '@emotion/css';
  2. import React from 'react';
  3. import { GrafanaTheme2, PluginSignatureStatus } from '@grafana/data';
  4. import { PluginSignatureBadge, useStyles2 } from '@grafana/ui';
  5. import { CatalogPlugin } from '../types';
  6. import { PluginSignatureDetailsBadge } from './PluginSignatureDetailsBadge';
  7. type Props = {
  8. plugin: CatalogPlugin;
  9. };
  10. // Designed to show plugin signature information in the header on the plugin's details page
  11. export function PluginDetailsHeaderSignature({ plugin }: Props): React.ReactElement {
  12. const styles = useStyles2(getStyles);
  13. const isSignatureValid = plugin.signature === PluginSignatureStatus.valid;
  14. return (
  15. <div className={styles.container}>
  16. <a
  17. href="https://grafana.com/docs/grafana/latest/plugins/plugin-signatures/"
  18. target="_blank"
  19. rel="noreferrer"
  20. className={styles.link}
  21. >
  22. <PluginSignatureBadge status={plugin.signature} />
  23. </a>
  24. {isSignatureValid && (
  25. <PluginSignatureDetailsBadge signatureType={plugin.signatureType} signatureOrg={plugin.signatureOrg} />
  26. )}
  27. </div>
  28. );
  29. }
  30. export const getStyles = (theme: GrafanaTheme2) => {
  31. return {
  32. container: css`
  33. display: flex;
  34. `,
  35. link: css`
  36. display: inline-flex;
  37. align-items: center;
  38. `,
  39. };
  40. };