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

25 lines
783 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
import cloneDeep from 'lodash/cloneDeep';
7 years ago
export const reactPanel = new ReactPanelPlugin<TextOptions>(TextPanel);
const validator = (model: PanelModel): TextOptions => {
const options = model.options as TextOptions;
if (!options) {
7 years ago
// Use the same settings from an existing 'text' panel
return cloneDeep(get(model, 'cachedPluginOptions.text'));
}
return options;
};
7 years ago
reactPanel.setEditor(TextPanelEditor);
reactPanel.setDefaults(defaults);
reactPanel.setOptionsValidator(validator);