Merge pull request #12631 from grafana/davkal/explore-url-encoding

Use url params for explore state
This commit is contained in:
David 2018-07-17 16:49:13 +02:00 committed by GitHub
commit 21e5d61de6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 6 deletions

View File

@ -73,8 +73,7 @@ func (hs *HTTPServer) registerRoutes() {
r.Get("/dashboards/", reqSignedIn, Index)
r.Get("/dashboards/*", reqSignedIn, Index)
r.Get("/explore/", reqEditorRole, Index)
r.Get("/explore/*", reqEditorRole, Index)
r.Get("/explore", reqEditorRole, Index)
r.Get("/playlists/", reqSignedIn, Index)
r.Get("/playlists/*", reqSignedIn, Index)

View File

@ -72,7 +72,7 @@ export class Explore extends React.Component<any, IExploreState> {
constructor(props) {
super(props);
const { datasource, queries, range } = parseInitialState(props.routeParams.initial);
const { datasource, queries, range } = parseInitialState(props.routeParams.state);
this.state = {
datasource: null,
datasourceError: null,

View File

@ -191,7 +191,7 @@ export class KeybindingSrv {
range,
};
const exploreState = encodePathComponent(JSON.stringify(state));
this.$location.url(`/explore/${exploreState}`);
this.$location.url(`/explore?state=${exploreState}`);
}
}
});

View File

@ -332,7 +332,7 @@ class MetricsPanelCtrl extends PanelCtrl {
range,
};
const exploreState = encodePathComponent(JSON.stringify(state));
this.$location.url(`/explore/${exploreState}`);
this.$location.url(`/explore?state=${exploreState}`);
}
addQuery(target) {

View File

@ -112,7 +112,7 @@ export function setupAngularRoutes($routeProvider, $locationProvider) {
controller: 'FolderDashboardsCtrl',
controllerAs: 'ctrl',
})
.when('/explore/:initial?', {
.when('/explore', {
template: '<react-container />',
resolve: {
roles: () => ['Editor', 'Admin'],