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
390090da
Commit
390090da
authored
Jul 13, 2018
by
David Kaltschmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set datasource in deep links to Explore
parent
d06b26de
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
4 deletions
+14
-4
public/app/containers/Explore/Explore.tsx
+12
-3
public/app/plugins/datasource/prometheus/datasource.ts
+1
-0
public/sass/pages/_explore.scss
+1
-1
No files found.
public/app/containers/Explore/Explore.tsx
View file @
390090da
...
...
@@ -35,6 +35,7 @@ function parseInitialState(initial) {
try
{
const
parsed
=
JSON
.
parse
(
decodePathComponent
(
initial
));
return
{
datasource
:
parsed
.
datasource
,
queries
:
parsed
.
queries
.
map
(
q
=>
q
.
query
),
range
:
parsed
.
range
,
};
...
...
@@ -50,6 +51,7 @@ interface IExploreState {
datasourceLoading
:
boolean
|
null
;
datasourceMissing
:
boolean
;
graphResult
:
any
;
initialDatasource
?:
string
;
latency
:
number
;
loading
:
any
;
queries
:
any
;
...
...
@@ -65,13 +67,14 @@ interface IExploreState {
export
class
Explore
extends
React
.
Component
<
any
,
IExploreState
>
{
constructor
(
props
)
{
super
(
props
);
const
{
range
,
queries
}
=
parseInitialState
(
props
.
routeParams
.
initial
);
const
{
datasource
,
queries
,
range
}
=
parseInitialState
(
props
.
routeParams
.
initial
);
this
.
state
=
{
datasource
:
null
,
datasourceError
:
null
,
datasourceLoading
:
null
,
datasourceMissing
:
false
,
graphResult
:
null
,
initialDatasource
:
datasource
,
latency
:
0
,
loading
:
false
,
queries
:
ensureQueries
(
queries
),
...
...
@@ -87,14 +90,20 @@ export class Explore extends React.Component<any, IExploreState> {
async
componentDidMount
()
{
const
{
datasourceSrv
}
=
this
.
props
;
const
{
initialDatasource
}
=
this
.
state
;
if
(
!
datasourceSrv
)
{
throw
new
Error
(
'No datasource service passed as props.'
);
}
const
datasources
=
datasourceSrv
.
getExploreSources
();
if
(
datasources
.
length
>
0
)
{
this
.
setState
({
datasourceLoading
:
true
});
// Try default datasource, otherwise get first
let
datasource
=
await
datasourceSrv
.
get
();
// Priority: datasource in url, default datasource, first explore datasource
let
datasource
;
if
(
initialDatasource
)
{
datasource
=
await
datasourceSrv
.
get
(
initialDatasource
);
}
else
{
datasource
=
await
datasourceSrv
.
get
();
}
if
(
!
datasource
.
meta
.
explore
)
{
datasource
=
await
datasourceSrv
.
get
(
datasources
[
0
].
name
);
}
...
...
public/app/plugins/datasource/prometheus/datasource.ts
View file @
390090da
...
...
@@ -357,6 +357,7 @@ export class PrometheusDatasource {
state = {
...state,
queries,
datasource: this.name,
};
}
return state;
...
...
public/sass/pages/_explore.scss
View file @
390090da
...
...
@@ -61,7 +61,7 @@
}
.datasource-picker
{
min-width
:
6
rem
;
min-width
:
10
rem
;
}
.timepicker
{
...
...
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