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
94d1a9fd
Unverified
Commit
94d1a9fd
authored
Apr 05, 2018
by
Marcus Efraimsson
Committed by
GitHub
Apr 05, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11430 from grafana/11332_esc_timepicker
Enable closing timepicker using escape key
parents
fcfc33ee
0273365d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
5 deletions
+19
-5
public/app/core/services/keybindingSrv.ts
+9
-1
public/app/features/dashboard/timepicker/timepicker.ts
+10
-4
No files found.
public/app/core/services/keybindingSrv.ts
View file @
94d1a9fd
...
...
@@ -10,6 +10,7 @@ import 'mousetrap-global-bind';
export
class
KeybindingSrv
{
helpModal
:
boolean
;
modalOpen
=
false
;
timepickerOpen
=
false
;
/** @ngInject */
constructor
(
private
$rootScope
,
private
$location
)
{
...
...
@@ -22,6 +23,8 @@ export class KeybindingSrv {
this
.
setupGlobal
();
appEvents
.
on
(
'show-modal'
,
()
=>
(
this
.
modalOpen
=
true
));
$rootScope
.
onAppEvent
(
'timepickerOpen'
,
()
=>
(
this
.
timepickerOpen
=
true
));
$rootScope
.
onAppEvent
(
'timepickerClosed'
,
()
=>
(
this
.
timepickerOpen
=
false
));
}
setupGlobal
()
{
...
...
@@ -73,7 +76,12 @@ export class KeybindingSrv {
appEvents
.
emit
(
'hide-modal'
);
if
(
!
this
.
modalOpen
)
{
this
.
$rootScope
.
appEvent
(
'panel-change-view'
,
{
fullscreen
:
false
,
edit
:
false
});
if
(
this
.
timepickerOpen
)
{
this
.
$rootScope
.
appEvent
(
'closeTimepicker'
);
this
.
timepickerOpen
=
false
;
}
else
{
this
.
$rootScope
.
appEvent
(
'panel-change-view'
,
{
fullscreen
:
false
,
edit
:
false
});
}
}
else
{
this
.
modalOpen
=
false
;
}
...
...
public/app/features/dashboard/timepicker/timepicker.ts
View file @
94d1a9fd
...
...
@@ -22,7 +22,6 @@ export class TimePickerCtrl {
refresh
:
any
;
isUtc
:
boolean
;
firstDayOfWeek
:
number
;
closeDropdown
:
any
;
isOpen
:
boolean
;
/** @ngInject */
...
...
@@ -32,6 +31,7 @@ export class TimePickerCtrl {
$rootScope
.
onAppEvent
(
'shift-time-forward'
,
()
=>
this
.
move
(
1
),
$scope
);
$rootScope
.
onAppEvent
(
'shift-time-backward'
,
()
=>
this
.
move
(
-
1
),
$scope
);
$rootScope
.
onAppEvent
(
'refresh'
,
this
.
onRefresh
.
bind
(
this
),
$scope
);
$rootScope
.
onAppEvent
(
'closeTimepicker'
,
this
.
openDropdown
.
bind
(
this
),
$scope
);
// init options
this
.
panel
=
this
.
dashboard
.
timepicker
;
...
...
@@ -96,7 +96,7 @@ export class TimePickerCtrl {
openDropdown
()
{
if
(
this
.
isOpen
)
{
this
.
isOpen
=
false
;
this
.
closeDropdown
()
;
return
;
}
...
...
@@ -112,6 +112,12 @@ export class TimePickerCtrl {
this
.
refresh
.
options
.
unshift
({
text
:
'off'
});
this
.
isOpen
=
true
;
this
.
$rootScope
.
appEvent
(
'timepickerOpen'
);
}
closeDropdown
()
{
this
.
isOpen
=
false
;
this
.
$rootScope
.
appEvent
(
'timepickerClosed'
);
}
applyCustom
()
{
...
...
@@ -120,7 +126,7 @@ export class TimePickerCtrl {
}
this
.
timeSrv
.
setTime
(
this
.
editTimeRaw
);
this
.
isOpen
=
false
;
this
.
closeDropdown
()
;
}
absoluteFromChanged
()
{
...
...
@@ -143,7 +149,7 @@ export class TimePickerCtrl {
}
this
.
timeSrv
.
setTime
(
range
);
this
.
isOpen
=
false
;
this
.
closeDropdown
()
;
}
}
...
...
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