Archived
1
0

Show current step for active jobs

This commit is contained in:
2022-10-30 20:05:46 +01:00
parent cb52a5899e
commit bded5e9651
3 changed files with 18 additions and 2 deletions
+4
View File
@@ -6,6 +6,10 @@
padding: 8px 12px; padding: 8px 12px;
} }
.current-step {
font-size: 0.8em;
}
tr.state5 { tr.state5 {
color: #00c; color: #00c;
} }
+13 -2
View File
@@ -128,6 +128,7 @@ class JobRow extends React.Component
created_time: '--:--:--', created_time: '--:--:--',
state_numeric: -1, state_numeric: -1,
state: '---', state: '---',
current_step: '',
percent: 0 percent: 0
}; };
} }
@@ -176,9 +177,11 @@ class JobRow extends React.Component
cur.state_numeric = data.state; cur.state_numeric = data.state;
cur.state = this.job_states[data.state]; cur.state = this.job_states[data.state];
cur.current_step = '';
// calculate percentage // calculate percentage
var num_steps = 0; var num_steps = 0;
var steps_done = 0;
var overall_percent = 0; var overall_percent = 0;
for (var step in data.job_steps.job_step) { for (var step in data.job_steps.job_step) {
if (!data.job_steps.job_step.hasOwnProperty(step)) { if (!data.job_steps.job_step.hasOwnProperty(step)) {
@@ -189,9 +192,17 @@ class JobRow extends React.Component
num_steps++; num_steps++;
if (this_step.state == 10) { if (this_step.state == 10) {
overall_percent += 100; overall_percent += 100;
steps_done++;
} else { } else {
overall_percent += parseInt(this_step.percent); 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 ); cur.percent = Math.floor( overall_percent / num_steps );
//console.log('calculated: %o', cur.percent); //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 }, return React.createElement('tr', { className: 'state'+this.state.state_numeric },
React.createElement('td', null, this.state.jobId), React.createElement('td', null, this.state.jobId),
React.createElement('td', null, this.state.name), 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' } }, date_str + this.state.created_time), React.createElement('td', { style: { textAlign: 'center', verticalAlign: 'middle', whiteSpace: 'nowrap' } }, date_str + this.state.created_time),
React.createElement('td', { style: { verticalAlign: 'middle' } }, React.createElement('td', { style: { verticalAlign: 'middle' } },
React.createElement('span', { className: 'uk-label state'+this.state.state_numeric }, this.state.state) React.createElement('span', { className: 'uk-label state'+this.state.state_numeric }, this.state.state)
), ),
+1
View File
@@ -1,6 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8" />
<title>AREMA JobMonitor</title> <title>AREMA JobMonitor</title>
<script src="reactjs/react.production.min.js" type="text/javascript"></script> <script src="reactjs/react.production.min.js" type="text/javascript"></script>
<script src="reactjs/react-dom.production.min.js" type="text/javascript"></script> <script src="reactjs/react-dom.production.min.js" type="text/javascript"></script>