mirror of
https://github.com/grafana/grafana.git
synced 2025-02-14 17:43:35 -06:00
* Transforms: Adds beta notice and updates transform descriptions * Rename organize fields * Webpack - enable images import * Introduce FeatureState type * Alow Container component grow/shrink config * Enable svg import in main app * Jest + webpack for svgs * InfoBox refactor (+ added feature info box), Badge component introduced * Update packages/grafana-ui/src/components/TransformersUI/FilterByNameTransformerEditor.tsx Co-authored-by: Carl Bergquist <carl@grafana.com> * Minor fixes * Update packages/grafana-ui/src/components/TransformersUI/OrganizeFieldsTransformerEditor.tsx Co-authored-by: Carl Bergquist <carl@grafana.com> * Update packages/grafana-ui/src/components/TransformersUI/SeriesToFieldsTransformerEditor.tsx Co-authored-by: Carl Bergquist <carl@grafana.com> * fix typo * Build storybook fixed * Fix padding Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com> Co-authored-by: Carl Bergquist <carl@grafana.com>
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import React from 'react';
|
|
import { Badge, BadgeProps } from '@grafana/ui';
|
|
import { PluginSignatureStatus } from '@grafana/data';
|
|
|
|
interface Props {
|
|
status: PluginSignatureStatus;
|
|
}
|
|
|
|
export const PluginSignatureBadge: React.FC<Props> = ({ status }) => {
|
|
const display = getSignatureDisplayModel(status);
|
|
return <Badge text={display.text} color={display.color} icon={display.icon} tooltip={display.tooltip} />;
|
|
};
|
|
|
|
function getSignatureDisplayModel(signature: PluginSignatureStatus): BadgeProps {
|
|
switch (signature) {
|
|
case PluginSignatureStatus.internal:
|
|
return { text: 'Core', icon: 'cube', color: 'blue', tooltip: 'Core plugin that is bundled with Grafana' };
|
|
case PluginSignatureStatus.valid:
|
|
return { text: 'Signed', icon: 'lock', color: 'green', tooltip: 'Signed and verified plugin' };
|
|
case PluginSignatureStatus.invalid:
|
|
return {
|
|
text: 'Invalid',
|
|
icon: 'exclamation-triangle',
|
|
color: 'red',
|
|
tooltip: 'Invalid plugin signature',
|
|
};
|
|
case PluginSignatureStatus.modified:
|
|
return {
|
|
text: 'Modified',
|
|
icon: 'exclamation-triangle',
|
|
color: 'red',
|
|
tooltip: 'Valid signature but content has been modified',
|
|
};
|
|
}
|
|
|
|
return { text: 'Unsigned', icon: 'exclamation-triangle', color: 'red', tooltip: 'Unsigned external plugin' };
|
|
}
|
|
|
|
PluginSignatureBadge.displayName = 'PluginSignatureBadge';
|