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
53eb856d
Unverified
Commit
53eb856d
authored
Jul 09, 2020
by
Andrej Ocenas
Committed by
GitHub
Jul 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explore: Run query on splitOpen action (#26161)
parent
0428f271
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
5 deletions
+12
-5
public/app/features/explore/ExploreToolbar.tsx
+1
-1
public/app/features/explore/RichHistory/RichHistoryCard.tsx
+1
-1
public/app/features/explore/state/actions.ts
+10
-3
No files found.
public/app/features/explore/ExploreToolbar.tsx
View file @
53eb856d
...
@@ -91,7 +91,7 @@ type Props = StateProps & DispatchProps & OwnProps;
...
@@ -91,7 +91,7 @@ type Props = StateProps & DispatchProps & OwnProps;
export
class
UnConnectedExploreToolbar
extends
PureComponent
<
Props
>
{
export
class
UnConnectedExploreToolbar
extends
PureComponent
<
Props
>
{
onChangeDatasource
=
async
(
option
:
{
value
:
any
})
=>
{
onChangeDatasource
=
async
(
option
:
{
value
:
any
})
=>
{
this
.
props
.
changeDatasource
(
this
.
props
.
exploreId
,
option
.
value
);
this
.
props
.
changeDatasource
(
this
.
props
.
exploreId
,
option
.
value
,
{
importQueries
:
true
}
);
};
};
onClearAll
=
()
=>
{
onClearAll
=
()
=>
{
...
...
public/app/features/explore/RichHistory/RichHistoryCard.tsx
View file @
53eb856d
...
@@ -163,7 +163,7 @@ export function RichHistoryCard(props: Props) {
...
@@ -163,7 +163,7 @@ export function RichHistoryCard(props: Props) {
const
onRunQuery
=
async
()
=>
{
const
onRunQuery
=
async
()
=>
{
const
queriesToRun
=
query
.
queries
;
const
queriesToRun
=
query
.
queries
;
if
(
query
.
datasourceName
!==
datasourceInstance
?.
name
)
{
if
(
query
.
datasourceName
!==
datasourceInstance
?.
name
)
{
await
changeDatasource
(
exploreId
,
query
.
datasourceName
);
await
changeDatasource
(
exploreId
,
query
.
datasourceName
,
{
importQueries
:
true
}
);
setQueries
(
exploreId
,
queriesToRun
);
setQueries
(
exploreId
,
queriesToRun
);
}
else
{
}
else
{
setQueries
(
exploreId
,
queriesToRun
);
setQueries
(
exploreId
,
queriesToRun
);
...
...
public/app/features/explore/state/actions.ts
View file @
53eb856d
...
@@ -122,7 +122,11 @@ export function addQueryRow(exploreId: ExploreId, index: number): ThunkResult<vo
...
@@ -122,7 +122,11 @@ export function addQueryRow(exploreId: ExploreId, index: number): ThunkResult<vo
/**
/**
* Loads a new datasource identified by the given name.
* Loads a new datasource identified by the given name.
*/
*/
export
function
changeDatasource
(
exploreId
:
ExploreId
,
datasourceName
:
string
):
ThunkResult
<
void
>
{
export
function
changeDatasource
(
exploreId
:
ExploreId
,
datasourceName
:
string
,
options
?:
{
importQueries
:
boolean
}
):
ThunkResult
<
void
>
{
return
async
(
dispatch
,
getState
)
=>
{
return
async
(
dispatch
,
getState
)
=>
{
let
newDataSourceInstance
:
DataSourceApi
;
let
newDataSourceInstance
:
DataSourceApi
;
...
@@ -150,7 +154,9 @@ export function changeDatasource(exploreId: ExploreId, datasourceName: string):
...
@@ -150,7 +154,9 @@ export function changeDatasource(exploreId: ExploreId, datasourceName: string):
})
})
);
);
await
dispatch
(
importQueries
(
exploreId
,
queries
,
currentDataSourceInstance
,
newDataSourceInstance
));
if
(
options
?.
importQueries
)
{
await
dispatch
(
importQueries
(
exploreId
,
queries
,
currentDataSourceInstance
,
newDataSourceInstance
));
}
if
(
getState
().
explore
[
exploreId
].
isLive
)
{
if
(
getState
().
explore
[
exploreId
].
isLive
)
{
dispatch
(
changeRefreshInterval
(
exploreId
,
RefreshPicker
.
offOption
.
value
));
dispatch
(
changeRefreshInterval
(
exploreId
,
RefreshPicker
.
offOption
.
value
));
...
@@ -268,7 +274,7 @@ export function loadExploreDatasourcesAndSetDatasource(
...
@@ -268,7 +274,7 @@ export function loadExploreDatasourcesAndSetDatasource(
const
exploreDatasources
=
getExploreDatasources
();
const
exploreDatasources
=
getExploreDatasources
();
if
(
exploreDatasources
.
length
>=
1
)
{
if
(
exploreDatasources
.
length
>=
1
)
{
await
dispatch
(
changeDatasource
(
exploreId
,
datasourceName
));
await
dispatch
(
changeDatasource
(
exploreId
,
datasourceName
,
{
importQueries
:
true
}
));
dispatch
(
runQueries
(
exploreId
));
dispatch
(
runQueries
(
exploreId
));
}
else
{
}
else
{
dispatch
(
loadDatasourceMissingAction
({
exploreId
}));
dispatch
(
loadDatasourceMissingAction
({
exploreId
}));
...
@@ -729,6 +735,7 @@ export function splitOpen<T extends DataQuery = any>(options?: { datasourceUid:
...
@@ -729,6 +735,7 @@ export function splitOpen<T extends DataQuery = any>(options?: { datasourceUid:
const dataSourceSettings = getDatasourceSrv().getDataSourceSettingsByUid(options.datasourceUid);
const dataSourceSettings = getDatasourceSrv().getDataSourceSettingsByUid(options.datasourceUid);
await dispatch(changeDatasource(ExploreId.right, dataSourceSettings.name));
await dispatch(changeDatasource(ExploreId.right, dataSourceSettings.name));
await dispatch(setQueriesAction({ exploreId: ExploreId.right, queries }));
await dispatch(setQueriesAction({ exploreId: ExploreId.right, queries }));
await dispatch(runQueries(ExploreId.right));
} else {
} else {
rightState.queries = leftState.queries.slice();
rightState.queries = leftState.queries.slice();
rightState.urlState = urlState;
rightState.urlState = urlState;
...
...
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