@@ -286,6 +286,48 @@ $(document).ready(() => {
286286 }
287287 } ) ;
288288
289+ $ ( '.js-toggle-update-queue-meta' ) . on ( 'click' , function ( ) {
290+ const updateMetaText = $ ( '.js-toggle-update-queue-meta' ) . text ( ) ;
291+ const shouldNotHide = updateMetaText === 'Update' ;
292+ const newUpdateMetaText = shouldNotHide ? 'Cancel' : 'Update' ;
293+ $ ( '.meta-config-editor' ) . toggleClass ( 'hide' , ! shouldNotHide ) ;
294+ $ ( '.js-toggle-update-queue-meta' ) . text ( newUpdateMetaText ) ;
295+ } ) ;
296+
297+ $ ( '.js-update-queue-meta' ) . on ( 'click' , function ( ) {
298+ const { queueHost, queueName} = window . arenaInitialPayload ;
299+ const concurrency = $ ( 'input.js-update-meta-concurrency' ) . val ( ) || null ;
300+ const max = $ ( 'input.js-update-meta-rl-max' ) . val ( ) || null ;
301+ const duration = $ ( 'input.js-update-meta-rl-duration' ) . val ( ) || null ;
302+
303+ const stringifiedData = JSON . stringify ( {
304+ concurrency : concurrency ? parseInt ( concurrency , 10 ) : null ,
305+ max : max ? parseInt ( max , 10 ) : null ,
306+ duration : duration ? parseInt ( duration , 10 ) : null ,
307+ } ) ;
308+
309+ const response = window . confirm (
310+ `Are you sure you want to update the queue "${ queueHost } /${ queueName } " configuration?`
311+ ) ;
312+ if ( response ) {
313+ $ . ajax ( {
314+ url : `${ basePath } /api/queue/${ encodeURIComponent (
315+ queueHost
316+ ) } /${ encodeURIComponent ( queueName ) } /update-meta`,
317+ type : 'PUT' ,
318+ data : stringifiedData ,
319+ contentType : 'application/json' ,
320+ } )
321+ . done ( ( ) => {
322+ window . location . reload ( ) ;
323+ } )
324+ . fail ( ( jqXHR ) => {
325+ window . alert ( `Request failed, check console for error.` ) ;
326+ console . error ( jqXHR . responseText ) ;
327+ } ) ;
328+ }
329+ } ) ;
330+
289331 $ ( '.js-toggle-add-flow-editor' ) . on ( 'click' , function ( ) {
290332 const addFlowText = $ ( '.js-toggle-add-flow-editor' ) . text ( ) ;
291333 const shouldNotHide = addFlowText === 'Add Flow' ;
0 commit comments