The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
grafana/public/app/plugins/panel/text2/module.tsx

26 lines
715 B

7 years ago
import { ReactPanelPlugin } from '@grafana/ui';
7 years ago
import { TextPanelEditor } from './TextPanelEditor';
import { TextPanel } from './TextPanel';
import { TextOptions, defaults } from './types';
import { PanelModel } from 'app/features/dashboard/state';
import get from 'lodash/get';
7 years ago
export const reactPanel = new ReactPanelPlugin<TextOptions>(TextPanel);
const validator = (model: PanelModel): TextOptions => {
const options = model.options as TextOptions;
if (!options) {
const old = get(model, 'cachedPluginOptions.text');
if (old) {
return old;
}
}
return options;
};
7 years ago
reactPanel.setEditor(TextPanelEditor);
reactPanel.setDefaults(defaults);
reactPanel.setOptionsValidator(validator);