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
757d6f32
Commit
757d6f32
authored
Jan 02, 2019
by
David Kaltschmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
s/initialDatasourceId/initialDatasource/
parent
67ebdcbc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
13 deletions
+13
-13
public/app/core/utils/explore.test.ts
+4
-4
public/app/core/utils/explore.ts
+1
-1
public/app/features/explore/Explore.tsx
+7
-7
public/app/types/explore.ts
+1
-1
No files found.
public/app/core/utils/explore.test.ts
View file @
757d6f32
...
@@ -68,7 +68,7 @@ describe('state functions', () => {
...
@@ -68,7 +68,7 @@ describe('state functions', () => {
it
(
'returns url parameter value for a state object'
,
()
=>
{
it
(
'returns url parameter value for a state object'
,
()
=>
{
const
state
=
{
const
state
=
{
...
DEFAULT_EXPLORE_STATE
,
...
DEFAULT_EXPLORE_STATE
,
initialDatasource
Id
:
'foo'
,
initialDatasource
:
'foo'
,
range
:
{
range
:
{
from
:
'now-5h'
,
from
:
'now-5h'
,
to
:
'now'
,
to
:
'now'
,
...
@@ -93,7 +93,7 @@ describe('state functions', () => {
...
@@ -93,7 +93,7 @@ describe('state functions', () => {
it
(
'returns url parameter value for a state object'
,
()
=>
{
it
(
'returns url parameter value for a state object'
,
()
=>
{
const
state
=
{
const
state
=
{
...
DEFAULT_EXPLORE_STATE
,
...
DEFAULT_EXPLORE_STATE
,
initialDatasource
Id
:
'foo'
,
initialDatasource
:
'foo'
,
range
:
{
range
:
{
from
:
'now-5h'
,
from
:
'now-5h'
,
to
:
'now'
,
to
:
'now'
,
...
@@ -119,7 +119,7 @@ describe('state functions', () => {
...
@@ -119,7 +119,7 @@ describe('state functions', () => {
it
(
'can parse the serialized state into the original state'
,
()
=>
{
it
(
'can parse the serialized state into the original state'
,
()
=>
{
const
state
=
{
const
state
=
{
...
DEFAULT_EXPLORE_STATE
,
...
DEFAULT_EXPLORE_STATE
,
initialDatasource
Id
:
'foo'
,
initialDatasource
:
'foo'
,
range
:
{
range
:
{
from
:
'now - 5h'
,
from
:
'now - 5h'
,
to
:
'now'
,
to
:
'now'
,
...
@@ -143,7 +143,7 @@ describe('state functions', () => {
...
@@ -143,7 +143,7 @@ describe('state functions', () => {
const
resultState
=
{
const
resultState
=
{
...
rest
,
...
rest
,
datasource
:
DEFAULT_EXPLORE_STATE
.
datasource
,
datasource
:
DEFAULT_EXPLORE_STATE
.
datasource
,
initialDatasource
Id
:
datasource
,
initialDatasource
:
datasource
,
initialQueries
:
queries
,
initialQueries
:
queries
,
};
};
...
...
public/app/core/utils/explore.ts
View file @
757d6f32
...
@@ -105,7 +105,7 @@ export function parseUrlState(initial: string | undefined): ExploreUrlState {
...
@@ -105,7 +105,7 @@ export function parseUrlState(initial: string | undefined): ExploreUrlState {
export
function
serializeStateToUrlParam
(
state
:
ExploreState
,
compact
?:
boolean
):
string
{
export
function
serializeStateToUrlParam
(
state
:
ExploreState
,
compact
?:
boolean
):
string
{
const
urlState
:
ExploreUrlState
=
{
const
urlState
:
ExploreUrlState
=
{
datasource
:
state
.
initialDatasource
Id
,
datasource
:
state
.
initialDatasource
,
queries
:
state
.
initialQueries
.
map
(
clearQueryKeys
),
queries
:
state
.
initialQueries
.
map
(
clearQueryKeys
),
range
:
state
.
range
,
range
:
state
.
range
,
};
};
...
...
public/app/features/explore/Explore.tsx
View file @
757d6f32
...
@@ -95,7 +95,7 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
...
@@ -95,7 +95,7 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
/**
/**
* Set via URL or local storage
* Set via URL or local storage
*/
*/
initialDatasource
Id
:
string
;
initialDatasource
:
string
;
/**
/**
* Current query expressions of the rows including their modifications, used for running queries.
* Current query expressions of the rows including their modifications, used for running queries.
* Not kept in component state to prevent edit-render roundtrips.
* Not kept in component state to prevent edit-render roundtrips.
...
@@ -121,7 +121,7 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
...
@@ -121,7 +121,7 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
initialQueries
=
splitState
.
initialQueries
;
initialQueries
=
splitState
.
initialQueries
;
}
else
{
}
else
{
const
{
datasource
,
queries
,
range
}
=
props
.
urlState
as
ExploreUrlState
;
const
{
datasource
,
queries
,
range
}
=
props
.
urlState
as
ExploreUrlState
;
const
initialDatasource
Id
=
datasource
||
store
.
get
(
LAST_USED_DATASOURCE_KEY
);
const
initialDatasource
=
datasource
||
store
.
get
(
LAST_USED_DATASOURCE_KEY
);
initialQueries
=
ensureQueries
(
queries
);
initialQueries
=
ensureQueries
(
queries
);
const
initialRange
=
{
from
:
parseTime
(
range
.
from
),
to
:
parseTime
(
range
.
to
)
}
||
{
...
DEFAULT_RANGE
};
const
initialRange
=
{
from
:
parseTime
(
range
.
from
),
to
:
parseTime
(
range
.
to
)
}
||
{
...
DEFAULT_RANGE
};
// Millies step for helper bar charts
// Millies step for helper bar charts
...
@@ -134,7 +134,7 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
...
@@ -134,7 +134,7 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
exploreDatasources
:
[],
exploreDatasources
:
[],
graphInterval
:
initialGraphInterval
,
graphInterval
:
initialGraphInterval
,
graphResult
:
[],
graphResult
:
[],
initialDatasource
Id
,
initialDatasource
,
initialQueries
,
initialQueries
,
history
:
[],
history
:
[],
logsResult
:
null
,
logsResult
:
null
,
...
@@ -158,7 +158,7 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
...
@@ -158,7 +158,7 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
async
componentDidMount
()
{
async
componentDidMount
()
{
const
{
datasourceSrv
}
=
this
.
props
;
const
{
datasourceSrv
}
=
this
.
props
;
const
{
initialDatasource
Id
}
=
this
.
state
;
const
{
initialDatasource
}
=
this
.
state
;
if
(
!
datasourceSrv
)
{
if
(
!
datasourceSrv
)
{
throw
new
Error
(
'No datasource service passed as props.'
);
throw
new
Error
(
'No datasource service passed as props.'
);
}
}
...
@@ -174,8 +174,8 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
...
@@ -174,8 +174,8 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
this
.
setState
({
datasourceLoading
:
true
,
exploreDatasources
});
this
.
setState
({
datasourceLoading
:
true
,
exploreDatasources
});
// Priority for datasource preselection: URL, localstorage, default datasource
// Priority for datasource preselection: URL, localstorage, default datasource
let
datasource
;
let
datasource
;
if
(
initialDatasource
Id
)
{
if
(
initialDatasource
)
{
datasource
=
await
datasourceSrv
.
get
(
initialDatasource
Id
);
datasource
=
await
datasourceSrv
.
get
(
initialDatasource
);
}
else
{
}
else
{
datasource
=
await
datasourceSrv
.
get
();
datasource
=
await
datasourceSrv
.
get
();
}
}
...
@@ -260,7 +260,7 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
...
@@ -260,7 +260,7 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
supportsLogs
,
supportsLogs
,
supportsTable
,
supportsTable
,
datasourceLoading
:
false
,
datasourceLoading
:
false
,
initialDatasource
Id
:
datasource
.
name
,
initialDatasource
:
datasource
.
name
,
initialQueries
:
nextQueries
,
initialQueries
:
nextQueries
,
logsHighlighterExpressions
:
undefined
,
logsHighlighterExpressions
:
undefined
,
showingStartPage
:
Boolean
(
StartPage
),
showingStartPage
:
Boolean
(
StartPage
),
...
...
public/app/types/explore.ts
View file @
757d6f32
...
@@ -159,7 +159,7 @@ export interface ExploreState {
...
@@ -159,7 +159,7 @@ export interface ExploreState {
graphInterval
:
number
;
// in ms
graphInterval
:
number
;
// in ms
graphResult
?:
any
[];
graphResult
?:
any
[];
history
:
HistoryItem
[];
history
:
HistoryItem
[];
initialDatasource
Id
?:
string
;
initialDatasource
?:
string
;
initialQueries
:
DataQuery
[];
initialQueries
:
DataQuery
[];
logsHighlighterExpressions
?:
string
[];
logsHighlighterExpressions
?:
string
[];
logsResult
?:
LogsModel
;
logsResult
?:
LogsModel
;
...
...
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