From eeb4ffa5df2443a7b1ab9d9259249b8bbef16e6a Mon Sep 17 00:00:00 2001 From: Jessica Forrester Date: Mon, 5 Dec 2016 15:36:04 -0500 Subject: [PATCH] Show build status message when it exists Implements https://trello.com/c/Of6LXNUi --- app/scripts/filters/date.js | 8 ++++++-- app/views/browse/_build-details.html | 3 ++- app/views/browse/build-config.html | 10 ++++++++-- app/views/browse/build.html | 1 - app/views/builds.html | 10 +++++++++- dist/scripts/scripts.js | 8 +++++--- dist/scripts/templates.js | 24 +++++++++++++++++++----- 7 files changed, 49 insertions(+), 15 deletions(-) diff --git a/app/scripts/filters/date.js b/app/scripts/filters/date.js index 28b5b00a94..7a3bb08c68 100644 --- a/app/scripts/filters/date.js +++ b/app/scripts/filters/date.js @@ -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 @@ -30,7 +34,7 @@ angular.module('openshiftConsole') if (omitSingle) { humanizedDuration.push(singularText); } else { - humanizedDuration.push("one " + singularText); + humanizedDuration.push("1 " + singularText); } return; @@ -54,7 +58,7 @@ angular.module('openshiftConsole') return "minute"; } - return "one minute"; + return "1 minute"; } if (humanizedDuration.length === 0) { diff --git a/app/views/browse/_build-details.html b/app/views/browse/_build-details.html index 9a767e8e14..316c8d433c 100644 --- a/app/views/browse/_build-details.html +++ b/app/views/browse/_build-details.html @@ -6,7 +6,8 @@

Status

Status:
- {{build.status.phase}} + {{build.status.phase}} + {{build.status.message}} View Log diff --git a/app/views/browse/build-config.html b/app/views/browse/build-config.html index d8275a3e17..95f9b965c9 100644 --- a/app/views/browse/build-config.html +++ b/app/views/browse/build-config.html @@ -181,6 +181,7 @@

No builds.

Build Status + Duration Created @@ -197,13 +198,18 @@

No builds.

{{build.metadata.name}} -
- + + {{(build.status.reason || build.status.phase) | sentenceCase}} + {{build.status.phase | sentenceCase}}
+ + + {{build.status.startTimestamp | duration : build.status.completionTimestamp}} + diff --git a/app/views/browse/build.html b/app/views/browse/build.html index a4d7833991..5e98ff5f1c 100644 --- a/app/views/browse/build.html +++ b/app/views/browse/build.html @@ -12,7 +12,6 @@

{{build.metadata.name}} -

Name Last Build Status + Duration Created Type Source @@ -74,9 +75,16 @@

Builds

- + + + {{(latestBuild.status.reason || latestBuild.status.phase) | sentenceCase}} + {{latestBuild.status.phase | sentenceCase}}
+ + + {{latestBuild.status.startTimestamp | duration : latestBuild.status.completionTimestamp}} + diff --git a/dist/scripts/scripts.js b/dist/scripts/scripts.js index 3c5fed609c..e592c077de 100644 --- a/dist/scripts/scripts.js +++ b/dist/scripts/scripts.js @@ -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) { diff --git a/dist/scripts/templates.js b/dist/scripts/templates.js index 6fc4913862..88f34a20eb 100644 --- a/dist/scripts/templates.js +++ b/dist/scripts/templates.js @@ -1247,7 +1247,8 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function( "
Status:
\n" + "
\n" + "\n" + - "{{build.status.phase}}\n" + + "{{build.status.phase}}\n" + + "{{build.status.message}}\n" + "\n" + "\n" + "View Log\n" + @@ -1861,6 +1862,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function( "\n" + "Build\n" + "Status\n" + + "Duration\n" + "Created\n" + "\n" + "\n" + @@ -1877,13 +1879,18 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function( "\n" + "{{build.metadata.name}}\n" + "\n" + - "\n" + "\n" + "\n" + "
\n" + - "\n" + + "\n" + + "{{(build.status.reason || build.status.phase) | sentenceCase}}\n" + + "{{build.status.phase | sentenceCase}}\n" + "
\n" + "\n" + + "\n" + + "\n" + + "{{build.status.startTimestamp | duration : build.status.completionTimestamp}}\n" + + "\n" + "\n" + "\n" + "\n" + @@ -2136,7 +2143,6 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function( "
\n" + "

\n" + "{{build.metadata.name}}\n" + - "\n" + "\n" + "\n" + "created \n" + @@ -3930,6 +3936,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function( "Name\n" + "Last Build\n" + "Status\n" + + "Duration\n" + "Created\n" + "Type\n" + "Source\n" + @@ -3974,9 +3981,16 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function( "\n" + "\n" + "
\n" + - "\n" + + "\n" + + "\n" + + "{{(latestBuild.status.reason || latestBuild.status.phase) | sentenceCase}}\n" + + "{{latestBuild.status.phase | sentenceCase}}\n" + "
\n" + "\n" + + "\n" + + "\n" + + "{{latestBuild.status.startTimestamp | duration : latestBuild.status.completionTimestamp}}\n" + + "\n" + "\n" + "\n" + "\n" +