Skip to content
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

Show build status message when it exists #989

Merged
merged 1 commit into from
Dec 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions app/scripts/filters/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ angular.module('openshiftConsole')
timestampRhs = timestampRhs || new Date(); // moment expects either an ISO format string or a Date object

var ms = moment(timestampRhs).diff(timestampLhs);
if (ms < 0) {
// Don't show negative durations
ms = 0;
}
var duration = moment.duration(ms);
// the out of the box humanize in moment.js rounds to the nearest time unit
// but we need more details
Expand All @@ -30,7 +34,7 @@ angular.module('openshiftConsole')
if (omitSingle) {
humanizedDuration.push(singularText);
} else {
humanizedDuration.push("one " + singularText);
humanizedDuration.push("1 " + singularText);
}

return;
Expand All @@ -54,7 +58,7 @@ angular.module('openshiftConsole')
return "minute";
}

return "one minute";
return "1 minute";
}

if (humanizedDuration.length === 0) {
Expand Down
3 changes: 2 additions & 1 deletion app/views/browse/_build-details.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ <h3>Status</h3>
<dt>Status:</dt>
<dd>
<status-icon status="build.status.phase"></status-icon>
{{build.status.phase}}
<span ng-if="!build.status.message || build.status.phase === 'Cancelled'">{{build.status.phase}}</span>
<span ng-if="build.status.message && build.status.phase !== 'Cancelled'">{{build.status.message}}</span>
<span ng-if="build | jenkinsLogURL">
<span class="text-muted">&ndash;</span>
<a ng-href="{{build | jenkinsLogURL}}" target="_blank">View Log</a>
Expand Down
10 changes: 8 additions & 2 deletions app/views/browse/build-config.html
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ <h2>No builds.</h2>
<tr>
<th>Build</th>
<th>Status</th>
<th>Duration</th>
<th>Created</th>
</tr>
</thead>
Expand All @@ -197,13 +198,18 @@ <h2>No builds.</h2>
<span ng-if="!(build | annotation : 'buildNumber')">
<a ng-href="{{build | navigateResourceURL}}">{{build.metadata.name}}</a>
</span>
<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>
</td>
<td data-title="Status">
<div row class="status">
<build-status build="build"></build-status>
<status-icon status="build.status.phase" disable-animation fixed-width="true"></status-icon>
<span ng-if="build.status.phase ==='Failed'">{{(build.status.reason || build.status.phase) | sentenceCase}}</span>
<span ng-if="build.status.phase !== 'Failed'">{{build.status.phase | sentenceCase}}</span>
</div>
</td>
<td data-title="Duration">
<duration-until-now ng-if="build.status.startTimestamp && !build.status.completionTimestamp" timestamp="build.status.startTimestamp" time-only></duration-until-now>
<span ng-if="build.status.startTimestamp && build.status.completionTimestamp">{{build.status.startTimestamp | duration : build.status.completionTimestamp}}</span>
</td>
<td data-title="Created">
<span am-time-ago="build.metadata.creationTimestamp"></span>
</td>
Expand Down
1 change: 0 additions & 1 deletion app/views/browse/build.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<div ng-if="build">
<h1>
{{build.metadata.name}}
<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>
<span class="pficon pficon-warning-triangle-o"
ng-if="buildConfigPaused || buildConfigDeleted"
aria-hidden="true"
Expand Down
10 changes: 9 additions & 1 deletion app/views/builds.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ <h1>Builds</h1>
<th>Name</th>
<th>Last Build</th>
<th>Status</th>
<th>Duration</th>
<th>Created</th>
<th>Type</th>
<th>Source</th>
Expand Down Expand Up @@ -74,9 +75,16 @@ <h1>Builds</h1>
</td>
<td data-title="Status">
<div row class="status">
<build-status build="latestBuild"></build-status>
<!-- <build-status build="build"></build-status> -->
<status-icon status="latestBuild.status.phase" disable-animation fixed-width="true"></status-icon>
<span ng-if="latestBuild.status.phase ==='Failed'">{{(latestBuild.status.reason || latestBuild.status.phase) | sentenceCase}}</span>
<span ng-if="latestBuild.status.phase !== 'Failed'">{{latestBuild.status.phase | sentenceCase}}</span>
</div>
</td>
<td data-title="Duration">
<duration-until-now ng-if="latestBuild.status.startTimestamp && !latestBuild.status.completionTimestamp" timestamp="latestBuild.status.startTimestamp" time-only></duration-until-now>
<span ng-if="latestBuild.status.startTimestamp && latestBuild.status.completionTimestamp">{{latestBuild.status.startTimestamp | duration : latestBuild.status.completionTimestamp}}</span>
</td>
<td data-title="Created">
<span am-time-ago="latestBuild.metadata.creationTimestamp"></span>
</td>
Expand Down
8 changes: 5 additions & 3 deletions dist/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -12898,12 +12898,14 @@ return a;
}), angular.module("openshiftConsole").filter("duration", function() {
return function(a, b, c, d) {
function e(a, b, d) {
if (0 !== a) return 1 === a ? void (c ? h.push(b) :h.push("one " + b)) :void h.push(a + " " + d);
if (0 !== a) return 1 === a ? void (c ? h.push(b) :h.push("1 " + b)) :void h.push(a + " " + d);
}
if (!a) return a;
d = d || 2, b = b || new Date();
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();
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(", "));
var f = moment(b).diff(a);
f < 0 && (f = 0);
var g = moment.duration(f), h = [], i = g.years(), j = g.months(), k = g.days(), l = g.hours(), m = g.minutes(), n = g.seconds();
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(", "));
};
}).filter("ageLessThan", function() {
return function(a, b, c) {
Expand Down
24 changes: 19 additions & 5 deletions dist/scripts/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,8 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<dt>Status:</dt>\n" +
"<dd>\n" +
"<status-icon status=\"build.status.phase\"></status-icon>\n" +
"{{build.status.phase}}\n" +
"<span ng-if=\"!build.status.message || build.status.phase === 'Cancelled'\">{{build.status.phase}}</span>\n" +
"<span ng-if=\"build.status.message && build.status.phase !== 'Cancelled'\">{{build.status.message}}</span>\n" +
"<span ng-if=\"build | jenkinsLogURL\">\n" +
"<span class=\"text-muted\">&ndash;</span>\n" +
"<a ng-href=\"{{build | jenkinsLogURL}}\" target=\"_blank\">View Log</a>\n" +
Expand Down Expand Up @@ -1861,6 +1862,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<tr>\n" +
"<th>Build</th>\n" +
"<th>Status</th>\n" +
"<th>Duration</th>\n" +
"<th>Created</th>\n" +
"</tr>\n" +
"</thead>\n" +
Expand All @@ -1877,13 +1879,18 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<span ng-if=\"!(build | annotation : 'buildNumber')\">\n" +
"<a ng-href=\"{{build | navigateResourceURL}}\">{{build.metadata.name}}</a>\n" +
"</span>\n" +
"<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" +
"</td>\n" +
"<td data-title=\"Status\">\n" +
"<div row class=\"status\">\n" +
"<build-status build=\"build\"></build-status>\n" +
"<status-icon status=\"build.status.phase\" disable-animation fixed-width=\"true\"></status-icon>\n" +
"<span ng-if=\"build.status.phase ==='Failed'\">{{(build.status.reason || build.status.phase) | sentenceCase}}</span>\n" +
"<span ng-if=\"build.status.phase !== 'Failed'\">{{build.status.phase | sentenceCase}}</span>\n" +
"</div>\n" +
"</td>\n" +
"<td data-title=\"Duration\">\n" +
"<duration-until-now ng-if=\"build.status.startTimestamp && !build.status.completionTimestamp\" timestamp=\"build.status.startTimestamp\" time-only></duration-until-now>\n" +
"<span ng-if=\"build.status.startTimestamp && build.status.completionTimestamp\">{{build.status.startTimestamp | duration : build.status.completionTimestamp}}</span>\n" +
"</td>\n" +
"<td data-title=\"Created\">\n" +
"<span am-time-ago=\"build.metadata.creationTimestamp\"></span>\n" +
"</td>\n" +
Expand Down Expand Up @@ -2136,7 +2143,6 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<div ng-if=\"build\">\n" +
"<h1>\n" +
"{{build.metadata.name}}\n" +
"<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" +
"<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" +
"</span>\n" +
"<small class=\"meta\">created <span am-time-ago=\"build.metadata.creationTimestamp\"></span></small>\n" +
Expand Down Expand Up @@ -3930,6 +3936,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<th>Name</th>\n" +
"<th>Last Build</th>\n" +
"<th>Status</th>\n" +
"<th>Duration</th>\n" +
"<th>Created</th>\n" +
"<th>Type</th>\n" +
"<th>Source</th>\n" +
Expand Down Expand Up @@ -3974,9 +3981,16 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"</td>\n" +
"<td data-title=\"Status\">\n" +
"<div row class=\"status\">\n" +
"<build-status build=\"latestBuild\"></build-status>\n" +
"\n" +
"<status-icon status=\"latestBuild.status.phase\" disable-animation fixed-width=\"true\"></status-icon>\n" +
"<span ng-if=\"latestBuild.status.phase ==='Failed'\">{{(latestBuild.status.reason || latestBuild.status.phase) | sentenceCase}}</span>\n" +
"<span ng-if=\"latestBuild.status.phase !== 'Failed'\">{{latestBuild.status.phase | sentenceCase}}</span>\n" +
"</div>\n" +
"</td>\n" +
"<td data-title=\"Duration\">\n" +
"<duration-until-now ng-if=\"latestBuild.status.startTimestamp && !latestBuild.status.completionTimestamp\" timestamp=\"latestBuild.status.startTimestamp\" time-only></duration-until-now>\n" +
"<span ng-if=\"latestBuild.status.startTimestamp && latestBuild.status.completionTimestamp\">{{latestBuild.status.startTimestamp | duration : latestBuild.status.completionTimestamp}}</span>\n" +
"</td>\n" +
"<td data-title=\"Created\">\n" +
"<span am-time-ago=\"latestBuild.metadata.creationTimestamp\"></span>\n" +
"</td>\n" +
Expand Down