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
edfce089
Unverified
Commit
edfce089
authored
Jan 28, 2019
by
David
Committed by
GitHub
Jan 28, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15090 from grafana/hugoh/bug-explore-cant-go-from-dashboard-to-explore
Fixed reinitialise of Explore
parents
9298876e
6b0400ee
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
42 additions
and
25 deletions
+42
-25
public/app/core/actions/location.ts
+6
-2
public/app/core/reducers/location.ts
+3
-5
public/app/features/explore/Wrapper.tsx
+7
-1
public/app/features/explore/state/actionTypes.ts
+9
-2
public/app/features/explore/state/actions.ts
+10
-2
public/app/features/explore/state/reducers.ts
+7
-13
No files found.
public/app/core/actions/location.ts
View file @
edfce089
import
{
LocationUpdate
}
from
'app/types'
;
import
{
LocationUpdate
}
from
'app/types'
;
export
enum
CoreActionTypes
{
UpdateLocation
=
'UPDATE_LOCATION'
,
}
export
type
Action
=
UpdateLocationAction
;
export
type
Action
=
UpdateLocationAction
;
export
interface
UpdateLocationAction
{
export
interface
UpdateLocationAction
{
type
:
'UPDATE_LOCATION'
;
type
:
CoreActionTypes
.
UpdateLocation
;
payload
:
LocationUpdate
;
payload
:
LocationUpdate
;
}
}
export
const
updateLocation
=
(
location
:
LocationUpdate
):
UpdateLocationAction
=>
({
export
const
updateLocation
=
(
location
:
LocationUpdate
):
UpdateLocationAction
=>
({
type
:
'UPDATE_LOCATION'
,
type
:
CoreActionTypes
.
UpdateLocation
,
payload
:
location
,
payload
:
location
,
});
});
public/app/core/reducers/location.ts
View file @
edfce089
import
{
Action
}
from
'app/core/actions/location'
;
import
{
Action
,
CoreActionTypes
}
from
'app/core/actions/location'
;
import
{
LocationState
}
from
'app/types'
;
import
{
LocationState
}
from
'app/types'
;
import
{
renderUrl
}
from
'app/core/utils/url'
;
import
{
renderUrl
}
from
'app/core/utils/url'
;
import
_
from
'lodash'
;
import
_
from
'lodash'
;
...
@@ -12,7 +12,7 @@ export const initialState: LocationState = {
...
@@ -12,7 +12,7 @@ export const initialState: LocationState = {
export
const
locationReducer
=
(
state
=
initialState
,
action
:
Action
):
LocationState
=>
{
export
const
locationReducer
=
(
state
=
initialState
,
action
:
Action
):
LocationState
=>
{
switch
(
action
.
type
)
{
switch
(
action
.
type
)
{
case
'UPDATE_LOCATION'
:
{
case
CoreActionTypes
.
UpdateLocation
:
{
const
{
path
,
routeParams
}
=
action
.
payload
;
const
{
path
,
routeParams
}
=
action
.
payload
;
let
query
=
action
.
payload
.
query
||
state
.
query
;
let
query
=
action
.
payload
.
query
||
state
.
query
;
...
@@ -24,9 +24,7 @@ export const locationReducer = (state = initialState, action: Action): LocationS
...
@@ -24,9 +24,7 @@ export const locationReducer = (state = initialState, action: Action): LocationS
return
{
return
{
url
:
renderUrl
(
path
||
state
.
path
,
query
),
url
:
renderUrl
(
path
||
state
.
path
,
query
),
path
:
path
||
state
.
path
,
path
:
path
||
state
.
path
,
query
:
{
query
:
{
...
query
},
...
query
,
},
routeParams
:
routeParams
||
state
.
routeParams
,
routeParams
:
routeParams
||
state
.
routeParams
,
};
};
}
}
...
...
public/app/features/explore/Wrapper.tsx
View file @
edfce089
...
@@ -7,7 +7,7 @@ import { StoreState } from 'app/types';
...
@@ -7,7 +7,7 @@ import { StoreState } from 'app/types';
import
{
ExploreId
,
ExploreUrlState
}
from
'app/types/explore'
;
import
{
ExploreId
,
ExploreUrlState
}
from
'app/types/explore'
;
import
{
parseUrlState
}
from
'app/core/utils/explore'
;
import
{
parseUrlState
}
from
'app/core/utils/explore'
;
import
{
initializeExploreSplit
}
from
'./state/actions'
;
import
{
initializeExploreSplit
,
resetExplore
}
from
'./state/actions'
;
import
ErrorBoundary
from
'./ErrorBoundary'
;
import
ErrorBoundary
from
'./ErrorBoundary'
;
import
Explore
from
'./Explore'
;
import
Explore
from
'./Explore'
;
import
{
CustomScrollbar
}
from
'@grafana/ui'
;
import
{
CustomScrollbar
}
from
'@grafana/ui'
;
...
@@ -16,6 +16,7 @@ interface WrapperProps {
...
@@ -16,6 +16,7 @@ interface WrapperProps {
initializeExploreSplit
:
typeof
initializeExploreSplit
;
initializeExploreSplit
:
typeof
initializeExploreSplit
;
split
:
boolean
;
split
:
boolean
;
updateLocation
:
typeof
updateLocation
;
updateLocation
:
typeof
updateLocation
;
resetExplore
:
typeof
resetExplore
;
urlStates
:
{
[
key
:
string
]:
string
};
urlStates
:
{
[
key
:
string
]:
string
};
}
}
...
@@ -42,6 +43,10 @@ export class Wrapper extends Component<WrapperProps> {
...
@@ -42,6 +43,10 @@ export class Wrapper extends Component<WrapperProps> {
}
}
}
}
componentWillUnmount
()
{
this
.
props
.
resetExplore
();
}
render
()
{
render
()
{
const
{
split
}
=
this
.
props
;
const
{
split
}
=
this
.
props
;
const
{
leftState
,
rightState
}
=
this
.
urlStates
;
const
{
leftState
,
rightState
}
=
this
.
urlStates
;
...
@@ -74,6 +79,7 @@ const mapStateToProps = (state: StoreState) => {
...
@@ -74,6 +79,7 @@ const mapStateToProps = (state: StoreState) => {
const
mapDispatchToProps
=
{
const
mapDispatchToProps
=
{
initializeExploreSplit
,
initializeExploreSplit
,
updateLocation
,
updateLocation
,
resetExplore
,
};
};
export
default
hot
(
module
)(
connect
(
mapStateToProps
,
mapDispatchToProps
)(
Wrapper
));
export
default
hot
(
module
)(
connect
(
mapStateToProps
,
mapDispatchToProps
)(
Wrapper
));
public/app/features/explore/state/actionTypes.ts
View file @
edfce089
// Types
// Types
import
{
Emitter
}
from
'app/core/core'
;
import
{
Emitter
}
from
'app/core/core'
;
import
{
RawTimeRange
,
TimeRange
,
DataQuery
,
DataSourceSelectItem
}
from
'@grafana/ui/src/types'
;
import
{
RawTimeRange
,
TimeRange
,
DataQuery
,
DataSourceSelectItem
}
from
'@grafana/ui/src/types'
;
import
{
import
{
ExploreId
,
ExploreId
,
ExploreItemState
,
ExploreItemState
,
...
@@ -41,6 +41,7 @@ export enum ActionTypes {
...
@@ -41,6 +41,7 @@ export enum ActionTypes {
ToggleGraph
=
'explore/TOGGLE_GRAPH'
,
ToggleGraph
=
'explore/TOGGLE_GRAPH'
,
ToggleLogs
=
'explore/TOGGLE_LOGS'
,
ToggleLogs
=
'explore/TOGGLE_LOGS'
,
ToggleTable
=
'explore/TOGGLE_TABLE'
,
ToggleTable
=
'explore/TOGGLE_TABLE'
,
ResetExplore
=
'explore/RESET_EXPLORE'
,
}
}
export
interface
AddQueryRowAction
{
export
interface
AddQueryRowAction
{
...
@@ -270,6 +271,11 @@ export interface ToggleLogsAction {
...
@@ -270,6 +271,11 @@ export interface ToggleLogsAction {
};
};
}
}
export
interface
ResetExploreAction
{
type
:
ActionTypes
.
ResetExplore
;
payload
:
{};
}
export
type
Action
=
export
type
Action
=
|
AddQueryRowAction
|
AddQueryRowAction
|
ChangeQueryAction
|
ChangeQueryAction
...
@@ -297,4 +303,5 @@ export type Action =
...
@@ -297,4 +303,5 @@ export type Action =
|
SplitOpenAction
|
SplitOpenAction
|
ToggleGraphAction
|
ToggleGraphAction
|
ToggleLogsAction
|
ToggleLogsAction
|
ToggleTableAction
;
|
ToggleTableAction
|
ResetExploreAction
;
public/app/features/explore/state/actions.ts
View file @
edfce089
...
@@ -21,7 +21,7 @@ import { updateLocation } from 'app/core/actions';
...
@@ -21,7 +21,7 @@ import { updateLocation } from 'app/core/actions';
// Types
// Types
import
{
StoreState
}
from
'app/types'
;
import
{
StoreState
}
from
'app/types'
;
import
{
DataQuery
,
DataSourceSelectItem
,
QueryHint
}
from
'@grafana/ui/src/types'
;
import
{
DataQuery
,
DataSourceSelectItem
,
QueryHint
}
from
'@grafana/ui/src/types'
;
import
{
getDatasourceSrv
}
from
'app/features/plugins/datasource_srv'
;
import
{
getDatasourceSrv
}
from
'app/features/plugins/datasource_srv'
;
import
{
import
{
ExploreId
,
ExploreId
,
...
@@ -48,7 +48,6 @@ import {
...
@@ -48,7 +48,6 @@ import {
ScanStopAction
,
ScanStopAction
,
}
from
'./actionTypes'
;
}
from
'./actionTypes'
;
type
ThunkResult
<
R
>
=
ThunkAction
<
R
,
StoreState
,
undefined
,
ThunkableAction
>
;
type
ThunkResult
<
R
>
=
ThunkAction
<
R
,
StoreState
,
undefined
,
ThunkableAction
>
;
/**
/**
...
@@ -766,3 +765,12 @@ export function toggleTable(exploreId: ExploreId): ThunkResult<void> {
...
@@ -766,3 +765,12 @@ export function toggleTable(exploreId: ExploreId): ThunkResult<void> {
}
}
};
};
}
}
/**
* Resets state for explore.
*/
export
function
resetExplore
():
ThunkResult
<
void
>
{
return
dispatch
=>
{
dispatch
({
type
:
ActionTypes
.
ResetExplore
,
payload
:
{}
});
};
}
public/app/features/explore/state/reducers.ts
View file @
edfce089
...
@@ -428,25 +428,19 @@ export const itemReducer = (state, action: Action): ExploreItemState => {
...
@@ -428,25 +428,19 @@ export const itemReducer = (state, action: Action): ExploreItemState => {
export
const
exploreReducer
=
(
state
=
initialExploreState
,
action
:
Action
):
ExploreState
=>
{
export
const
exploreReducer
=
(
state
=
initialExploreState
,
action
:
Action
):
ExploreState
=>
{
switch
(
action
.
type
)
{
switch
(
action
.
type
)
{
case
ActionTypes
.
SplitClose
:
{
case
ActionTypes
.
SplitClose
:
{
return
{
return
{
...
state
,
split
:
false
};
...
state
,
split
:
false
,
};
}
}
case
ActionTypes
.
SplitOpen
:
{
case
ActionTypes
.
SplitOpen
:
{
return
{
return
{
...
state
,
split
:
true
,
right
:
action
.
payload
.
itemState
};
...
state
,
split
:
true
,
right
:
action
.
payload
.
itemState
,
};
}
}
case
ActionTypes
.
InitializeExploreSplit
:
{
case
ActionTypes
.
InitializeExploreSplit
:
{
return
{
return
{
...
state
,
split
:
true
};
...
state
,
}
split
:
true
,
};
case
ActionTypes
.
ResetExplore
:
{
return
initialExploreState
;
}
}
}
}
...
...
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