mirror of https://github.com/grafana/grafana
grafana/data: Move getPanelOptionsWithDefaults from core (#60813)
* grafana/data: Move getPanelOptionsWithDefaults from core * Add internal commentspull/60820/head
parent
168afa99d1
commit
c3c4a57c79
@ -0,0 +1,112 @@ |
||||
import { identityOverrideProcessor, ThresholdsMode } from '../../src'; |
||||
|
||||
export function mockStandardFieldConfigOptions() { |
||||
const category = ['Standard options']; |
||||
|
||||
const unit = { |
||||
category, |
||||
id: 'unit', |
||||
path: 'unit', |
||||
name: 'Unit', |
||||
description: 'Value units', |
||||
// @ts-ignore
|
||||
editor: () => null, |
||||
// @ts-ignore
|
||||
override: () => null, |
||||
process: identityOverrideProcessor, |
||||
shouldApply: () => true, |
||||
}; |
||||
|
||||
const decimals = { |
||||
category, |
||||
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 = { |
||||
category, |
||||
id: 'boolean', |
||||
path: 'boolean', |
||||
name: 'Boolean', |
||||
description: '', |
||||
// @ts-ignore
|
||||
editor: () => null, |
||||
// @ts-ignore
|
||||
override: () => null, |
||||
process: identityOverrideProcessor, |
||||
shouldApply: () => true, |
||||
}; |
||||
|
||||
const fieldColor = { |
||||
category, |
||||
id: 'color', |
||||
path: 'color', |
||||
name: 'color', |
||||
description: '', |
||||
// @ts-ignore
|
||||
editor: () => null, |
||||
// @ts-ignore
|
||||
override: () => null, |
||||
process: identityOverrideProcessor, |
||||
shouldApply: () => true, |
||||
}; |
||||
|
||||
const text = { |
||||
category, |
||||
id: 'text', |
||||
path: 'text', |
||||
name: 'text', |
||||
description: '', |
||||
// @ts-ignore
|
||||
editor: () => null, |
||||
// @ts-ignore
|
||||
override: () => null, |
||||
process: identityOverrideProcessor, |
||||
shouldApply: () => true, |
||||
}; |
||||
|
||||
const number = { |
||||
category, |
||||
id: 'number', |
||||
path: 'number', |
||||
name: 'number', |
||||
description: '', |
||||
// @ts-ignore
|
||||
editor: () => null, |
||||
// @ts-ignore
|
||||
override: () => null, |
||||
process: identityOverrideProcessor, |
||||
shouldApply: () => true, |
||||
}; |
||||
|
||||
const thresholds = { |
||||
category: ['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]; |
||||
} |
@ -1,4 +1,4 @@ |
||||
{ |
||||
"exclude": ["dist", "node_modules", "**/*.test.ts*"], |
||||
"exclude": ["dist", "node_modules", "test", "**/*.test.ts*"], |
||||
"extends": "./tsconfig.json" |
||||
} |
||||
|
@ -1,112 +0,0 @@ |
||||
import { identityOverrideProcessor, ThresholdsMode } from '@grafana/data'; |
||||
|
||||
export function mockStandardFieldConfigOptions() { |
||||
const category = ['Standard options']; |
||||
|
||||
const unit = { |
||||
category, |
||||
id: 'unit', |
||||
path: 'unit', |
||||
name: 'Unit', |
||||
description: 'Value units', |
||||
// @ts-ignore
|
||||
editor: () => null, |
||||
// @ts-ignore
|
||||
override: () => null, |
||||
process: identityOverrideProcessor, |
||||
shouldApply: () => true, |
||||
}; |
||||
|
||||
const decimals = { |
||||
category, |
||||
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 = { |
||||
category, |
||||
id: 'boolean', |
||||
path: 'boolean', |
||||
name: 'Boolean', |
||||
description: '', |
||||
// @ts-ignore
|
||||
editor: () => null, |
||||
// @ts-ignore
|
||||
override: () => null, |
||||
process: identityOverrideProcessor, |
||||
shouldApply: () => true, |
||||
}; |
||||
|
||||
const fieldColor = { |
||||
category, |
||||
id: 'color', |
||||
path: 'color', |
||||
name: 'color', |
||||
description: '', |
||||
// @ts-ignore
|
||||
editor: () => null, |
||||
// @ts-ignore
|
||||
override: () => null, |
||||
process: identityOverrideProcessor, |
||||
shouldApply: () => true, |
||||
}; |
||||
|
||||
const text = { |
||||
category, |
||||
id: 'text', |
||||
path: 'text', |
||||
name: 'text', |
||||
description: '', |
||||
// @ts-ignore
|
||||
editor: () => null, |
||||
// @ts-ignore
|
||||
override: () => null, |
||||
process: identityOverrideProcessor, |
||||
shouldApply: () => true, |
||||
}; |
||||
|
||||
const number = { |
||||
category, |
||||
id: 'number', |
||||
path: 'number', |
||||
name: 'number', |
||||
description: '', |
||||
// @ts-ignore
|
||||
editor: () => null, |
||||
// @ts-ignore
|
||||
override: () => null, |
||||
process: identityOverrideProcessor, |
||||
shouldApply: () => true, |
||||
}; |
||||
|
||||
const thresholds = { |
||||
category: ['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]; |
||||
} |
Loading…
Reference in new issue