@@ -147,6 +147,8 @@ <h3>Scenarios in the database</h3>
147
147
class ="label btn btn-dark "> Real-time metrics</ a >
148
148
< a id ="note-btn-{{ name }} " data-scenario-name ="{{ name }} " class ="label btn btn-dark "> < i
149
149
class ="fa fa-sticky-note " style ="color: white; "> </ i > </ a >
150
+ < a id ="config-btn-{{ name }} " data-scenario-name ="{{ name }} " class ="label btn btn-dark "> < i
151
+ class ="fa fa-sliders " style ="color: white; "> </ i > </ a >
150
152
{% if status == "running" %}
151
153
< a href ="{{ url_for('nebula_stop_scenario', scenario_name=name, stop_all=False) }} "
152
154
class ="label btn btn-danger "> Stop scenario</ a >
@@ -169,6 +171,12 @@ <h3>Scenarios in the database</h3>
169
171
class ="btn btn-dark mt-2 save-note-btn " style ="float: right; "> Save</ button >
170
172
</ td >
171
173
</ tr >
174
+ < tr id ="config-row-{{ name }} " class ="config-row " style ="display: none; ">
175
+ < td colspan ="4 ">
176
+ < textarea id ="config-text-{{ name }} " class ="form-control " rows ="20 "
177
+ style ="font-size: small; width: 100%; "> </ textarea >
178
+ </ td >
179
+ </ tr >
172
180
{% endfor %}
173
181
</ table >
174
182
</ div >
@@ -238,6 +246,12 @@ <h3>Scenarios in the database</h3>
238
246
saveNotes ( this . dataset . scenarioName ) ;
239
247
} ) ;
240
248
} ) ;
249
+
250
+ document . querySelectorAll ( '[id^=config-btn]' ) . forEach ( button => {
251
+ button . addEventListener ( 'click' , function ( ) {
252
+ toggleConfigRow ( this . dataset . scenarioName ) ;
253
+ } ) ;
254
+ } ) ;
241
255
} ) ;
242
256
243
257
async function toggleNotesRow ( scenarioName ) {
@@ -265,6 +279,31 @@ <h3>Scenarios in the database</h3>
265
279
notesRow . style . display = notesRow . style . display === 'none' ? '' : 'none' ;
266
280
}
267
281
282
+ async function toggleConfigRow ( scenarioName ) {
283
+ const configRow = document . getElementById ( 'config-row-' + scenarioName ) ;
284
+ const configTextElement = document . getElementById ( 'config-text-' + scenarioName ) ;
285
+
286
+ if ( configRow . style . display === 'none' ) {
287
+ try {
288
+ const response = await fetch ( `/nebula/dashboard/${ scenarioName } /config` ) ;
289
+ const data = await response . json ( ) ;
290
+
291
+ console . log ( "[FER] " , data . config )
292
+
293
+ if ( data . status === 'success' ) {
294
+ configTextElement . value = JSON . stringify ( data . config , null , 2 ) ;
295
+ } else {
296
+ configTextElement . value = 'No configuration available.' ;
297
+ }
298
+ } catch ( error ) {
299
+ console . error ( 'Error:' , error ) ;
300
+ alert ( 'An error occurred while retrieving the configuration.' ) ;
301
+ return ;
302
+ }
303
+ }
304
+ configRow . style . display = configRow . style . display === 'none' ? '' : 'none' ;
305
+ }
306
+
268
307
async function saveNotes ( scenarioName ) {
269
308
const notesText = document . getElementById ( 'notes-text-' + scenarioName ) . value ;
270
309
0 commit comments