fix for dashboard/folder url's when having a sub path in root_url config

This commit is contained in:
Marcus Efraimsson
2018-02-01 16:30:48 +01:00
parent d8d82c1769
commit 3db328f516
8 changed files with 53 additions and 46 deletions

View File

@@ -1,8 +1,9 @@
import coreModule from 'app/core/core_module';
import locationUtil from 'app/core/utils/location_util';
export class LoadDashboardCtrl {
/** @ngInject */
constructor($scope, $routeParams, dashboardLoaderSrv, backendSrv, $location) {
constructor($scope, $routeParams, dashboardLoaderSrv, backendSrv, $location, $browser) {
$scope.appEvent('dashboard-fetch-start');
if (!$routeParams.uid && !$routeParams.slug) {
@@ -22,15 +23,18 @@ export class LoadDashboardCtrl {
if (!($routeParams.type === 'script' || $routeParams.type === 'snapshot') && !$routeParams.uid) {
backendSrv.get(`/api/dashboards/db/${$routeParams.slug}`).then(res => {
if (res) {
$location.path(res.meta.url).replace();
const url = locationUtil.stripBaseFromUrl(res.meta.url);
$location.path(url).replace();
}
});
return;
}
dashboardLoaderSrv.loadDashboard($routeParams.type, $routeParams.slug, $routeParams.uid).then(function(result) {
if ($location.path() !== result.meta.url) {
$location.path(result.meta.url).replace();
const url = locationUtil.stripBaseFromUrl(result.meta.url);
if (url !== $location.path()) {
$location.path(url).replace();
}
if ($routeParams.keepRows) {