File tree Expand file tree Collapse file tree 3 files changed +36
-0
lines changed
src/ansibleguy-webui/aw/static/js Expand file tree Collapse file tree 3 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## Version 0
4
4
5
+ ### 0.0.25
6
+
7
+ * Disable data-refresh if in background
8
+ * Allow to save current form by using SHIFT+S
9
+
10
+ ----
11
+
5
12
### 0.0.24-2
6
13
7
14
* Cleanup job-stati on startup
Original file line number Diff line number Diff line change 6
6
4 - Config
7
7
==========
8
8
9
+ **Tip **: You can use the key-combination :code: `SHIFT + S ` to quick-safe your changes.
10
+
9
11
WebUI
10
12
*****
11
13
Original file line number Diff line number Diff line change @@ -238,6 +238,20 @@ function capitalizeFirstLetter(string) {
238
238
return string . charAt ( 0 ) . toUpperCase ( ) + string . slice ( 1 ) ;
239
239
}
240
240
241
+ pressed_shift = false ;
242
+ function shift_s_handler ( ) {
243
+ for ( let f of document . getElementsByTagName ( 'form' ) ) {
244
+ if ( f . action . includes ( '/api' ) ) {
245
+ // NOTE: form.submit is not working as we want to catch it later on
246
+ let saveButtons = f . querySelectorAll ( "button[title=Save]" ) ;
247
+ if ( saveButtons . length > 0 ) {
248
+ saveButtons [ 0 ] . click ( ) ;
249
+ }
250
+ }
251
+ }
252
+ $ ( 'html, body' ) . animate ( { scrollTop : 0 } , 'fast' ) ;
253
+ }
254
+
241
255
// API CALLS
242
256
const CSRF_TOKEN = getCookie ( 'csrftoken' ) ;
243
257
@@ -534,4 +548,17 @@ $( document ).ready(function() {
534
548
$ ( ".aw-main" ) . on ( "input" , ".aw-fs-exists" , function ( ) {
535
549
apiFsExists ( jQuery ( this ) ) ;
536
550
} ) ;
551
+ $ ( document ) . on ( "keyup" , function ( e ) {
552
+ if ( e . keyCode == 16 ) {
553
+ pressed_shift = false ;
554
+ }
555
+ } ) ;
556
+ $ ( document ) . on ( "keydown" , function ( e ) {
557
+ if ( e . keyCode == 16 ) {
558
+ pressed_shift = true ;
559
+ }
560
+ if ( e . keyCode == 83 && pressed_shift === true ) {
561
+ shift_s_handler ( ) ;
562
+ }
563
+ } ) ;
537
564
} ) ;
You can’t perform that action at this time.
0 commit comments