Commit 8195c085 by Patrick O'Carroll

bounnd the esc key to exit timepicker

parent b41370ca
......@@ -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,7 @@ export class KeybindingSrv {
this.setupGlobal();
appEvents.on('show-modal', () => (this.modalOpen = true));
$rootScope.onAppEvent('openTimepicker', () => (this.timepickerOpen = true));
}
setupGlobal() {
......@@ -72,6 +74,11 @@ export class KeybindingSrv {
appEvents.emit('hide-modal');
if (this.timepickerOpen === true) {
this.$rootScope.appEvent('closeTimepicker');
this.timepickerOpen = false;
}
if (!this.modalOpen) {
this.$rootScope.appEvent('panel-change-view', { fullscreen: false, edit: false });
} else {
......
......@@ -32,6 +32,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;
......@@ -100,6 +101,8 @@ export class TimePickerCtrl {
return;
}
this.$rootScope.appEvent('openTimepicker');
this.onRefresh();
this.editTimeRaw = this.timeRaw;
this.timeOptions = rangeUtil.getRelativeTimesList(this.panel, this.rangeString);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment