DashboardMigrator: Fixed issue migrating incomplete panel link models (#18786)

This commit is contained in:
Torkel Ödegaard 2019-08-30 15:23:38 +02:00 committed by GitHub
parent 8e9cb5c81a
commit 65a6eda93b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -415,6 +415,10 @@ describe('DashboardModel', () => {
dashUri: '', dashUri: '',
title: 'test', title: 'test',
}, },
{
type: 'dashboard',
keepTime: true,
},
], ],
}, },
], ],

View File

@ -643,6 +643,11 @@ function upgradePanelLink(link: any): DataLink {
url = `/dashboard/${link.dashUri}`; url = `/dashboard/${link.dashUri}`;
} }
// some models are incomplete and have no dashboard or dashUri
if (!url) {
url = '/';
}
if (link.keepTime) { if (link.keepTime) {
url = appendQueryToUrl(url, `$${DataLinkBuiltInVars.keepTime}`); url = appendQueryToUrl(url, `$${DataLinkBuiltInVars.keepTime}`);
} }