@@ -203,39 +203,59 @@ export class CommandBox {
203203 button . disabled = true ;
204204 output . innerText = "loading..." ;
205205
206- const screenModifyingCommands = [
207- "beacons.add" ,
208- "beacons.delete" ,
209- "beacons.delete" ,
210- "beacons.disable" ,
211- "beacons.disable_beacon" ,
212- "beacons.enable" ,
213- "beacons.enable_beacon" ,
214- "beacons.modify" ,
215- "beacons.reset" ,
216- "grains.append" ,
217- "grains.delkey" ,
218- "grains.delval" ,
219- "grains.setval" ,
220- "ps.kill_pid" ,
221- "saltutil.kill_job" ,
222- "saltutil.refresh_grains" ,
223- "saltutil.refresh_pillar" ,
224- "saltutil.signal_job" ,
225- "saltutil.term_job" ,
226- "schedule.add" ,
227- "schedule.delete" ,
228- "schedule.disable" ,
229- "schedule.disable_job" ,
230- "schedule.enable" ,
231- "schedule.enable_job" ,
232- "schedule.modify" ,
233- "schedule.run_job"
234- ] ;
206+ const screenModifyingCommands = {
207+ "beacons.add" : [ "beacons" , "beacons-minion" ] ,
208+ "beacons.delete" : [ "beacons" , "beacons-minion" ] ,
209+ "beacons.disable" : [ "beacons" , "beacons-minion" ] ,
210+ "beacons.disable_beacon" : [ "beacons-minion" ] ,
211+ "beacons.enable" : [ "beacons" , "beacons-minion" ] ,
212+ "beacons.enable_beacon" : [ "beacons-minion" ] ,
213+ "beacons.modify" : [ "beacons-minion" ] ,
214+ "beacons.reset" : [ "beacons" , "beacons-minion" ] ,
215+ "grains.append" : [ "minions" , "grains" , "grains-minion" ] ,
216+ "grains.delkey" : [ "minions" , "grains" , "grains-minion" ] ,
217+ "grains.delval" : [ "minions" , "grains" , "grains-minion" ] ,
218+ "grains.setval" : [ "minions" , "grains" , "grains-minion" ] ,
219+ "ps.kill_pid" : [ "job" , "jobs" ] ,
220+ "saltutil.kill_job" : [ "job" , "jobs" ] ,
221+ "saltutil.refresh_grains" : [ "minions" , "grains" , "grains-minion" ] ,
222+ "saltutil.refresh_pillar" : [ "pillars" , "pillars-minion" ] ,
223+ "saltutil.signal_job" : [ "job" , "jobs" ] ,
224+ "saltutil.term_job" : [ "job" , "jobs" ] ,
225+ "schedule.add" : [ "schedules" , "schedules-minion" ] ,
226+ "schedule.delete" : [ "schedules" , "schedules-minion" ] ,
227+ "schedule.disable" : [ "schedules" , "schedules-minion" ] ,
228+ "schedule.disable_job" : [ "schedules-minion" ] ,
229+ "schedule.enable" : [ "schedules" , "schedules-minion" ] ,
230+ "schedule.enable_job" : [ "schedules-minion" ] ,
231+ "schedule.modify" : [ "schedules" , "schedules-minion" ] ,
232+ "schedule.run_job" : [ "*" ]
233+ } ;
235234 // test whether the command may have caused an update to the list
236235 const command = commandValue . split ( " " ) [ 0 ] ;
237- if ( screenModifyingCommands . includes ( command ) ) {
238- CommandBox . refreshOnClose = true ;
236+ if ( command in screenModifyingCommands ) {
237+ // update panel when it may have changed
238+ for ( const panel of Router . currentPage . panels ) {
239+ if ( screenModifyingCommands [ command ] . includes ( panel . key ) ) {
240+ // the command may have changed a specific panel
241+ panel . needsRefresh = true ;
242+ } else if ( screenModifyingCommands [ command ] . includes ( "*" ) ) {
243+ // the command may have changed any panel
244+ panel . needsRefresh = true ;
245+ }
246+ }
247+ }
248+ // update panels that show job-statusses
249+ for ( const panel of Router . currentPage . panels ) {
250+ if ( panel . key !== "job" && panel . key !== "jobs" ) {
251+ // panel does not show jobs (or a job)
252+ } else if ( command . startsWith ( "wheel." ) ) {
253+ // wheel commands do not end up in the jobs list
254+ } else if ( command . startsWith ( "runners." ) ) {
255+ // runners commands do not end up in the jobs list
256+ } else {
257+ panel . needsRefresh = true ;
258+ }
239259 }
240260
241261 func . then ( ( pResponse ) => {
@@ -276,7 +296,6 @@ export class CommandBox {
276296
277297 const outputField = document . querySelector ( ".run-command pre" ) ;
278298 outputField . innerText = "Waiting for command..." ;
279- CommandBox . refreshOnClose = false ;
280299
281300 const targetField = document . getElementById ( "target" ) ;
282301 TargetType . autoSelectTargetType ( targetField . value ) ;
@@ -349,10 +368,7 @@ export class CommandBox {
349368 RunType . setRunTypeDefault ( ) ;
350369 TargetType . setTargetTypeDefault ( ) ;
351370
352- if ( CommandBox . refreshOnClose ) {
353- Router . currentPage . clearPage ( ) ;
354- Router . currentPage . onShow ( ) ;
355- }
371+ Router . currentPage . refreshPage ( ) ;
356372
357373 pEvent . stopPropagation ( ) ;
358374 }
0 commit comments