From 8dfe4a97efb0389f8c0ea77f823670a01e8361ae Mon Sep 17 00:00:00 2001 From: Marcus Efraimsson Date: Wed, 8 Aug 2018 16:01:01 +0200 Subject: [PATCH 1/2] use uid when linking to dashboards internally in a dashboard --- public/app/features/dashlinks/module.ts | 3 +-- public/app/features/panellinks/link_srv.ts | 4 ++++ public/app/features/panellinks/module.ts | 7 ++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/public/app/features/dashlinks/module.ts b/public/app/features/dashlinks/module.ts index 380144dbcd5..6322e39f290 100644 --- a/public/app/features/dashlinks/module.ts +++ b/public/app/features/dashlinks/module.ts @@ -144,8 +144,7 @@ export class DashLinksContainerCtrl { if (dash.id !== currentDashId) { memo.push({ title: dash.title, - url: 'dashboard/' + dash.uri, - target: link.target, + url: dash.url, icon: 'fa fa-th-large', keepTime: link.keepTime, includeVars: link.includeVars, diff --git a/public/app/features/panellinks/link_srv.ts b/public/app/features/panellinks/link_srv.ts index b20294485a5..9aee17f83ed 100644 --- a/public/app/features/panellinks/link_srv.ts +++ b/public/app/features/panellinks/link_srv.ts @@ -77,6 +77,10 @@ export class LinkSrv { info.target = link.targetBlank ? '_blank' : '_self'; info.href = this.templateSrv.replace(link.url || '', scopedVars); info.title = this.templateSrv.replace(link.title || '', scopedVars); + } else if (link.url) { + info.href = link.url; + info.title = this.templateSrv.replace(link.title || '', scopedVars); + info.target = link.targetBlank ? '_blank' : ''; } else if (link.dashUri) { info.href = 'dashboard/' + link.dashUri + '?'; info.title = this.templateSrv.replace(link.title || '', scopedVars); diff --git a/public/app/features/panellinks/module.ts b/public/app/features/panellinks/module.ts index 034e99f4296..66d4bd5b37f 100644 --- a/public/app/features/panellinks/module.ts +++ b/public/app/features/panellinks/module.ts @@ -39,7 +39,12 @@ export class PanelLinksEditorCtrl { backendSrv.search({ query: link.dashboard }).then(function(hits) { var dashboard = _.find(hits, { title: link.dashboard }); if (dashboard) { - link.dashUri = dashboard.uri; + if (dashboard.url) { + link.url = dashboard.url; + } else { + // To support legacy url's + link.dashUri = dashboard.uri; + } link.title = dashboard.title; } }); From e97251fe28198055fa054e50ccd4c42d5ca6bd8e Mon Sep 17 00:00:00 2001 From: Marcus Efraimsson Date: Wed, 8 Aug 2018 16:01:35 +0200 Subject: [PATCH 2/2] skip target _self to remove full page reload --- public/app/features/dashlinks/module.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/public/app/features/dashlinks/module.ts b/public/app/features/dashlinks/module.ts index 6322e39f290..4d80f3632e6 100644 --- a/public/app/features/dashlinks/module.ts +++ b/public/app/features/dashlinks/module.ts @@ -145,6 +145,7 @@ export class DashLinksContainerCtrl { memo.push({ title: dash.title, url: dash.url, + target: link.target === '_self' ? '' : link.target, icon: 'fa fa-th-large', keepTime: link.keepTime, includeVars: link.includeVars,