mirror of
https://github.com/grafana/grafana.git
synced 2024-11-22 08:56:43 -06:00
TextPanel: Removes text mode (#25589)
This commit is contained in:
parent
7a27dfdffa
commit
258092ec7f
@ -14,7 +14,6 @@ export const plugin = new PanelPlugin<TextOptions>(TextPanel)
|
||||
settings: {
|
||||
options: [
|
||||
{ value: 'markdown', label: 'Markdown' },
|
||||
{ value: 'text', label: 'Text' },
|
||||
{ value: 'html', label: 'HTML' },
|
||||
],
|
||||
},
|
||||
|
@ -6,6 +6,7 @@
|
||||
"skipDataQuery": true,
|
||||
|
||||
"info": {
|
||||
"version": "7.1.0",
|
||||
"author": {
|
||||
"name": "Grafana Labs",
|
||||
"url": "https://grafana.com"
|
||||
|
@ -40,4 +40,28 @@ describe('textPanelMigrationHandler', () => {
|
||||
expect(result.mode).toEqual('markdown');
|
||||
});
|
||||
});
|
||||
|
||||
describe('when invoked and previous version was using text mode', () => {
|
||||
it('then should switch to markdown', () => {
|
||||
const panel: PanelModel<TextOptions> = {
|
||||
id: 1,
|
||||
fieldConfig: ({} as unknown) as FieldConfigSource,
|
||||
options: {
|
||||
content: `# Title
|
||||
|
||||
For markdown syntax help: [commonmark.org/help](https://commonmark.org/help/)
|
||||
`,
|
||||
mode: 'text',
|
||||
},
|
||||
};
|
||||
|
||||
const result = textPanelMigrationHandler(panel);
|
||||
|
||||
expect(result.content).toEqual(`# Title
|
||||
|
||||
For markdown syntax help: [commonmark.org/help](https://commonmark.org/help/)
|
||||
`);
|
||||
expect(result.mode).toEqual('markdown');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -11,5 +11,9 @@ export const textPanelMigrationHandler = (panel: PanelModel<TextOptions>): Parti
|
||||
return { content, mode };
|
||||
}
|
||||
|
||||
return panel.options as TextOptions;
|
||||
if (panel.options.mode === 'text') {
|
||||
return { content: panel.options.content, mode: 'markdown' };
|
||||
}
|
||||
|
||||
return panel.options;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user