mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
TextPanel: Removes text mode (#25589)
This commit is contained in:
@@ -14,7 +14,6 @@ export const plugin = new PanelPlugin<TextOptions>(TextPanel)
|
|||||||
settings: {
|
settings: {
|
||||||
options: [
|
options: [
|
||||||
{ value: 'markdown', label: 'Markdown' },
|
{ value: 'markdown', label: 'Markdown' },
|
||||||
{ value: 'text', label: 'Text' },
|
|
||||||
{ value: 'html', label: 'HTML' },
|
{ value: 'html', label: 'HTML' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
"skipDataQuery": true,
|
"skipDataQuery": true,
|
||||||
|
|
||||||
"info": {
|
"info": {
|
||||||
|
"version": "7.1.0",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Grafana Labs",
|
"name": "Grafana Labs",
|
||||||
"url": "https://grafana.com"
|
"url": "https://grafana.com"
|
||||||
|
@@ -40,4 +40,28 @@ describe('textPanelMigrationHandler', () => {
|
|||||||
expect(result.mode).toEqual('markdown');
|
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 { content, mode };
|
||||||
}
|
}
|
||||||
|
|
||||||
return panel.options as TextOptions;
|
if (panel.options.mode === 'text') {
|
||||||
|
return { content: panel.options.content, mode: 'markdown' };
|
||||||
|
}
|
||||||
|
|
||||||
|
return panel.options;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user