mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
3c6e0e8ef8
* Add and configure eslint-plugin-import * Fix the lint:ts npm command * Autofix + prettier all the files * Manually fix remaining files * Move jquery code in jest-setup to external file to safely reorder imports * Resolve issue caused by circular dependencies within Prometheus * Update .betterer.results * Fix missing // @ts-ignore * ignore iconBundle.ts * Fix missing // @ts-ignore
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import React, { FC } from 'react';
|
|
|
|
import { PluginState } from '@grafana/data';
|
|
import { Badge, BadgeProps } from '@grafana/ui';
|
|
|
|
interface Props {
|
|
state?: PluginState;
|
|
}
|
|
|
|
export const PluginStateInfo: FC<Props> = (props) => {
|
|
const display = getFeatureStateInfo(props.state);
|
|
|
|
if (!display) {
|
|
return null;
|
|
}
|
|
|
|
return <Badge color={display.color} title={display.tooltip} text={display.text} icon={display.icon} />;
|
|
};
|
|
|
|
function getFeatureStateInfo(state?: PluginState): BadgeProps | null {
|
|
switch (state) {
|
|
case PluginState.deprecated:
|
|
return {
|
|
text: 'Deprecated',
|
|
color: 'red',
|
|
tooltip: `This feature is deprecated and will be removed in a future release`,
|
|
};
|
|
case PluginState.alpha:
|
|
return {
|
|
text: 'Alpha',
|
|
color: 'blue',
|
|
tooltip: `This feature is experimental and future updates might not be backward compatible`,
|
|
};
|
|
case PluginState.beta:
|
|
return {
|
|
text: 'Beta',
|
|
color: 'blue',
|
|
tooltip: `This feature is close to complete but not fully tested`,
|
|
};
|
|
default:
|
|
return null;
|
|
}
|
|
}
|