Commit 40c83e3e by Marcus Efraimsson

dashboards: update dashboard/folder url if browser url is not the same as from backend

parent c0c3f17d
...@@ -6,13 +6,17 @@ export class FolderDashboardsCtrl { ...@@ -6,13 +6,17 @@ export class FolderDashboardsCtrl {
uid: string; uid: string;
/** @ngInject */ /** @ngInject */
constructor(private backendSrv, navModelSrv, private $routeParams) { constructor(private backendSrv, navModelSrv, private $routeParams, $location) {
if (this.$routeParams.uid) { if (this.$routeParams.uid) {
this.uid = $routeParams.uid; this.uid = $routeParams.uid;
const loader = new FolderPageLoader(this.backendSrv); const loader = new FolderPageLoader(this.backendSrv);
loader.load(this, this.uid, 'manage-folder-dashboards'); loader.load(this, this.uid, 'manage-folder-dashboards').then(folder => {
if ($location.path() !== folder.meta.url) {
$location.path(folder.meta.url).replace();
}
});
} }
} }
} }
...@@ -6,11 +6,15 @@ export class FolderPermissionsCtrl { ...@@ -6,11 +6,15 @@ export class FolderPermissionsCtrl {
uid: string; uid: string;
/** @ngInject */ /** @ngInject */
constructor(private backendSrv, navModelSrv, private $routeParams) { constructor(private backendSrv, navModelSrv, private $routeParams, $location) {
if (this.$routeParams.uid) { if (this.$routeParams.uid) {
this.uid = $routeParams.uid; this.uid = $routeParams.uid;
new FolderPageLoader(this.backendSrv).load(this, this.uid, 'manage-folder-permissions'); new FolderPageLoader(this.backendSrv).load(this, this.uid, 'manage-folder-permissions').then(folder => {
if ($location.path() !== folder.meta.url) {
$location.path(`${folder.meta.url}/permissions`).replace();
}
});
} }
} }
} }
...@@ -18,10 +18,14 @@ export class FolderSettingsCtrl { ...@@ -18,10 +18,14 @@ export class FolderSettingsCtrl {
this.uid = $routeParams.uid; this.uid = $routeParams.uid;
this.folderPageLoader = new FolderPageLoader(this.backendSrv); this.folderPageLoader = new FolderPageLoader(this.backendSrv);
this.folderPageLoader.load(this, this.uid, 'manage-folder-settings').then(result => { this.folderPageLoader.load(this, this.uid, 'manage-folder-settings').then(folder => {
this.dashboard = result.dashboard; if ($location.path() !== folder.meta.url) {
this.meta = result.meta; $location.path(`${folder.meta.url}/settings`).replace();
this.canSave = result.meta.canSave; }
this.dashboard = folder.dashboard;
this.meta = folder.meta;
this.canSave = folder.meta.canSave;
this.title = this.dashboard.title; this.title = this.dashboard.title;
}); });
} }
......
...@@ -29,6 +29,10 @@ export class LoadDashboardCtrl { ...@@ -29,6 +29,10 @@ export class LoadDashboardCtrl {
} }
dashboardLoaderSrv.loadDashboard($routeParams.type, $routeParams.slug, $routeParams.uid).then(function(result) { dashboardLoaderSrv.loadDashboard($routeParams.type, $routeParams.slug, $routeParams.uid).then(function(result) {
if ($location.path() !== result.meta.url) {
$location.path(result.meta.url).replace();
}
if ($routeParams.keepRows) { if ($routeParams.keepRows) {
result.meta.keepRows = true; result.meta.keepRows = true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment