|
1 | 1 | define([
|
2 |
| - 'angular', |
3 |
| - 'jquery', |
4 |
| - 'services/all' |
| 2 | + 'angular', |
| 3 | + 'jquery', |
| 4 | + 'services/all' |
5 | 5 | ],
|
6 |
| -function( angular, $ ) { |
7 |
| - "use strict"; |
8 |
| - |
9 |
| - var module = angular.module('kibana.services.dashboard'); |
10 |
| - |
11 |
| - module.service( 'dashboardKeybindings', function($rootScope, keyboardManager, dashboard) { |
12 |
| - this.shortcuts = function() { |
13 |
| - $rootScope.$on('panel-fullscreen-enter', function() { |
14 |
| - $rootScope.fullscreen = true; |
15 |
| - }); |
16 |
| - |
17 |
| - $rootScope.$on('panel-fullscreen-exit', function() { |
18 |
| - $rootScope.fullscreen = false; |
19 |
| - }); |
20 |
| - |
21 |
| - $rootScope.$on('dashboard-saved', function() { |
22 |
| - if ($rootScope.fullscreen) { |
23 |
| - $rootScope.$emit('panel-fullscreen-exit'); |
24 |
| - } |
25 |
| - }); |
26 |
| - |
27 |
| - keyboardManager.bind('ctrl+f', function(evt) { |
28 |
| - $rootScope.$emit('open-search', evt); |
29 |
| - }, { inputDisabled: true }); |
30 |
| - |
31 |
| - keyboardManager.bind('ctrl+h', function() { |
32 |
| - var current = dashboard.current.hideControls; |
33 |
| - dashboard.current.hideControls = !current; |
34 |
| - dashboard.current.panel_hints = current; |
35 |
| - }, { inputDisabled: true }); |
36 |
| - |
37 |
| - keyboardManager.bind('ctrl+s', function(evt) { |
38 |
| - $rootScope.$emit('save-dashboard', evt); |
39 |
| - }, { inputDisabled: true }); |
40 |
| - |
41 |
| - keyboardManager.bind('ctrl+r', function() { |
42 |
| - dashboard.refresh(); |
43 |
| - }, { inputDisabled: true }); |
44 |
| - |
45 |
| - keyboardManager.bind('ctrl+z', function(evt) { |
46 |
| - $rootScope.$emit('zoom-out', evt); |
47 |
| - }, { inputDisabled: true }); |
48 |
| - |
49 |
| - keyboardManager.bind('esc', function() { |
50 |
| - var popups = $('.popover.in'); |
51 |
| - if (popups.length > 0) { |
52 |
| - return; |
53 |
| - } |
54 |
| - $rootScope.$emit('panel-fullscreen-exit'); |
55 |
| - }, { inputDisabled: true }); |
56 |
| - }; |
57 |
| - }); |
| 6 | +function(angular, $) { |
| 7 | + "use strict"; |
| 8 | + |
| 9 | + var module = angular.module('kibana.services.dashboard'); |
| 10 | + |
| 11 | + module.service('dashboardKeybindings', function($rootScope, keyboardManager, dashboard) { |
| 12 | + this.shortcuts = function() { |
| 13 | + $rootScope.$on('panel-fullscreen-enter', function() { |
| 14 | + $rootScope.fullscreen = true; |
| 15 | + }); |
| 16 | + |
| 17 | + $rootScope.$on('panel-fullscreen-exit', function() { |
| 18 | + $rootScope.fullscreen = false; |
| 19 | + }); |
| 20 | + |
| 21 | + $rootScope.$on('dashboard-saved', function() { |
| 22 | + if ($rootScope.fullscreen) { |
| 23 | + $rootScope.$emit('panel-fullscreen-exit'); |
| 24 | + } |
| 25 | + }); |
| 26 | + |
| 27 | + keyboardManager.bind('ctrl+f', function(evt) { |
| 28 | + $rootScope.$emit('open-search', evt); |
| 29 | + }, { inputDisabled: true }); |
| 30 | + |
| 31 | + keyboardManager.bind('ctrl+h', function() { |
| 32 | + var current = dashboard.current.hideControls; |
| 33 | + dashboard.current.hideControls = !current; |
| 34 | + dashboard.current.panel_hints = current; |
| 35 | + }, { inputDisabled: true }); |
| 36 | + |
| 37 | + keyboardManager.bind('ctrl+s', function(evt) { |
| 38 | + $rootScope.$emit('save-dashboard', evt); |
| 39 | + }, { inputDisabled: true }); |
| 40 | + |
| 41 | + keyboardManager.bind('ctrl+r', function() { |
| 42 | + dashboard.refresh(); |
| 43 | + }, { inputDisabled: true }); |
| 44 | + |
| 45 | + keyboardManager.bind('ctrl+z', function(evt) { |
| 46 | + $rootScope.$emit('zoom-out', evt); |
| 47 | + }, { inputDisabled: true }); |
| 48 | + |
| 49 | + keyboardManager.bind('esc', function() { |
| 50 | + var popups = $('.popover.in'); |
| 51 | + if (popups.length > 0) { |
| 52 | + return; |
| 53 | + } |
| 54 | + $rootScope.$emit('panel-fullscreen-exit'); |
| 55 | + }, { inputDisabled: true }); |
| 56 | + }; |
| 57 | + }); |
58 | 58 | });
|
0 commit comments