Commit 541b0a0c by Torkel Ödegaard

fix: fixed bug with redirect after new dashboard saved, related to buggy…

fix: fixed bug with redirect after new dashboard saved, related to buggy angularjs location path/url and base href, fixes #10817
parent 17cbd9d6
import coreModule from 'app/core/core_module';
import { DashboardModel } from './dashboard_model';
import locationUtil from 'app/core/utils/location_util';
export class DashboardSrv {
dash: any;
......@@ -74,7 +75,7 @@ export class DashboardSrv {
this.dash.version = data.version;
if (data.url !== this.$location.path()) {
this.$location.url(data.url);
this.$location.url(locationUtil.stripBaseFromUrl(data.url)).replace();
}
this.$rootScope.appEvent('dashboard-saved', this.dash);
......
......@@ -93,7 +93,6 @@ export class AddPanelPanel extends React.Component<AddPanelPanelProps, AddPanelP
}
renderPanelItem(panel, index) {
console.log('render panel', index);
return (
<div key={index} className="add-panel__item" onClick={() => this.onAddPanel(panel)} title={panel.name}>
<img className="add-panel__item-img" src={panel.info.logos.small} />
......
......@@ -4,6 +4,7 @@ import _ from 'lodash';
import angular from 'angular';
import moment from 'moment';
import locationUtil from 'app/core/utils/location_util';
import { DashboardModel } from '../dashboard_model';
import { HistoryListOpts, RevisionsModel, CalculateDiffOptions, HistorySrv } from './history_srv';
......@@ -185,7 +186,7 @@ export class HistoryListCtrl {
return this.historySrv
.restoreDashboard(this.dashboard, version)
.then(response => {
this.$location.path('dashboard/db/' + response.slug);
this.$location.url(locationUtil.stripBaseFromUrl(response.url)).replace();
this.$route.reload();
this.$rootScope.appEvent('alert-success', ['Dashboard restored', 'Restored from version ' + version]);
})
......
......@@ -23,8 +23,7 @@ export class LoadDashboardCtrl {
if (!($routeParams.type === 'script' || $routeParams.type === 'snapshot') && !$routeParams.uid) {
backendSrv.get(`/api/dashboards/db/${$routeParams.slug}`).then(res => {
if (res) {
const url = locationUtil.stripBaseFromUrl(res.meta.url);
$location.path(url).replace();
$location.path(locationUtil.stripBaseFromUrl(res.meta.url)).replace();
}
});
return;
......
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