mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
* StatPanel: Option showing name instead of value and more * rename option to textMode * Move the logic of only showing name if more than one value to gauge and bar gauge panels * Got tooltip working * Updated devenv test dashboard * Added docs for text mode * Added migration logic * Update docs/sources/panels/visualizations/stat-panel.md Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com> * Update docs/sources/panels/visualizations/stat-panel.md Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com> * Update docs/sources/panels/visualizations/stat-panel.md Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com> * Update docs/sources/panels/visualizations/stat-panel.md Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com> * Update docs/sources/panels/visualizations/stat-panel.md Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com> * Update docs/sources/panels/visualizations/stat-panel.md Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com> * Update docs/sources/panels/visualizations/stat-panel.md Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com> * docs fix * Fixed ts issue * review changes Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
65 lines
1.7 KiB
TypeScript
65 lines
1.7 KiB
TypeScript
import { PanelModel } from '@grafana/data';
|
|
import { statPanelChangedHandler } from './StatMigrations';
|
|
import { BigValueGraphMode, BigValueColorMode } from '@grafana/ui';
|
|
import { BigValueTextMode } from '@grafana/ui/src/components/BigValue/BigValue';
|
|
|
|
describe('Stat Panel Migrations', () => {
|
|
it('change from angular singlestat sparkline disabled', () => {
|
|
const old: any = {
|
|
angular: {
|
|
format: 'ms',
|
|
decimals: 7,
|
|
sparkline: {
|
|
show: false,
|
|
},
|
|
},
|
|
};
|
|
|
|
const panel = {} as PanelModel;
|
|
const options = statPanelChangedHandler(panel, 'singlestat', old);
|
|
expect(options.graphMode).toBe(BigValueGraphMode.None);
|
|
});
|
|
|
|
it('change from angular singlestat sparkline enabled', () => {
|
|
const old: any = {
|
|
angular: {
|
|
format: 'ms',
|
|
decimals: 7,
|
|
sparkline: {
|
|
show: true,
|
|
},
|
|
},
|
|
};
|
|
|
|
const panel = {} as PanelModel;
|
|
const options = statPanelChangedHandler(panel, 'singlestat', old);
|
|
expect(options.graphMode).toBe(BigValueGraphMode.Area);
|
|
});
|
|
|
|
it('change from angular singlestat color background', () => {
|
|
const old: any = {
|
|
angular: {
|
|
format: 'ms',
|
|
decimals: 7,
|
|
colorBackground: true,
|
|
},
|
|
};
|
|
|
|
const panel = {} as PanelModel;
|
|
const options = statPanelChangedHandler(panel, 'singlestat', old);
|
|
expect(options.colorMode).toBe(BigValueColorMode.Background);
|
|
});
|
|
|
|
it('change from angular singlestat with name stat', () => {
|
|
const old: any = {
|
|
angular: {
|
|
valueName: 'name',
|
|
},
|
|
};
|
|
|
|
const panel = {} as PanelModel;
|
|
const options = statPanelChangedHandler(panel, 'singlestat', old);
|
|
expect(options.textMode).toBe(BigValueTextMode.Name);
|
|
});
|
|
});
|