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
9565e48f
Commit
9565e48f
authored
Feb 11, 2019
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed issue where double clicking on back button closes sidemenu
parent
f38e64cc
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
3 deletions
+23
-3
public/app/core/components/sidemenu/SideMenu.test.tsx
+10
-0
public/app/core/components/sidemenu/SideMenu.tsx
+7
-0
public/app/core/reducers/location.ts
+2
-0
public/app/store/configureStore.ts
+2
-2
public/app/types/location.ts
+1
-0
public/sass/components/_search.scss
+1
-1
No files found.
public/app/core/components/sidemenu/SideMenu.test.tsx
View file @
9565e48f
...
...
@@ -8,6 +8,16 @@ jest.mock('../../app_events', () => ({
emit
:
jest
.
fn
(),
}));
jest
.
mock
(
'app/store/store'
,
()
=>
({
store
:
{
getState
:
jest
.
fn
().
mockReturnValue
({
location
:
{
lastUpdated
:
0
,
}
})
}
}));
jest
.
mock
(
'app/core/services/context_srv'
,
()
=>
({
contextSrv
:
{
sidemenu
:
true
,
...
...
public/app/core/components/sidemenu/SideMenu.tsx
View file @
9565e48f
...
...
@@ -3,9 +3,16 @@ import appEvents from '../../app_events';
import
{
contextSrv
}
from
'app/core/services/context_srv'
;
import
TopSection
from
'./TopSection'
;
import
BottomSection
from
'./BottomSection'
;
import
{
store
}
from
'app/store/store'
;
export
class
SideMenu
extends
PureComponent
{
toggleSideMenu
=
()
=>
{
// ignore if we just made a location change, stops hiding sidemenu on double clicks of back button
const
timeSinceLocationChanged
=
new
Date
().
getTime
()
-
store
.
getState
().
location
.
lastUpdated
;
if
(
timeSinceLocationChanged
<
1000
)
{
return
;
}
contextSrv
.
toggleSideMenu
();
appEvents
.
emit
(
'toggle-sidemenu'
);
};
...
...
public/app/core/reducers/location.ts
View file @
9565e48f
...
...
@@ -9,6 +9,7 @@ export const initialState: LocationState = {
query
:
{},
routeParams
:
{},
replace
:
false
,
lastUpdated
:
0
,
};
export
const
locationReducer
=
(
state
=
initialState
,
action
:
Action
):
LocationState
=>
{
...
...
@@ -28,6 +29,7 @@ export const locationReducer = (state = initialState, action: Action): LocationS
query
:
{
...
query
},
routeParams
:
routeParams
||
state
.
routeParams
,
replace
:
replace
===
true
,
lastUpdated
:
new
Date
().
getTime
(),
};
}
}
...
...
public/app/store/configureStore.ts
View file @
9565e48f
import
{
createStore
,
applyMiddleware
,
compose
,
combineReducers
}
from
'redux'
;
import
thunk
from
'redux-thunk'
;
import
{
createLogger
}
from
'redux-logger'
;
//
import { createLogger } from 'redux-logger';
import
sharedReducers
from
'app/core/reducers'
;
import
alertingReducers
from
'app/features/alerting/state/reducers'
;
import
teamsReducers
from
'app/features/teams/state/reducers'
;
...
...
@@ -41,7 +41,7 @@ export function configureStore() {
if
(
process
.
env
.
NODE_ENV
!==
'production'
)
{
// DEV builds we had the logger middleware
setStore
(
createStore
(
rootReducer
,
{},
composeEnhancers
(
applyMiddleware
(
thunk
,
createLogger
()
))));
setStore
(
createStore
(
rootReducer
,
{},
composeEnhancers
(
applyMiddleware
(
thunk
))));
}
else
{
setStore
(
createStore
(
rootReducer
,
{},
composeEnhancers
(
applyMiddleware
(
thunk
))));
}
...
...
public/app/types/location.ts
View file @
9565e48f
...
...
@@ -15,6 +15,7 @@ export interface LocationState {
query
:
UrlQueryMap
;
routeParams
:
UrlQueryMap
;
replace
:
boolean
;
lastUpdated
:
number
;
}
export
type
UrlQueryValue
=
string
|
number
|
boolean
|
string
[]
|
number
[]
|
boolean
[];
...
...
public/sass/components/_search.scss
View file @
9565e48f
...
...
@@ -21,9 +21,9 @@
// Search
.search-field-wrapper
{
width
:
100%
;
height
:
$navbarHeight
;
display
:
flex
;
background-color
:
$navbarBackground
;
box-shadow
:
$navbarShadow
;
position
:
relative
;
&
>
input
{
...
...
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