Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
b11eeadb
Commit
b11eeadb
authored
May 16, 2019
by
Johannes Schill
Committed by
David
May 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: Initial url update in Explore should replace existing url history #17030 (#17061)
parent
e6001f57
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
public/app/features/explore/state/actions.ts
+8
-9
No files found.
public/app/features/explore/state/actions.ts
View file @
b11eeadb
...
...
@@ -119,7 +119,7 @@ export function addQueryRow(exploreId: ExploreId, index: number): ThunkResult<vo
/**
* Loads a new datasource identified by the given name.
*/
export
function
changeDatasource
(
exploreId
:
ExploreId
,
datasource
:
string
):
ThunkResult
<
void
>
{
export
function
changeDatasource
(
exploreId
:
ExploreId
,
datasource
:
string
,
replaceUrl
=
false
):
ThunkResult
<
void
>
{
return
async
(
dispatch
,
getState
)
=>
{
let
newDataSourceInstance
:
DataSourceApi
=
null
;
...
...
@@ -137,8 +137,7 @@ export function changeDatasource(exploreId: ExploreId, datasource: string): Thun
dispatch
(
updateDatasourceInstanceAction
({
exploreId
,
datasourceInstance
:
newDataSourceInstance
}));
await
dispatch
(
loadDatasource
(
exploreId
,
newDataSourceInstance
));
dispatch
(
runQueries
(
exploreId
));
dispatch
(
runQueries
(
exploreId
,
false
,
replaceUrl
));
};
}
...
...
@@ -244,7 +243,7 @@ export function loadExploreDatasourcesAndSetDatasource(
dispatch
(
loadExploreDatasources
({
exploreId
,
exploreDatasources
}));
if
(
exploreDatasources
.
length
>=
1
)
{
dispatch
(
changeDatasource
(
exploreId
,
datasourceName
));
dispatch
(
changeDatasource
(
exploreId
,
datasourceName
,
true
));
}
else
{
dispatch
(
loadDatasourceMissingAction
({
exploreId
}));
}
...
...
@@ -513,7 +512,7 @@ export function processQueryResults(
/**
* Main action to run queries and dispatches sub-actions based on which result viewers are active
*/
export
function
runQueries
(
exploreId
:
ExploreId
,
ignoreUIState
=
false
):
ThunkResult
<
void
>
{
export
function
runQueries
(
exploreId
:
ExploreId
,
ignoreUIState
=
false
,
replaceUrl
=
false
):
ThunkResult
<
void
>
{
return
(
dispatch
,
getState
)
=>
{
const
{
datasourceInstance
,
...
...
@@ -533,7 +532,7 @@ export function runQueries(exploreId: ExploreId, ignoreUIState = false): ThunkRe
if
(
!
hasNonEmptyQuery
(
queries
))
{
dispatch
(
clearQueriesAction
({
exploreId
}));
dispatch
(
stateSave
(
));
// Remember to saves
to state and update location
dispatch
(
stateSave
(
replaceUrl
));
// Remember to save
to state and update location
return
;
}
...
...
@@ -567,7 +566,7 @@ export function runQueries(exploreId: ExploreId, ignoreUIState = false): ThunkRe
dispatch
(
runQueriesForType
(
exploreId
,
'Logs'
,
{
interval
,
format
:
'logs'
}));
}
dispatch
(
stateSave
());
dispatch
(
stateSave
(
replaceUrl
));
};
}
...
...
@@ -691,7 +690,7 @@ const toRawTimeRange = (range: TimeRange): RawTimeRange => {
* Saves Explore state to URL using the `left` and `right` parameters.
* If split view is not active, `right` will not be set.
*/
export
function
stateSave
():
ThunkResult
<
void
>
{
export
function
stateSave
(
replaceUrl
=
false
):
ThunkResult
<
void
>
{
return
(
dispatch
,
getState
)
=>
{
const
{
left
,
right
,
split
}
=
getState
().
explore
;
const
urlStates
:
{
[
index
:
string
]:
string
}
=
{};
...
...
@@ -723,7 +722,7 @@ export function stateSave(): ThunkResult<void> {
urlStates
.
right
=
serializeStateToUrlParam
(
rightUrlState
,
true
);
}
dispatch
(
updateLocation
({
query
:
urlStates
}));
dispatch
(
updateLocation
({
query
:
urlStates
,
replace
:
replaceUrl
}));
};
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment