@@ -19,6 +19,7 @@ export class JobPanel extends Panel {
1919 }
2020 this . addPanelMenu ( ) ;
2121 this . addSearchButton ( ) ;
22+ this . addPlayPauseButton ( ) ;
2223
2324 // 1: re-run with original target pattern
2425 this . _addPanelMenuItemJobRerunJob ( ) ;
@@ -57,6 +58,31 @@ export class JobPanel extends Panel {
5758 this . div . append ( this . output ) ;
5859 }
5960
61+ updateFooter ( ) {
62+ // PlayPause uses this as call-back
63+ if ( this . playOrPause === "play" || this . playOrPause === "pause" ) {
64+ // store the user preference for next time
65+ Utils . setStorageItem ( "local" , "jobrefresh" , this . playOrPause ) ;
66+ }
67+ }
68+
69+ _scheduleRefreshJob ( ) {
70+ const jobsActiveSpan = document . getElementById ( "summary-jobs-active" ) ;
71+ if ( jobsActiveSpan && jobsActiveSpan . innerText === "done" ) {
72+ // no updates after "done"
73+ this . setPlayPauseButton ( "none" ) ;
74+ return ;
75+ }
76+
77+ window . setTimeout ( ( ) => {
78+ if ( this . playOrPause === "play" ) {
79+ this . onShow ( ) ;
80+ } else {
81+ this . _scheduleRefreshJob ( ) ;
82+ }
83+ } , 5000 ) ;
84+ }
85+
6086 onShow ( ) {
6187 const jobId = decodeURIComponent ( Utils . getQueryParam ( "id" ) ) ;
6288 const minionId = decodeURIComponent ( Utils . getQueryParam ( "minionid" ) ) ;
@@ -70,17 +96,26 @@ export class JobPanel extends Panel {
7096 this . _handleJobRunnerJobsListJob ( pRunnerJobsListJobData , jobId , minionId ) ;
7197 runnerJobsActivePromise . then ( ( pRunnerJobsActiveData ) => {
7298 this . _handleRunnerJobsActive ( jobId , pRunnerJobsActiveData ) ;
99+ this . _scheduleRefreshJob ( ) ;
73100 return true ;
74101 } , ( pRunnerJobsActiveMsg ) => {
75102 this . _handleRunnerJobsActive ( jobId , JSON . stringify ( pRunnerJobsActiveMsg ) ) ;
103+ this . setPlayPauseButton ( "none" ) ;
76104 return false ;
77105 } ) ;
78106 return true ;
79107 } , ( pRunnerJobsListJobsMsg ) => {
80108 this . _handleJobRunnerJobsListJob ( JSON . stringify ( pRunnerJobsListJobsMsg ) , jobId , undefined ) ;
81109 Utils . ignorePromise ( runnerJobsActivePromise ) ;
110+ this . setPlayPauseButton ( "none" ) ;
82111 return false ;
83112 } ) ;
113+
114+ let jobRefresh = Utils . getStorageItem ( "local" , "jobrefresh" , "pause" ) ;
115+ if ( jobRefresh !== "play" && jobRefresh !== "pause" ) {
116+ jobRefresh = "pause" ;
117+ }
118+ this . setPlayPauseButton ( jobRefresh ) ;
84119 }
85120
86121 static _isResultOk ( result ) {
@@ -488,6 +523,7 @@ export class JobPanel extends Panel {
488523 if ( typeof pData !== "object" ) {
489524 summaryJobsActiveSpan . innerText = "(error)" ;
490525 Utils . addToolTip ( summaryJobsActiveSpan , pData , "bottom-left" ) ;
526+ this . setPlayPauseButton ( "none" ) ;
491527 return ;
492528 }
493529
@@ -497,6 +533,7 @@ export class JobPanel extends Panel {
497533 if ( ! info ) {
498534 summaryJobsActiveSpan . innerText = "done" ;
499535 this . jobIsTerminated = true ;
536+ this . setPlayPauseButton ( "none" ) ;
500537 return ;
501538 }
502539 this . jobIsTerminated = false ;
@@ -525,7 +562,7 @@ export class JobPanel extends Panel {
525562 // show that this minion is still active on the request
526563 noResponseSpan . innerText = "(active) " ;
527564
528- const menu = new DropDownMenu ( noResponseSpan , true ) ;
565+ const menu = new DropDownMenu ( noResponseSpan , "verysmall" ) ;
529566 menu . addMenuItem ( "Show process info..." , ( ) => {
530567 const cmdArr = [ "ps.proc_info" , pid ] ;
531568 this . runCommand ( "" , minionId , cmdArr ) ;
0 commit comments