mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Stat: Add ability to remove default single-color background gradient (#64353)
* baldm0mma/feature/solidOption/ update cue and ts types * baldm0mma/feature/solidOption/ update data structures * baldm0mma/feature/solidOption/ vizrepeater investigation * baldm0mma/feature/solidOption/ add buildGradientBackground * baldm0mma/feature/solidOption/ remove conlogs from fieldDisplay.ts * baldm0mma/feature/solidOption/ rem destruct in fielddisplay.ts * baldm0mma/feature/solidOption/ rem conlogs from bivaluelayout.tsx * baldm0mma/feature/solidOption/ rem conlogs in visrepeater * baldm0mma/feature/solidOption/ rem conlogs from statpanel.tsx * baldm0mma/feature/solidOption/ add annotations in BigValue.tsx * baldm0mma/feature/solidOption/ update cue * baldm0mma/feature/solidOption/ remove unused anno * baldm0mma/feature/solidOption/ update with toggle conditinal * Update module.tsx update anno * baldm0mma/feature/solidOption/ update annos * baldm0mma/feature/solidOption/ undo change * baldm0mma/featurew/solidOption/ add anno for boolean toggle in stat module * baldm0mma/featurew/solidOption/ update anno in BigValue.tsx for hasGradient * baldm0mma/featurew/solidOption/ updart default logic in bigValueLayout.tsx
This commit is contained in:
@@ -37,6 +37,7 @@ export class StatPanel extends PureComponent<PanelProps<PanelOptions>> {
|
||||
count={count}
|
||||
sparkline={sparkline}
|
||||
colorMode={options.colorMode}
|
||||
hasGradient={options.hasGradient}
|
||||
graphMode={options.graphMode}
|
||||
justifyMode={options.justifyMode}
|
||||
textMode={this.getTextMode()}
|
||||
|
||||
@@ -20,7 +20,7 @@ export const plugin = new PanelPlugin<PanelOptions>(StatPanel)
|
||||
builder.addSelect({
|
||||
path: 'textMode',
|
||||
name: 'Text mode',
|
||||
description: 'Control if name and value is displayed or just name',
|
||||
description: 'Control the display of the name and value',
|
||||
category: mainCategory,
|
||||
settings: {
|
||||
options: [
|
||||
@@ -38,7 +38,7 @@ export const plugin = new PanelPlugin<PanelOptions>(StatPanel)
|
||||
.addRadio({
|
||||
path: 'colorMode',
|
||||
name: 'Color mode',
|
||||
defaultValue: BigValueColorMode.Value,
|
||||
defaultValue: defaultPanelOptions.colorMode,
|
||||
category: mainCategory,
|
||||
settings: {
|
||||
options: [
|
||||
@@ -48,6 +48,15 @@ export const plugin = new PanelPlugin<PanelOptions>(StatPanel)
|
||||
],
|
||||
},
|
||||
})
|
||||
// Boolean toggle for removing the gradient panel background
|
||||
.addBooleanSwitch({
|
||||
path: 'hasGradient',
|
||||
name: 'Background gradient',
|
||||
defaultValue: defaultPanelOptions.hasGradient,
|
||||
category: mainCategory,
|
||||
// This toggle really only applies when the BigValueColorMode === `background`
|
||||
showIf: (panelOptions) => panelOptions.colorMode === BigValueColorMode.Background,
|
||||
})
|
||||
.addRadio({
|
||||
path: 'graphMode',
|
||||
name: 'Graph mode',
|
||||
|
||||
@@ -28,10 +28,11 @@ composableKinds: PanelCfg: {
|
||||
{
|
||||
PanelOptions: {
|
||||
common.SingleStatBaseOptions
|
||||
graphMode: common.BigValueGraphMode | *"area"
|
||||
colorMode: common.BigValueColorMode | *"value"
|
||||
justifyMode: common.BigValueJustifyMode | *"auto"
|
||||
textMode: common.BigValueTextMode | *"auto"
|
||||
graphMode: common.BigValueGraphMode | *"area"
|
||||
colorMode: common.BigValueColorMode | *"value"
|
||||
hasGradient?: bool | *true
|
||||
justifyMode: common.BigValueJustifyMode | *"auto"
|
||||
textMode: common.BigValueTextMode | *"auto"
|
||||
} @cuetsy(kind="interface")
|
||||
},
|
||||
]
|
||||
|
||||
@@ -15,6 +15,7 @@ export const PanelCfgModelVersion = Object.freeze([0, 0]);
|
||||
export interface PanelOptions extends common.SingleStatBaseOptions {
|
||||
colorMode: common.BigValueColorMode;
|
||||
graphMode: common.BigValueGraphMode;
|
||||
hasGradient?: boolean;
|
||||
justifyMode: common.BigValueJustifyMode;
|
||||
textMode: common.BigValueTextMode;
|
||||
}
|
||||
@@ -22,6 +23,7 @@ export interface PanelOptions extends common.SingleStatBaseOptions {
|
||||
export const defaultPanelOptions: Partial<PanelOptions> = {
|
||||
colorMode: common.BigValueColorMode.Value,
|
||||
graphMode: common.BigValueGraphMode.Area,
|
||||
hasGradient: true,
|
||||
justifyMode: common.BigValueJustifyMode.Auto,
|
||||
textMode: common.BigValueTextMode.Auto,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user