mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Dashboards: Save tags on dashboard creation (#71394)
Dashboards: save tags on dashboard creation
This commit is contained in:
parent
0083b2e346
commit
290deca2eb
@ -21,6 +21,7 @@ const prepareDashboardMock = (panel: any) => {
|
||||
const json = {
|
||||
title: 'name',
|
||||
panels: [panel],
|
||||
tags: ['tag1', 'tag2'],
|
||||
};
|
||||
|
||||
return {
|
||||
@ -67,6 +68,7 @@ describe('SaveDashboardAsForm', () => {
|
||||
expect(savedDashboardModel.id).toBe(null);
|
||||
expect(savedDashboardModel.title).toBe('name');
|
||||
expect(savedDashboardModel.editable).toBe(true);
|
||||
expect(savedDashboardModel.tags).toEqual(['tag1', 'tag2']);
|
||||
});
|
||||
|
||||
it("appends 'Copy' to the name when the dashboard isnt new", async () => {
|
||||
@ -80,6 +82,8 @@ describe('SaveDashboardAsForm', () => {
|
||||
expect(spy).toBeCalledTimes(1);
|
||||
const savedDashboardModel = spy.mock.calls[0][0];
|
||||
expect(savedDashboardModel.title).toBe('name Copy');
|
||||
// when copying a dashboard, the tags should be empty
|
||||
expect(savedDashboardModel.tags).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -80,7 +80,7 @@ export const SaveDashboardAsForm = ({
|
||||
|
||||
const clone = getSaveAsDashboardClone(dashboard);
|
||||
clone.title = data.title;
|
||||
if (!data.copyTags) {
|
||||
if (!isNew && !data.copyTags) {
|
||||
clone.tags = [];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user