Skip to content

Commit

Permalink
feat(job-details): show raw progress when not numeric
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielCastro authored and Eli Skeggs committed Aug 5, 2020
1 parent 63ca0c8 commit bd0d697
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
4 changes: 4 additions & 0 deletions src/server/views/helpers/handlebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ const helpers = {
return new Handlebars.SafeString(JSON.stringify(...args));
},

isNumber(operand) {
return parseInt(operand, 10).toString() === String(operand);
},

adjustedPage(currentPage, pageSize, newPageSize) {
const firstId = (currentPage - 1) * pageSize;
return _.ceil(firstId / newPageSize) + 1;
Expand Down
28 changes: 16 additions & 12 deletions src/server/views/partials/dashboard/jobDetails.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,23 @@

{{#unless this.queue.IS_BEE}}
<h5>Progress</h5>
<div class="progress">
<div class="progress-bar
{{#eq jobState 'failed'}}
progress-bar-danger
{{/eq}}"
role="progressbar"
aria-valuenow="{{ this._progress }}"
aria-valuemin="0"
aria-valuemax="100"
style="width: {{ this._progress }}%; min-width: 2em;">
{{ this._progress }}%
{{#if (isNumber this._progress)}}
<div class="progress">
<div class="progress-bar
{{#eq jobState 'failed'}}
progress-bar-danger
{{/eq}}"
role="progressbar"
aria-valuenow="{{ this._progress }}"
aria-valuemin="0"
aria-valuemax="100"
style="width: {{ this._progress }}%; min-width: 2em;">
{{ this._progress }}%
</div>
</div>
</div>
{{else}}
<pre>{{json this._progress true}}</pre>
{{/if}}
{{/unless}}

{{#if this.returnvalue}}
Expand Down

0 comments on commit bd0d697

Please sign in to comment.