mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 05:46:28 +08:00

* PanelOptions: Refactoring on applying panel and field options from PanelModel * Progress * Filtering out props * downgraded prettier * Fixes * Initial simple remember and restore for custom and overrides * clearing custom options and overrides and restoring works * actually use the function * Added type for options cache * minor fix * Updated with new prettier * Added old field config to panel type change handler * Update public/app/features/dashboard/state/getPanelOptionsWithDefaults.test.ts Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com> Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
104 lines
2.2 KiB
TypeScript
104 lines
2.2 KiB
TypeScript
import { identityOverrideProcessor, ThresholdsMode } from '@grafana/data';
|
|
|
|
export function mockStandardFieldConfigOptions() {
|
|
const unit = {
|
|
id: 'unit',
|
|
path: 'unit',
|
|
name: 'Unit',
|
|
description: 'Value units',
|
|
// @ts-ignore
|
|
editor: () => null,
|
|
// @ts-ignore
|
|
override: () => null,
|
|
process: identityOverrideProcessor,
|
|
shouldApply: () => true,
|
|
};
|
|
|
|
const decimals = {
|
|
id: 'decimals',
|
|
path: 'decimals',
|
|
name: 'Decimals',
|
|
description: 'Number of decimal to be shown for a value',
|
|
// @ts-ignore
|
|
editor: () => null,
|
|
// @ts-ignore
|
|
override: () => null,
|
|
process: identityOverrideProcessor,
|
|
shouldApply: () => true,
|
|
};
|
|
|
|
const boolean = {
|
|
id: 'boolean',
|
|
path: 'boolean',
|
|
name: 'Boolean',
|
|
description: '',
|
|
// @ts-ignore
|
|
editor: () => null,
|
|
// @ts-ignore
|
|
override: () => null,
|
|
process: identityOverrideProcessor,
|
|
shouldApply: () => true,
|
|
};
|
|
|
|
const fieldColor = {
|
|
id: 'color',
|
|
path: 'color',
|
|
name: 'color',
|
|
description: '',
|
|
// @ts-ignore
|
|
editor: () => null,
|
|
// @ts-ignore
|
|
override: () => null,
|
|
process: identityOverrideProcessor,
|
|
shouldApply: () => true,
|
|
};
|
|
|
|
const text = {
|
|
id: 'text',
|
|
path: 'text',
|
|
name: 'text',
|
|
description: '',
|
|
// @ts-ignore
|
|
editor: () => null,
|
|
// @ts-ignore
|
|
override: () => null,
|
|
process: identityOverrideProcessor,
|
|
shouldApply: () => true,
|
|
};
|
|
|
|
const number = {
|
|
id: 'number',
|
|
path: 'number',
|
|
name: 'number',
|
|
description: '',
|
|
// @ts-ignore
|
|
editor: () => null,
|
|
// @ts-ignore
|
|
override: () => null,
|
|
process: identityOverrideProcessor,
|
|
shouldApply: () => true,
|
|
};
|
|
|
|
const thresholds = {
|
|
id: 'thresholds',
|
|
path: 'thresholds',
|
|
name: 'thresholds',
|
|
description: '',
|
|
// @ts-ignore
|
|
editor: () => null,
|
|
// @ts-ignore
|
|
override: () => null,
|
|
process: identityOverrideProcessor,
|
|
shouldApply: () => true,
|
|
defaultValue: {
|
|
mode: ThresholdsMode.Absolute,
|
|
steps: [
|
|
{ value: -Infinity, color: 'green' },
|
|
{ value: 80, color: 'red' },
|
|
],
|
|
},
|
|
};
|
|
|
|
return [unit, decimals, boolean, fieldColor, text, number, thresholds];
|
|
}
|