11<!DOCTYPE html>
22< html lang ="en ">
3+ <!-- Head -->
4+ < head >
5+ < title > Config Utilities Dynamic Configs</ title >
6+ < link
7+ rel ="stylesheet "
8+ href ="{{ url_for('static', filename='css/style.css') }} "
9+ />
10+ </ head >
311
4- <!-- Head -->
12+ <!-- Scripts -->
13+ < script src ="{{ url_for('static', filename='js/config_table.js') }} "> </ script >
14+ < script src ="{{ url_for('static', filename='js/build_fields.js') }} "> </ script >
15+ < script src ="{{ url_for('static', filename='js/selection_panes.js') }} "> </ script >
16+ < script src ="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js "> </ script >
17+ < script >
18+ // Reload the page when the AJAX request is complete.
19+ $ ( document ) . ajaxStop ( function ( ) {
20+ window . location . reload ( false ) ;
21+ } ) ;
22+ // Send post requests via Ctrl+Enter
23+ document . addEventListener ( "keydown" , function ( event ) {
24+ if ( event . ctrlKey && event . key === "Enter" ) {
25+ post ( "/submit" , readConfigData ( ) ) ;
26+ }
27+ } ) ;
28+ </ script >
529
6- < head >
7- < title > Config Utilities Dynamic Configs</ title >
8- < link rel ="stylesheet " href ="{{ url_for('static', filename='css/style.css') }} ">
9- </ head >
30+ <!-- Body -->
1031
11- <!-- Scripts -->
12- < script src ="{{ url_for('static', filename='js/config_table.js') }} "> </ script >
13- < script src ="{{ url_for('static', filename='js/build_fields.js') }} "> </ script >
14- < script src ="{{ url_for('static', filename='js/selection_panes.js') }} "> </ script >
15- < script src ="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js "> </ script >
16- < script >
17- // Reload the page when the AJAX request is complete.
18- $ ( document ) . ajaxStop ( function ( ) {
19- window . location . reload ( false ) ;
20- } ) ;
21- </ script >
32+ < body >
33+ < header >
34+ < h1 > Config Utilities Dynamic Config GUI</ h1 >
35+ </ header >
2236
23- <!-- Body -->
37+ <!-- The config -->
38+ {% if config_name %}
39+ < div class ="config-pane ">
40+ < table id ="config-table " class ="config-table ">
41+ < tr >
42+ < th > {{ config_name }}</ th >
43+ < th > Value</ th >
44+ < th > Default</ th >
45+ </ tr >
46+ < script >
47+ const configData = { { config_data | tojson } } ;
48+ buildFields ( configData ) ;
49+ </ script >
50+ </ table >
51+ </ div >
52+ {% endif %}
2453
25- < body >
26- < header >
27- < h1 > Config Utilities Dynamic Config GUI</ h1 >
28- </ header >
54+ <!-- Interaction with the config -->
55+ < div class ="config-pane ">
56+ < button
57+ name ="refreshBtn "
58+ class ="config-button "
59+ type ="submit "
60+ onclick ="post('/refresh'); "
61+ >
62+ Refresh
63+ </ button >
64+ < button
65+ name ="submitBtn "
66+ class ="config-button "
67+ type ="submit "
68+ onclick ="post('/submit', readConfigData()); "
69+ >
70+ Submit
71+ </ button >
72+ </ div >
2973
30- <!-- The config -->
31- {% if config_name %}
32- < div class ="config-pane ">
33- < table id ="config-table " class ="config-table ">
34- < tr >
35- < th > {{ config_name }} </ th >
36- < th > Value</ th >
37- < th > Default</ th >
38- </ tr >
74+ <!-- Config Key selection -->
75+ < div class ="config-pane " id ="key-pane ">
76+ < span class ="selection-header "> Config:</ span >
3977 < script >
40- const configData = { { config_data | tojson } } ;
41- buildFields ( configData ) ;
78+ const availableKeys = { { available_keys | tojson } } ;
79+ const activeKey = "{{ active_key }}" ;
80+ buildSelectionPane ( availableKeys , activeKey , 'key-pane' ) ;
4281 </ script >
43- </ table >
44- </ div >
45- {% endif %}
46-
47-
48- <!-- Interaction with the config -->
49- < div class ="config-pane ">
50- < button name ="refreshBtn " class ='config-button ' type ="submit " onclick ="post('/refresh'); "> Refresh</ button >
51- < button name ="submitBtn " class ='config-button ' type ="submit "
52- onclick ="post('/submit', readConfigData()); "> Submit</ button >
53- </ div >
54-
55-
56- <!-- Config Key selection -->
57- < div class ="config-pane " id ="key-pane ">
58- < span class ="selection-header "> Config:</ span >
59- < script >
60- const availableKeys = { { available_keys | tojson } } ;
61- const activeKey = "{{ active_key }}" ;
62- buildSelectionPane ( availableKeys , activeKey , 'key-pane' ) ;
63- </ script >
64- </ div >
82+ </ div >
6583
66- <!-- Config Server selection -->
67- < div class ="config-pane " id ="server-pane ">
68- < span class ="selection-header "> Server:</ span >
69- < script >
70- const availableServers = { { available_servers | tojson } } ;
71- const activeServer = "{{ active_server }}" ;
72- buildSelectionPane ( availableServers , activeServer , 'server-pane' ) ;
73- </ script >
74- </ div >
84+ <!-- Config Server selection -->
85+ < div class ="config-pane " id ="server-pane ">
86+ < span class ="selection-header "> Server:</ span >
87+ < script >
88+ const availableServers = { { available_servers | tojson } } ;
89+ const activeServer = "{{ active_server }}" ;
90+ buildSelectionPane ( availableServers , activeServer , 'server-pane' ) ;
91+ </ script >
92+ </ div >
7593
76- <!-- Error Pane -->
77- {% if error_message %}
78- < div class ="config-pane " id ="error-pane "
79- style ="color: #b71c1c; background: #ffebee; border: 1px solid #b71c1c; padding: 10px; display: block; ">
80- {% for error in error_message %}
81- < div style ="margin-bottom: 0px; margin-top: 0px; ">
82- < span style ="font-size: 1.2em; margin-right: 10px; "> ⚠</ span > {{ error }}
94+ <!-- Error Pane -->
95+ {% if error_message %}
96+ < div
97+ class ="config-pane "
98+ id ="error-pane "
99+ style ="
100+ color: #b71c1c;
101+ background: #ffebee;
102+ border: 1px solid #b71c1c;
103+ padding: 10px;
104+ display: block;
105+ "
106+ >
107+ {% for error in error_message %}
108+ < div style ="margin-bottom: 0px; margin-top: 0px ">
109+ < span style ="font-size: 1.2em; margin-right: 10px "> ⚠</ span > {{
110+ error }}
111+ </ div >
112+ {% endfor %}
83113 </ div >
84- {% endfor %}
85- </ div >
86- {% endif %}
114+ {% endif %}
87115
88- <!-- Warning Pane -->
89- {% if warning_message %}
90- < div class ="config-pane " id ="warning-pane "
91- style ="color: #ff9800; background: #fff3e0; border: 1px solid #ff9800; padding: 10px; display: block; ">
92- {% for warning in warning_message %}
93- < div style ="margin-bottom: 0px; margin-top: 0px; ">
94- < span style ="font-size: 1.2em; margin-right: 10px; "> ⚠</ span > {{ warning }}
116+ <!-- Warning Pane -->
117+ {% if warning_message %}
118+ < div
119+ class ="config-pane "
120+ id ="warning-pane "
121+ style ="
122+ color: #ff9800;
123+ background: #fff3e0;
124+ border: 1px solid #ff9800;
125+ padding: 10px;
126+ display: block;
127+ "
128+ >
129+ {% for warning in warning_message %}
130+ < div style ="margin-bottom: 0px; margin-top: 0px ">
131+ < span style ="font-size: 1.2em; margin-right: 10px "> ⚠</ span > {{
132+ warning }}
133+ </ div >
134+ {% endfor %}
95135 </ div >
96- {% endfor %}
97- </ div >
98- {% endif %}
136+ {% endif %}
99137
100- <!-- Message Pane -->
101- {% if message %}
102- < div class ="config-pane " id ="message-pane ">
103- < div class ="selection-header " display ="block "> Messages:</ div >
104- < span id ="message-text "> {{ message }}</ span >
105- </ div >
106- {% endif %}
107- </ body >
138+ <!-- Message Pane -->
139+ {% if message %}
140+ < div class ="config-pane " id ="message-pane ">
141+ < div class ="selection-header " display ="block "> Messages:</ div >
142+ < span id ="message-text "> {{ message }}</ span >
143+ </ div >
144+ {% endif %}
145+ </ body >
146+ </ html >
0 commit comments