Skip to content

Commit eeb4ffa

Browse files
committed
Show build status message when it exists
Implements https://trello.com/c/Of6LXNUi
1 parent 4fd08fe commit eeb4ffa

File tree

7 files changed

+49
-15
lines changed

7 files changed

+49
-15
lines changed

app/scripts/filters/date.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ angular.module('openshiftConsole')
1010
timestampRhs = timestampRhs || new Date(); // moment expects either an ISO format string or a Date object
1111

1212
var ms = moment(timestampRhs).diff(timestampLhs);
13+
if (ms < 0) {
14+
// Don't show negative durations
15+
ms = 0;
16+
}
1317
var duration = moment.duration(ms);
1418
// the out of the box humanize in moment.js rounds to the nearest time unit
1519
// but we need more details
@@ -30,7 +34,7 @@ angular.module('openshiftConsole')
3034
if (omitSingle) {
3135
humanizedDuration.push(singularText);
3236
} else {
33-
humanizedDuration.push("one " + singularText);
37+
humanizedDuration.push("1 " + singularText);
3438
}
3539

3640
return;
@@ -54,7 +58,7 @@ angular.module('openshiftConsole')
5458
return "minute";
5559
}
5660

57-
return "one minute";
61+
return "1 minute";
5862
}
5963

6064
if (humanizedDuration.length === 0) {

app/views/browse/_build-details.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ <h3>Status</h3>
66
<dt>Status:</dt>
77
<dd>
88
<status-icon status="build.status.phase"></status-icon>
9-
{{build.status.phase}}
9+
<span ng-if="!build.status.message || build.status.phase === 'Cancelled'">{{build.status.phase}}</span>
10+
<span ng-if="build.status.message && build.status.phase !== 'Cancelled'">{{build.status.message}}</span>
1011
<span ng-if="build | jenkinsLogURL">
1112
<span class="text-muted">&ndash;</span>
1213
<a ng-href="{{build | jenkinsLogURL}}" target="_blank">View Log</a>

app/views/browse/build-config.html

+8-2
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ <h2>No builds.</h2>
181181
<tr>
182182
<th>Build</th>
183183
<th>Status</th>
184+
<th>Duration</th>
184185
<th>Created</th>
185186
</tr>
186187
</thead>
@@ -197,13 +198,18 @@ <h2>No builds.</h2>
197198
<span ng-if="!(build | annotation : 'buildNumber')">
198199
<a ng-href="{{build | navigateResourceURL}}">{{build.metadata.name}}</a>
199200
</span>
200-
<span ng-if="build.status.message" class="pficon pficon-warning-triangle-o" style="cursor: help;" data-toggle="popover" data-trigger="hover" dynamic-content="{{build.status.message}}"></span>
201201
</td>
202202
<td data-title="Status">
203203
<div row class="status">
204-
<build-status build="build"></build-status>
204+
<status-icon status="build.status.phase" disable-animation fixed-width="true"></status-icon>
205+
<span ng-if="build.status.phase ==='Failed'">{{(build.status.reason || build.status.phase) | sentenceCase}}</span>
206+
<span ng-if="build.status.phase !== 'Failed'">{{build.status.phase | sentenceCase}}</span>
205207
</div>
206208
</td>
209+
<td data-title="Duration">
210+
<duration-until-now ng-if="build.status.startTimestamp && !build.status.completionTimestamp" timestamp="build.status.startTimestamp" time-only></duration-until-now>
211+
<span ng-if="build.status.startTimestamp && build.status.completionTimestamp">{{build.status.startTimestamp | duration : build.status.completionTimestamp}}</span>
212+
</td>
207213
<td data-title="Created">
208214
<span am-time-ago="build.metadata.creationTimestamp"></span>
209215
</td>

app/views/browse/build.html

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
<div ng-if="build">
1313
<h1>
1414
{{build.metadata.name}}
15-
<span ng-if="build.status.message" class="pficon pficon-warning-triangle-o" style="cursor: help;" data-toggle="popover" data-trigger="hover" dynamic-content="{{build.status.message}}"></span>
1615
<span class="pficon pficon-warning-triangle-o"
1716
ng-if="buildConfigPaused || buildConfigDeleted"
1817
aria-hidden="true"

app/views/builds.html

+9-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ <h1>Builds</h1>
2727
<th>Name</th>
2828
<th>Last Build</th>
2929
<th>Status</th>
30+
<th>Duration</th>
3031
<th>Created</th>
3132
<th>Type</th>
3233
<th>Source</th>
@@ -74,9 +75,16 @@ <h1>Builds</h1>
7475
</td>
7576
<td data-title="Status">
7677
<div row class="status">
77-
<build-status build="latestBuild"></build-status>
78+
<!-- <build-status build="build"></build-status> -->
79+
<status-icon status="latestBuild.status.phase" disable-animation fixed-width="true"></status-icon>
80+
<span ng-if="latestBuild.status.phase ==='Failed'">{{(latestBuild.status.reason || latestBuild.status.phase) | sentenceCase}}</span>
81+
<span ng-if="latestBuild.status.phase !== 'Failed'">{{latestBuild.status.phase | sentenceCase}}</span>
7882
</div>
7983
</td>
84+
<td data-title="Duration">
85+
<duration-until-now ng-if="latestBuild.status.startTimestamp && !latestBuild.status.completionTimestamp" timestamp="latestBuild.status.startTimestamp" time-only></duration-until-now>
86+
<span ng-if="latestBuild.status.startTimestamp && latestBuild.status.completionTimestamp">{{latestBuild.status.startTimestamp | duration : latestBuild.status.completionTimestamp}}</span>
87+
</td>
8088
<td data-title="Created">
8189
<span am-time-ago="latestBuild.metadata.creationTimestamp"></span>
8290
</td>

dist/scripts/scripts.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -12898,12 +12898,14 @@ return a;
1289812898
}), angular.module("openshiftConsole").filter("duration", function() {
1289912899
return function(a, b, c, d) {
1290012900
function e(a, b, d) {
12901-
if (0 !== a) return 1 === a ? void (c ? h.push(b) :h.push("one " + b)) :void h.push(a + " " + d);
12901+
if (0 !== a) return 1 === a ? void (c ? h.push(b) :h.push("1 " + b)) :void h.push(a + " " + d);
1290212902
}
1290312903
if (!a) return a;
1290412904
d = d || 2, b = b || new Date();
12905-
var f = moment(b).diff(a), g = moment.duration(f), h = [], i = g.years(), j = g.months(), k = g.days(), l = g.hours(), m = g.minutes(), n = g.seconds();
12906-
return e(i, "year", "years"), e(j, "month", "months"), e(k, "day", "days"), e(l, "hour", "hours"), e(m, "minute", "minutes"), e(n, "second", "seconds"), 1 === h.length && n && 1 === d ? c ? "minute" :"one minute" :(0 === h.length && h.push("0 seconds"), h.length > d && (h.length = d), h.join(", "));
12905+
var f = moment(b).diff(a);
12906+
f < 0 && (f = 0);
12907+
var g = moment.duration(f), h = [], i = g.years(), j = g.months(), k = g.days(), l = g.hours(), m = g.minutes(), n = g.seconds();
12908+
return e(i, "year", "years"), e(j, "month", "months"), e(k, "day", "days"), e(l, "hour", "hours"), e(m, "minute", "minutes"), e(n, "second", "seconds"), 1 === h.length && n && 1 === d ? c ? "minute" :"1 minute" :(0 === h.length && h.push("0 seconds"), h.length > d && (h.length = d), h.join(", "));
1290712909
};
1290812910
}).filter("ageLessThan", function() {
1290912911
return function(a, b, c) {

dist/scripts/templates.js

+19-5
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,8 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
12471247
"<dt>Status:</dt>\n" +
12481248
"<dd>\n" +
12491249
"<status-icon status=\"build.status.phase\"></status-icon>\n" +
1250-
"{{build.status.phase}}\n" +
1250+
"<span ng-if=\"!build.status.message || build.status.phase === 'Cancelled'\">{{build.status.phase}}</span>\n" +
1251+
"<span ng-if=\"build.status.message && build.status.phase !== 'Cancelled'\">{{build.status.message}}</span>\n" +
12511252
"<span ng-if=\"build | jenkinsLogURL\">\n" +
12521253
"<span class=\"text-muted\">&ndash;</span>\n" +
12531254
"<a ng-href=\"{{build | jenkinsLogURL}}\" target=\"_blank\">View Log</a>\n" +
@@ -1861,6 +1862,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
18611862
"<tr>\n" +
18621863
"<th>Build</th>\n" +
18631864
"<th>Status</th>\n" +
1865+
"<th>Duration</th>\n" +
18641866
"<th>Created</th>\n" +
18651867
"</tr>\n" +
18661868
"</thead>\n" +
@@ -1877,13 +1879,18 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
18771879
"<span ng-if=\"!(build | annotation : 'buildNumber')\">\n" +
18781880
"<a ng-href=\"{{build | navigateResourceURL}}\">{{build.metadata.name}}</a>\n" +
18791881
"</span>\n" +
1880-
"<span ng-if=\"build.status.message\" class=\"pficon pficon-warning-triangle-o\" style=\"cursor: help\" data-toggle=\"popover\" data-trigger=\"hover\" dynamic-content=\"{{build.status.message}}\"></span>\n" +
18811882
"</td>\n" +
18821883
"<td data-title=\"Status\">\n" +
18831884
"<div row class=\"status\">\n" +
1884-
"<build-status build=\"build\"></build-status>\n" +
1885+
"<status-icon status=\"build.status.phase\" disable-animation fixed-width=\"true\"></status-icon>\n" +
1886+
"<span ng-if=\"build.status.phase ==='Failed'\">{{(build.status.reason || build.status.phase) | sentenceCase}}</span>\n" +
1887+
"<span ng-if=\"build.status.phase !== 'Failed'\">{{build.status.phase | sentenceCase}}</span>\n" +
18851888
"</div>\n" +
18861889
"</td>\n" +
1890+
"<td data-title=\"Duration\">\n" +
1891+
"<duration-until-now ng-if=\"build.status.startTimestamp && !build.status.completionTimestamp\" timestamp=\"build.status.startTimestamp\" time-only></duration-until-now>\n" +
1892+
"<span ng-if=\"build.status.startTimestamp && build.status.completionTimestamp\">{{build.status.startTimestamp | duration : build.status.completionTimestamp}}</span>\n" +
1893+
"</td>\n" +
18871894
"<td data-title=\"Created\">\n" +
18881895
"<span am-time-ago=\"build.metadata.creationTimestamp\"></span>\n" +
18891896
"</td>\n" +
@@ -2136,7 +2143,6 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
21362143
"<div ng-if=\"build\">\n" +
21372144
"<h1>\n" +
21382145
"{{build.metadata.name}}\n" +
2139-
"<span ng-if=\"build.status.message\" class=\"pficon pficon-warning-triangle-o\" style=\"cursor: help\" data-toggle=\"popover\" data-trigger=\"hover\" dynamic-content=\"{{build.status.message}}\"></span>\n" +
21402146
"<span class=\"pficon pficon-warning-triangle-o\" ng-if=\"buildConfigPaused || buildConfigDeleted\" aria-hidden=\"true\" data-toggle=\"tooltip\" data-original-title=\"{{buildConfigDeleted ? 'The build configuration for this build no longer exists.' : 'Building from build configuration ' + buildConfig.metadata.name + ' has been paused.'}}\">\n" +
21412147
"</span>\n" +
21422148
"<small class=\"meta\">created <span am-time-ago=\"build.metadata.creationTimestamp\"></span></small>\n" +
@@ -3930,6 +3936,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
39303936
"<th>Name</th>\n" +
39313937
"<th>Last Build</th>\n" +
39323938
"<th>Status</th>\n" +
3939+
"<th>Duration</th>\n" +
39333940
"<th>Created</th>\n" +
39343941
"<th>Type</th>\n" +
39353942
"<th>Source</th>\n" +
@@ -3974,9 +3981,16 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
39743981
"</td>\n" +
39753982
"<td data-title=\"Status\">\n" +
39763983
"<div row class=\"status\">\n" +
3977-
"<build-status build=\"latestBuild\"></build-status>\n" +
3984+
"\n" +
3985+
"<status-icon status=\"latestBuild.status.phase\" disable-animation fixed-width=\"true\"></status-icon>\n" +
3986+
"<span ng-if=\"latestBuild.status.phase ==='Failed'\">{{(latestBuild.status.reason || latestBuild.status.phase) | sentenceCase}}</span>\n" +
3987+
"<span ng-if=\"latestBuild.status.phase !== 'Failed'\">{{latestBuild.status.phase | sentenceCase}}</span>\n" +
39783988
"</div>\n" +
39793989
"</td>\n" +
3990+
"<td data-title=\"Duration\">\n" +
3991+
"<duration-until-now ng-if=\"latestBuild.status.startTimestamp && !latestBuild.status.completionTimestamp\" timestamp=\"latestBuild.status.startTimestamp\" time-only></duration-until-now>\n" +
3992+
"<span ng-if=\"latestBuild.status.startTimestamp && latestBuild.status.completionTimestamp\">{{latestBuild.status.startTimestamp | duration : latestBuild.status.completionTimestamp}}</span>\n" +
3993+
"</td>\n" +
39803994
"<td data-title=\"Created\">\n" +
39813995
"<span am-time-ago=\"latestBuild.metadata.creationTimestamp\"></span>\n" +
39823996
"</td>\n" +

0 commit comments

Comments
 (0)