File tree Expand file tree Collapse file tree 4 files changed +47
-7
lines changed Expand file tree Collapse file tree 4 files changed +47
-7
lines changed Original file line number Diff line number Diff line change 38
38
- Add control options ` mapFitData ` and ` mapZoomByRadius ` .
39
39
- Repaint user interface.
40
40
- Refactor machinery and user interface.
41
- - Add options ` ignoreEmptyGeohashValues ` and ` ignoreInvalidGeohashValues ` .
41
+ - Add options ` ignoreEmptyGeohashValues ` and ` ignoreInvalidGeohashValues ` .
42
+ - Add ` ignoreEscapeKey ` option.
42
43
43
44
## v0.2.0
44
45
Original file line number Diff line number Diff line change @@ -44,4 +44,33 @@ export class WorldmapChrome {
44
44
} ) ;
45
45
}
46
46
47
+ removeEscapeKeyBinding ( ) {
48
+ /*
49
+ * Prevent navigation
50
+ * - https://github.com/grafana/grafana/issues/11636
51
+ * - https://github.com/grafana/grafana/issues/13706
52
+ *
53
+ * Embed entire dashboard
54
+ * - https://github.com/grafana/grafana/issues/4757
55
+ * - https://github.com/grafana/grafana/issues/10979
56
+ * - https://github.com/grafana/grafana/issues/13493
57
+ *
58
+ * References
59
+ * - https://github.com/grafana/grafana/blob/v6.1.6/public/app/core/services/keybindingSrv.ts
60
+ * - https://github.com/grafana/grafana/blob/v6.1.6/public/app/plugins/datasource/grafana-azure-monitor-datasource/editor/query_field.tsx
61
+ * - https://github.com/daq-tools/grafanimate/blob/0.5.5/grafanimate/grafana-studio.js
62
+ *
63
+ */
64
+ this . getKeybindingSrv ( ) . unbind ( 'esc' , 'keydown' ) ;
65
+ }
66
+
67
+ restoreEscapeKeyBinding ( ) {
68
+ this . getKeybindingSrv ( ) . setupGlobal ( ) ;
69
+ }
70
+
71
+ getKeybindingSrv ( ) {
72
+ const app = window [ 'angular' ] . element ( 'grafana-app' ) ;
73
+ return app . injector ( ) . get ( 'keybindingSrv' ) ;
74
+ }
75
+
47
76
}
Original file line number Diff line number Diff line change @@ -347,6 +347,12 @@ <h5>Appearance</h5>
347
347
< gf-form-switch class ="gf-form " label ="Mouse Wheel Zoom " label-class ="width-10 " checked ="ctrl.panel.mouseWheelZoom " on-change ="ctrl.toggleMouseWheelZoom() "> </ gf-form-switch >
348
348
</ div >
349
349
350
+ < div class ="gf-form-group ">
351
+ < h5 > Global options</ h5 >
352
+ < gf-form-switch class ="gf-form " label ="Ignore escape key " label-class ="width-10 " checked ="ctrl.panel.ignoreEscapeKey " on-change ="ctrl.setupGlobal() "> </ gf-form-switch >
353
+ < gf-form-switch class ="gf-form " label ="Hide time picker " label-class ="width-10 " checked ="ctrl.panel.hideTimepickerNavigation " on-change ="ctrl.setupGlobal() "> </ gf-form-switch >
354
+ </ div >
355
+
350
356
</ div >
351
357
352
358
<!-- 2nd column -->
Original file line number Diff line number Diff line change @@ -63,7 +63,8 @@ const panelDefaults = {
63
63
labelField : null ,
64
64
labelLocationKeyField : null ,
65
65
linkField : null ,
66
- }
66
+ } ,
67
+ ignoreEscapeKey : false ,
67
68
} ;
68
69
69
70
export default class WorldmapCtrl extends MetricsPanelCtrl {
@@ -84,8 +85,6 @@ export default class WorldmapCtrl extends MetricsPanelCtrl {
84
85
$document : any ;
85
86
86
87
settings : any ;
87
- dataErrors :Array < any > = [ ] ;
88
- locationErrors :Array < any > = [ ] ;
89
88
core : WorldmapCore ;
90
89
chrome : WorldmapChrome ;
91
90
errors : ErrorManager ;
@@ -135,9 +134,14 @@ export default class WorldmapCtrl extends MetricsPanelCtrl {
135
134
/*
136
135
* Initialize the plugin.
137
136
*/
138
- // TODO: Establish conditions for running this.
139
- //this.removeTimePickerNav();
140
- //this.removeEscapeKeyBinding();
137
+
138
+ // Optionally ignore the escape key.
139
+ if ( this . settings . ignoreEscapeKey ) {
140
+ this . chrome . removeEscapeKeyBinding ( ) ;
141
+ } else {
142
+ this . chrome . restoreEscapeKeyBinding ( ) ;
143
+ }
144
+
141
145
}
142
146
143
147
setupEvents ( ) {
You can’t perform that action at this time.
0 commit comments