-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Several Small Fixes #29
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,14 +181,14 @@ function addStageTotals(runGroup) { | |
var run = runGroup.runs[i]; | ||
|
||
if (run.stages && (run.status === 'IN_PROGRESS' || run.status === 'PAUSED_PENDING_INPUT')) { | ||
addCompletionEstimates(run, runGroup.avgDurationMillisNoPause, runGroup.runs.length); | ||
addCompletionEstimates(run, runGroup.avgDurationMillisNoPause, endToEndRuns); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. May avoid factoring incomplete runs into completion estimates. Possible fix for JENKINS-38536 |
||
for (var ii = 0; ii < run.stages.length; ii++) { | ||
var stage = run.stages[ii]; | ||
var stageData = getStageData(stage.name, runGroup); | ||
|
||
if (stage.percentCompleteEstimate === undefined) { | ||
if (stage.status === 'IN_PROGRESS' || stage.status === 'PAUSED_PENDING_INPUT') { | ||
addCompletionEstimates(stage, stageData.avgDurationMillisNoPause, runGroup.runs.length); | ||
addCompletionEstimates(stage, stageData.avgDurationMillisNoPause, endToEndRuns); | ||
} | ||
} | ||
} | ||
|
@@ -225,7 +225,7 @@ function addEndTimes(jobRunsData) { | |
time.setEndTime(run); | ||
if (run.stages) { | ||
for (var ii = 0; ii < run.stages.length; ii++) { | ||
time.setEndTime(run.stages[ii]); | ||
time.setEndTime(run.stages[ii]); | ||
} | ||
} | ||
} | ||
|
@@ -238,8 +238,8 @@ function addEndTimes(jobRunsData) { | |
* (i.e. a run, a runGroup or a stage). | ||
*/ | ||
function addCompletionEstimates(timedObject, avgDurationMillis, averagedOver) { | ||
if (averagedOver === 0) { | ||
// If no runs have completed yet, then we can't make an estimate, so just mark it at 50%. | ||
if (averagedOver === 0 || !(avgDurationMillis > 0)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Duration > 0 covers NaN and undefined + other weird cases. |
||
// If no runs have completed yet, then we can't make an estimate, so just mark it undefined | ||
timedObject.percentCompleteEstimate = 50; | ||
} else { | ||
timedObject.percentCompleteEstimate = (timedObject.durationMillisNoPause / avgDurationMillis * 100); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,10 @@ var jqProxy = require('../../jQuery'); | |
var formatters = require('../../util/formatters'); | ||
var moment = require('moment'); | ||
|
||
// Fix date formatting - set moment locale to UTC to match normal display | ||
// Needs to get the Jenkins locale here, probably from jelly | ||
// Moment._locale | ||
|
||
/** | ||
* Templating support. | ||
*/ | ||
|
@@ -87,6 +91,10 @@ registerHBSHelper('formatDate', function (date, toFormat) { | |
return date; | ||
} | ||
|
||
if (myTimeZoneOffset) { // Do time zone conversion using parseData *sigh.* | ||
//moment.locale(myTimeZone); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's where we'd inject custom formatting using Jenkins host timeZoneOffset. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moment.js does have time zone offset options, though they require offset in a particular format and are a little finnicky on parsing. |
||
} | ||
|
||
var aliasFormat = formatAliases[toFormat]; | ||
if (aliasFormat) { | ||
return moment(date).format(aliasFormat); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,16 +21,18 @@ | |
<tr class="totals"> | ||
<td class="stage-start"><div class="cell-color"> | ||
Average stage times:<br /> | ||
{{#if avgDurationMillisNoPause}} | ||
{{#ifCond avgDurationMillisNoPause '>' 0 }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Covers NaN, undefined, etc. |
||
(Average <span style="text-decoration: underline;" title="builds that run all stages">full</span> run time: ~{{formatTime avgDurationMillisNoPause 2}}) | ||
{{else}} | ||
| ||
{{/if}} | ||
{{/ifCond}} | ||
</div></td> | ||
{{#each stageData}} | ||
<td class="stage-total-{{@index}}"> | ||
<div class="cell-color"> | ||
<div class="duration">{{formatTime avgDurationMillisNoPause 2}}</div> | ||
{{#ifCond avgDurationMillisNoPause '>' 0}} | ||
<div class="duration">{{formatTime avgDurationMillisNoPause 2}}</div> | ||
{{/ifCond}} | ||
<div class="stackedBarChart"></div> | ||
</div> | ||
</td> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is used to inject DST-corrected offset for the Jenkins host into the front-end (added in a small script fragment inserted into the placeholder Jelly for stage view).