grafana/public/app/features/plugins/PluginStateInfo.tsx
Torkel Ödegaard 702fd1cad9
Visualizations: Dynamically set any config (min, max, unit, color, thresholds) from query results (#36548)
* initial steps for config from data

* Moving to core and separate transforms

* Progress

* Rows to fields are starting to work

* Config from query transform working

* UI progress

* More scenarios working

* Update public/app/core/components/TransformersUI/rowsToFields/rowsToFields.ts

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>

* transform all

* Refactor

* UI starting to work

* Add matcher UI to transform

* Apply to self

* Adding a reducer option

* Value mapping via new all values reducer

* value mappings workg add -A

* Minor changes

* Improving UI and adding test dashboards

* RowsToFieldsTransformerEditor tests

* Added tests for FieldToConfigMapping Editor

* Added test for ConfigFromQueryTransformerEditor

* Minor UI tweaks

* Added missing test

* Added label extraction

* unified mapping

* Progress refactoring

* Updates

* UI tweaks

* Rename

* Updates

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2021-07-13 10:51:34 +02:00

43 lines
1.1 KiB
TypeScript

import React, { FC } from 'react';
import { Badge, BadgeProps } from '@grafana/ui';
import { PluginState } from '@grafana/data';
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;
}
}