DebugSnapshot: Change to use exisiting localstorage prop and open in new tab (#54877)

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
Torkel Ödegaard
2022-09-08 20:20:56 +02:00
committed by GitHub
parent 085db83cd9
commit f5fd9029ea
2 changed files with 23 additions and 29 deletions

View File

@@ -254,15 +254,6 @@ export function initDashboard(args: InitDashboardArgs): ThunkResult<void> {
};
}
/**
* Global access to support importing a dashboard from elsewhere in the application.
* Alternativly this could be in redux, but given the size (potentially LARGE) and how
* infrequently it will be used, a simple global object seems reasonable.
*/
export const pendingNewDashboard = {
dashboard: undefined,
};
export function getNewDashboardModelData(urlFolderId?: string, panelType?: string): any {
const data = {
meta: {
@@ -272,7 +263,7 @@ export function getNewDashboardModelData(urlFolderId?: string, panelType?: strin
isNew: true,
folderId: 0,
},
dashboard: pendingNewDashboard.dashboard ?? {
dashboard: {
title: 'New dashboard',
panels: [
{
@@ -283,7 +274,6 @@ export function getNewDashboardModelData(urlFolderId?: string, panelType?: strin
],
},
};
pendingNewDashboard.dashboard = undefined;
if (urlFolderId) {
data.meta.folderId = parseInt(urlFolderId, 10);