fix(Dashboard): Copy dashboard with duplicating charts 500 error (#17707)

* Fix copy dashboard with charts

* Fix Cypress test
This commit is contained in:
Geido 2021-12-10 01:25:01 +02:00 committed by GitHub
parent bdc4e7a322
commit dad8c20af7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -74,7 +74,9 @@ describe('Dashboard save action', () => {
.trigger('mouseenter')
.click();
cy.get('[data-test="grid-container"]').find('.treemap').should('not.exist');
cy.get('[data-test="grid-container"]')
.find('.box_plot')
.should('not.exist');
cy.intercept('PUT', '/api/v1/dashboard/**').as('putDashboardRequest');
cy.get('[data-test="dashboard-header"]')
@ -88,9 +90,9 @@ describe('Dashboard save action', () => {
.find('[aria-label="edit-alt"]')
.click();
// deleted treemap should still not exist
// deleted boxplot should still not exist
cy.get('[data-test="grid-container"]')
.find('.treemap', { timeout: 20000 })
.find('.box_plot', { timeout: 20000 })
.should('not.exist');
});

View File

@ -347,7 +347,7 @@ export function saveDashboardRequest(data, id, saveType) {
.catch(response => onError(response));
}
// changing the data as the endpoint requires
const copyData = cleanedData;
const copyData = { ...cleanedData };
if (copyData.metadata) {
delete copyData.metadata;
}