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
79bd7f40
Commit
79bd7f40
authored
Jan 21, 2019
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed data source selection in explore
parent
96d28703
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
11 deletions
+13
-11
public/app/features/explore/state/actionTypes.ts
+1
-1
public/app/features/explore/state/actions.ts
+9
-8
public/app/features/explore/state/reducers.ts
+2
-1
public/app/types/explore.ts
+1
-1
No files found.
public/app/features/explore/state/actionTypes.ts
View file @
79bd7f40
...
...
@@ -123,7 +123,7 @@ export interface LoadDatasourcePendingAction {
type
:
ActionTypes
.
LoadDatasourcePending
;
payload
:
{
exploreId
:
ExploreId
;
datasource
Id
:
number
;
datasource
Name
:
string
;
};
}
...
...
public/app/features/explore/state/actions.ts
View file @
79bd7f40
...
...
@@ -33,7 +33,7 @@ import {
}
from
'app/types/explore'
;
import
{
Emitter
}
from
'app/core/core'
;
import
{
RawTimeRange
,
TimeRange
}
from
'@grafana/ui'
;
import
{
RawTimeRange
,
TimeRange
,
DataSourceApi
}
from
'@grafana/ui'
;
import
{
Action
as
ThunkableAction
,
ActionTypes
,
...
...
@@ -216,11 +216,11 @@ export const loadDatasourceMissing = (exploreId: ExploreId): LoadDatasourceMissi
/**
* Start the async process of loading a datasource to display a loading indicator
*/
export
const
loadDatasourcePending
=
(
exploreId
:
ExploreId
,
datasource
Id
:
number
):
LoadDatasourcePendingAction
=>
({
export
const
loadDatasourcePending
=
(
exploreId
:
ExploreId
,
datasource
Name
:
string
):
LoadDatasourcePendingAction
=>
({
type
:
ActionTypes
.
LoadDatasourcePending
,
payload
:
{
exploreId
,
datasource
Id
,
datasource
Name
,
},
});
...
...
@@ -266,12 +266,12 @@ export const loadDatasourceSuccess = (
/**
* Main action to asynchronously load a datasource. Dispatches lots of smaller actions for feedback.
*/
export
function
loadDatasource
(
exploreId
:
ExploreId
,
instance
:
any
):
ThunkResult
<
void
>
{
export
function
loadDatasource
(
exploreId
:
ExploreId
,
instance
:
DataSourceApi
):
ThunkResult
<
void
>
{
return
async
(
dispatch
,
getState
)
=>
{
const
datasource
Id
=
instance
.
meta
.
id
;
const
datasource
Name
=
instance
.
name
;
// Keep ID to track selection
dispatch
(
loadDatasourcePending
(
exploreId
,
datasource
Id
));
dispatch
(
loadDatasourcePending
(
exploreId
,
datasource
Name
));
let
datasourceError
=
null
;
try
{
...
...
@@ -280,12 +280,13 @@ export function loadDatasource(exploreId: ExploreId, instance: any): ThunkResult
}
catch
(
error
)
{
datasourceError
=
(
error
&&
error
.
statusText
)
||
'Network error'
;
}
if
(
datasourceError
)
{
dispatch
(
loadDatasourceFailure
(
exploreId
,
datasourceError
));
return
;
}
if
(
datasource
Id
!==
getState
().
explore
[
exploreId
].
requestedDatasourceId
)
{
if
(
datasource
Name
!==
getState
().
explore
[
exploreId
].
requestedDatasourceName
)
{
// User already changed datasource again, discard results
return
;
}
...
...
@@ -311,7 +312,7 @@ export function loadDatasource(exploreId: ExploreId, instance: any): ThunkResult
}
}
if
(
datasource
Id
!==
getState
().
explore
[
exploreId
].
requestedDatasourceId
)
{
if
(
datasource
Name
!==
getState
().
explore
[
exploreId
].
requestedDatasourceName
)
{
// User already changed datasource again, discard results
return
;
}
...
...
public/app/features/explore/state/reducers.ts
View file @
79bd7f40
...
...
@@ -185,7 +185,7 @@ const itemReducer = (state, action: Action): ExploreItemState => {
}
case
ActionTypes
.
LoadDatasourcePending
:
{
return
{
...
state
,
datasourceLoading
:
true
,
requestedDatasource
Id
:
action
.
payload
.
datasourceId
};
return
{
...
state
,
datasourceLoading
:
true
,
requestedDatasource
Name
:
action
.
payload
.
datasourceName
};
}
case
ActionTypes
.
LoadDatasourceSuccess
:
{
...
...
@@ -217,6 +217,7 @@ const itemReducer = (state, action: Action): ExploreItemState => {
supportsTable
,
datasourceLoading
:
false
,
datasourceMissing
:
false
,
datasourceError
:
null
,
logsHighlighterExpressions
:
undefined
,
modifiedQueries
:
initialQueries
.
slice
(),
queryTransactions
:
[],
...
...
public/app/types/explore.ts
View file @
79bd7f40
...
...
@@ -186,7 +186,7 @@ export interface ExploreItemState {
* Allows the selection to be discarded if something went wrong during the asynchronous
* loading of the datasource.
*/
requestedDatasource
Id
?:
number
;
requestedDatasource
Name
?:
string
;
/**
* Time range for this Explore. Managed by the time picker and used by all query runs.
*/
...
...
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