From bded5e96514690367019a105af83cd240070d5df Mon Sep 17 00:00:00 2001 From: Markus Birth Date: Sun, 30 Oct 2022 20:05:46 +0100 Subject: [PATCH] Show current step for active jobs --- assets/custom.css | 4 ++++ assets/main.js | 15 +++++++++++++-- index.html | 1 + 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/assets/custom.css b/assets/custom.css index 991fe89..ccfc72b 100755 --- a/assets/custom.css +++ b/assets/custom.css @@ -6,6 +6,10 @@ padding: 8px 12px; } +.current-step { + font-size: 0.8em; +} + tr.state5 { color: #00c; } diff --git a/assets/main.js b/assets/main.js index 79e6236..320d692 100755 --- a/assets/main.js +++ b/assets/main.js @@ -128,6 +128,7 @@ class JobRow extends React.Component created_time: '--:--:--', state_numeric: -1, state: '---', + current_step: '', percent: 0 }; } @@ -176,9 +177,11 @@ class JobRow extends React.Component cur.state_numeric = data.state; cur.state = this.job_states[data.state]; + cur.current_step = ''; // calculate percentage var num_steps = 0; + var steps_done = 0; var overall_percent = 0; for (var step in data.job_steps.job_step) { if (!data.job_steps.job_step.hasOwnProperty(step)) { @@ -189,9 +192,17 @@ class JobRow extends React.Component num_steps++; if (this_step.state == 10) { overall_percent += 100; + steps_done++; } else { overall_percent += parseInt(this_step.percent); } + if (this_step.state == 5) { + cur.current_step = '↪ ' + step; + } + } + if (cur.current_step.length > 0) { + // only add step-total if there was info created in the lines above + cur.current_step += ' (' + (steps_done+1) + '/' + num_steps + ')'; } cur.percent = Math.floor( overall_percent / num_steps ); //console.log('calculated: %o', cur.percent); @@ -223,8 +234,8 @@ class JobRow extends React.Component } return React.createElement('tr', { className: 'state'+this.state.state_numeric }, React.createElement('td', null, this.state.jobId), - React.createElement('td', null, this.state.name), - React.createElement('td', { style: { textAlign: 'center', verticalAlign: 'middle' } }, date_str + this.state.created_time), + React.createElement('td', null, this.state.name, React.createElement('div', { className: 'current-step' }, this.state.current_step)), + React.createElement('td', { style: { textAlign: 'center', verticalAlign: 'middle', whiteSpace: 'nowrap' } }, date_str + this.state.created_time), React.createElement('td', { style: { verticalAlign: 'middle' } }, React.createElement('span', { className: 'uk-label state'+this.state.state_numeric }, this.state.state) ), diff --git a/index.html b/index.html index 82c7689..67cfb6a 100755 --- a/index.html +++ b/index.html @@ -1,6 +1,7 @@ + AREMA JobMonitor