mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Apply field overrides in PanelChrome * Move applyFieldOverrides to panel query runner * Review updates * Make sure overrides are applied back on souce panel when exiting the new edit mode * TS ignores in est * Make field display work in viz repeater * Review updates * Review and test updates * Change the way overrides and trransformations are retrieved in PQR * Add fieldConfig property to PanelModel * Dashboard migration v1 * Use field config when exiting new panel edit mode * Gauge - use fieldConfig from panel model * FieldDisplayOptions - don's extend FieldConfigSource * Fix fieldDisplay ts * StatPanel updated * Stat panel defaults applied * Table2 panel options update * React graph updates * BarGauge updated * PieChart, Gauge, BarGauge and Stat updates * PieChart - remove field config defaults from options * FieldDisplayEditor - remove unused methos * PanelModel - remove debugger * Remove fieldConfig from field options when migrating dashboard * Update data links migrations * Update fieldDisaplay tests to respect new fieldConfig * Update dashboard schema version in snapshots * Fix BarGaugePanel test * Rebase fixes * Add onFieldConfigChange to PanelProps type * Update shared single stat migration * Pass PanelModel instead of options only for panel type change handler [breaking] * Renames * Don't mutate panel options * Migrations update * Remove obsolete snap * Minor updates after review * Fix null checks * Temporarily (until we decide to switch to new pane edit) bring back old aditors * Temporarily rename ValueMappingEditor and MappingRow to Legacy* * Migrations update * Updae setFieldConfigDefaults API * Update the way field config defaults are applied * Use standard field config for gauge, bar gauge and stat panels * refactoring * Revert dashboard fieldOptions migrations as those are handled by single stat migrator * Fix ts in tests * Strict null fix and some minor fixes Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import React from 'react';
|
|
|
|
import { FieldOverrideContext, FieldOverrideEditorProps, FieldConfigEditorProps, ValueMapping } from '@grafana/data';
|
|
import { LegacyValueMappingsEditor } from '..';
|
|
|
|
export interface ValueMappingFieldConfigSettings {}
|
|
|
|
export const valueMappingsOverrideProcessor = (
|
|
value: any,
|
|
context: FieldOverrideContext,
|
|
settings: ValueMappingFieldConfigSettings
|
|
) => {
|
|
return value as ValueMapping[]; // !!!! likely not !!!!
|
|
};
|
|
|
|
export class ValueMappingsValueEditor extends React.PureComponent<
|
|
FieldConfigEditorProps<ValueMapping[], ValueMappingFieldConfigSettings>
|
|
> {
|
|
constructor(props: FieldConfigEditorProps<ValueMapping[], ValueMappingFieldConfigSettings>) {
|
|
super(props);
|
|
}
|
|
|
|
render() {
|
|
const { onChange } = this.props;
|
|
let value = this.props.value;
|
|
if (!value) {
|
|
value = [];
|
|
}
|
|
|
|
return <LegacyValueMappingsEditor valueMappings={value} onChange={onChange} />;
|
|
}
|
|
}
|
|
|
|
export class ValueMappingsOverrideEditor extends React.PureComponent<
|
|
FieldOverrideEditorProps<ValueMapping[], ValueMappingFieldConfigSettings>
|
|
> {
|
|
constructor(props: FieldOverrideEditorProps<ValueMapping[], ValueMappingFieldConfigSettings>) {
|
|
super(props);
|
|
}
|
|
|
|
render() {
|
|
return <div>VALUE MAPPINGS OVERRIDE EDITOR {this.props.item.name}</div>;
|
|
}
|
|
}
|