Переглянути джерело

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

Torkel Ödegaard 6 роки тому
батько
коміт
65a6eda93b

+ 4 - 0
public/app/features/dashboard/state/DashboardMigrator.test.ts

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

+ 5 - 0
public/app/features/dashboard/state/DashboardMigrator.ts

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