added if to onAppevent, renamed appevent, add appevent to applyCustom and setRelativeFilter
This commit is contained in:
@@ -23,7 +23,13 @@ export class KeybindingSrv {
|
||||
|
||||
this.setupGlobal();
|
||||
appEvents.on('show-modal', () => (this.modalOpen = true));
|
||||
$rootScope.onAppEvent('openTimepicker', () => (this.timepickerOpen = true));
|
||||
$rootScope.onAppEvent('escTimepicker', () => {
|
||||
if (!this.timepickerOpen) {
|
||||
this.timepickerOpen = true;
|
||||
} else {
|
||||
this.timepickerOpen = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setupGlobal() {
|
||||
|
||||
@@ -96,13 +96,12 @@ export class TimePickerCtrl {
|
||||
}
|
||||
|
||||
openDropdown() {
|
||||
this.$rootScope.appEvent('escTimepicker');
|
||||
if (this.isOpen) {
|
||||
this.isOpen = false;
|
||||
return;
|
||||
}
|
||||
|
||||
this.$rootScope.appEvent('openTimepicker');
|
||||
|
||||
this.onRefresh();
|
||||
this.editTimeRaw = this.timeRaw;
|
||||
this.timeOptions = rangeUtil.getRelativeTimesList(this.panel, this.rangeString);
|
||||
@@ -118,6 +117,7 @@ export class TimePickerCtrl {
|
||||
}
|
||||
|
||||
applyCustom() {
|
||||
this.$rootScope.appEvent('escTimepicker');
|
||||
if (this.refresh.value !== this.dashboard.refresh) {
|
||||
this.timeSrv.setAutoRefresh(this.refresh.value);
|
||||
}
|
||||
@@ -139,6 +139,7 @@ export class TimePickerCtrl {
|
||||
}
|
||||
|
||||
setRelativeFilter(timespan) {
|
||||
this.$rootScope.appEvent('escTimepicker');
|
||||
var range = { from: timespan.from, to: timespan.to };
|
||||
|
||||
if (this.panel.nowDelay && range.to === 'now') {
|
||||
|
||||
Reference in New Issue
Block a user