mirror of
https://github.com/grafana/grafana.git
synced 2025-02-09 23:16:16 -06:00
* Chore: Fix typescript strict null errors * Added new limit * Fixed ts issue * fixed tests * trying to fix type inference * Fixing more ts errors * Revert tsconfig option * Fix * Fixed code * More fixes * fix tests * Updated snapshot * Chore: More ts strict null fixes * More fixes in some really messed up azure config components * More fixes, current count: 441 * 419 * More fixes * Fixed invalid initial state in explore * Fixing tests * Fixed tests * Explore fix * More fixes * Progress * Sub 300 * Fixed incorrect type * removed unused import
44 lines
1.4 KiB
TypeScript
44 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 {
|
|
if (!signature) {
|
|
signature = PluginSignatureStatus.invalid;
|
|
}
|
|
|
|
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';
|