Skip to content

Commit

Permalink
Merge pull request #2266 from spadgett/improve-humanized-reasons
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue.

Special case some humanized reasons codes

* BackOff -> Back-off (instead of "Back off")
* OAuth -> OAuth (instead of "O auth")

Used in the events page, notification drawer, and for pod status, which
shows failed container reason codes.

@ncameronbritt Fixing your "back off" bug
  • Loading branch information
openshift-merge-robot committed Oct 13, 2017
2 parents dabc632 + c258c89 commit 613956a
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 14 deletions.
10 changes: 10 additions & 0 deletions app/scripts/filters/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -1340,4 +1340,14 @@ angular.module('openshiftConsole')

return serviceInstanceMessage;
};
})
.filter('humanizeReason', function() {
return function(reason) {
var humanizedReason = _.startCase(reason);
// Special case some values like "BackOff" -> "Back-off"
return humanizedReason.replace("Back Off", "Back-off").replace("O Auth", "OAuth");
};
})
.filter('humanizePodStatus', function(humanizeReasonFilter) {
return humanizeReasonFilter;
});
2 changes: 1 addition & 1 deletion app/views/browse/_pod-details.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h3>
<dt>Status:</dt>
<dd>
<status-icon status="pod | podStatus"></status-icon>
{{pod | podStatus | sentenceCase}}<span ng-if="pod | podCompletionTime">, ran for {{(pod | podStartTime) | duration : (pod | podCompletionTime)}}</span>
{{pod | podStatus | humanizePodStatus}}<span ng-if="pod | podCompletionTime">, ran for {{(pod | podStartTime) | duration : (pod | podCompletionTime)}}</span>
<span ng-if="pod.metadata.deletionTimestamp">(expires {{pod.metadata.deletionTimestamp | date : 'medium'}})</span>
</dd>
<dt ng-if-start="pod.status.message">Message:</dt>
Expand Down
2 changes: 1 addition & 1 deletion app/views/directives/events-sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ <h2>
<div class="event-details">
<div class="detail-group">
<div class="event-reason">
{{event.reason | sentenceCase}}
{{event.reason | humanizeReason}}
</div>
<div
class="event-object"
Expand Down
4 changes: 2 additions & 2 deletions app/views/directives/events.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@
<span class="sr-only">{{event.type}}</span>
<span class="pficon pficon-warning-triangle-o" ng-show="event.type === 'Warning'" aria-hidden="true" data-toggle="tooltip" data-original-title="Warning"></span></td>
<td class="hidden-sm hidden-md" data-title="Reason">
<span ng-bind-html="event.reason | sentenceCase | highlightKeywords : filterExpressions"></span>&nbsp;<span class="visible-xs-inline pficon pficon-warning-triangle-o" ng-show="event.type === 'Warning'" aria-hidden="true" data-toggle="tooltip" data-original-title="Warning"></span>
<span ng-bind-html="event.reason | humanizeReason | highlightKeywords : filterExpressions"></span>&nbsp;<span class="visible-xs-inline pficon pficon-warning-triangle-o" ng-show="event.type === 'Warning'" aria-hidden="true" data-toggle="tooltip" data-original-title="Warning"></span>
</td>
<td data-title="Message">
<div class="hidden-xs-block visible-sm-block visible-md-block hidden-lg-block">
<span ng-bind-html="event.reason | sentenceCase | highlightKeywords : filterExpressions"></span>&nbsp;
<span ng-bind-html="event.reason | humanizeReason | highlightKeywords : filterExpressions"></span>&nbsp;
<span class="pficon pficon-warning-triangle-o" ng-show="event.type === 'Warning'" aria-hidden="true" data-toggle="tooltip" data-original-title="Warning"></span>
</div>
<!-- Truncate long messages to 1000 chars or 4 lines. -->
Expand Down
2 changes: 1 addition & 1 deletion app/views/directives/pods-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<td data-title="Status">
<div row class="status">
<status-icon status="pod | podStatus" disable-animation></status-icon>
<span flex>{{pod | podStatus | sentenceCase}}</span>
<span flex>{{pod | podStatus | humanizePodStatus}}</span>
</div>
</td>
<td data-title="Ready">{{pod | numContainersReady}}/{{pod.spec.containers.length}}</td>
Expand Down
2 changes: 1 addition & 1 deletion app/views/modals/debug-terminal.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ <h2>Debug Container {{container.name}}</h2>
<small class="text-muted">
{{debugPod.metadata.name}} &mdash;
<status-icon status="debugPod | podStatus"></status-icon>
{{debugPod | podStatus | sentenceCase}}
{{debugPod | podStatus | humanizePodStatus}}
</small>
</div>
<div class="modal-body">
Expand Down
2 changes: 1 addition & 1 deletion app/views/monitoring.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ <h2>Pods</h2>
</div>
<div class="list-group-item-text">
<status-icon status="pod | podStatus" disable-animation></status-icon>
{{pod | podStatus | sentenceCase}}
{{pod | podStatus | humanizeReason}}
<small ng-if="(pod | podStatus) === 'Running'" class="text-muted">
&ndash;
{{pod | numContainersReady}}/{{pod.spec.containers.length}} ready
Expand Down
6 changes: 6 additions & 0 deletions dist/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -15334,6 +15334,12 @@ r = _.get(t(n, a), "message");
}
return r;
};
} ]).filter("humanizeReason", function() {
return function(e) {
return _.startCase(e).replace("Back Off", "Back-off").replace("O Auth", "OAuth");
};
}).filter("humanizePodStatus", [ "humanizeReasonFilter", function(e) {
return e;
} ]), angular.module("openshiftConsole").filter("canIDoAny", [ "APIService", "canIFilter", function(e, t) {
var n = {
buildConfigs: [ {
Expand Down
14 changes: 7 additions & 7 deletions dist/scripts/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<dt>Status:</dt>\n" +
"<dd>\n" +
"<status-icon status=\"pod | podStatus\"></status-icon>\n" +
"{{pod | podStatus | sentenceCase}}<span ng-if=\"pod | podCompletionTime\">, ran for {{(pod | podStartTime) | duration : (pod | podCompletionTime)}}</span>\n" +
"{{pod | podStatus | humanizePodStatus}}<span ng-if=\"pod | podCompletionTime\">, ran for {{(pod | podStartTime) | duration : (pod | podCompletionTime)}}</span>\n" +
"<span ng-if=\"pod.metadata.deletionTimestamp\">(expires {{pod.metadata.deletionTimestamp | date : 'medium'}})</span>\n" +
"</dd>\n" +
"<dt ng-if-start=\"pod.status.message\">Message:</dt>\n" +
Expand Down Expand Up @@ -6870,7 +6870,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<div class=\"event-details\">\n" +
"<div class=\"detail-group\">\n" +
"<div class=\"event-reason\">\n" +
"{{event.reason | sentenceCase}}\n" +
"{{event.reason | humanizeReason}}\n" +
"</div>\n" +
"<div class=\"event-object\" ng-init=\"resourceURL = (event | navigateEventInvolvedObjectURL)\">\n" +
"<a ng-if=\"resourceURL\" ng-attr-title=\"Navigate to {{event.involvedObject.name}}\" href=\"{{resourceURL}}\">\n" +
Expand Down Expand Up @@ -6980,11 +6980,11 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<span class=\"sr-only\">{{event.type}}</span>\n" +
"<span class=\"pficon pficon-warning-triangle-o\" ng-show=\"event.type === 'Warning'\" aria-hidden=\"true\" data-toggle=\"tooltip\" data-original-title=\"Warning\"></span></td>\n" +
"<td class=\"hidden-sm hidden-md\" data-title=\"Reason\">\n" +
"<span ng-bind-html=\"event.reason | sentenceCase | highlightKeywords : filterExpressions\"></span>&nbsp;<span class=\"visible-xs-inline pficon pficon-warning-triangle-o\" ng-show=\"event.type === 'Warning'\" aria-hidden=\"true\" data-toggle=\"tooltip\" data-original-title=\"Warning\"></span>\n" +
"<span ng-bind-html=\"event.reason | humanizeReason | highlightKeywords : filterExpressions\"></span>&nbsp;<span class=\"visible-xs-inline pficon pficon-warning-triangle-o\" ng-show=\"event.type === 'Warning'\" aria-hidden=\"true\" data-toggle=\"tooltip\" data-original-title=\"Warning\"></span>\n" +
"</td>\n" +
"<td data-title=\"Message\">\n" +
"<div class=\"hidden-xs-block visible-sm-block visible-md-block hidden-lg-block\">\n" +
"<span ng-bind-html=\"event.reason | sentenceCase | highlightKeywords : filterExpressions\"></span>&nbsp;\n" +
"<span ng-bind-html=\"event.reason | humanizeReason | highlightKeywords : filterExpressions\"></span>&nbsp;\n" +
"<span class=\"pficon pficon-warning-triangle-o\" ng-show=\"event.type === 'Warning'\" aria-hidden=\"true\" data-toggle=\"tooltip\" data-original-title=\"Warning\"></span>\n" +
"</div>\n" +
"\n" +
Expand Down Expand Up @@ -8808,7 +8808,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<td data-title=\"Status\">\n" +
"<div row class=\"status\">\n" +
"<status-icon status=\"pod | podStatus\" disable-animation></status-icon>\n" +
"<span flex>{{pod | podStatus | sentenceCase}}</span>\n" +
"<span flex>{{pod | podStatus | humanizePodStatus}}</span>\n" +
"</div>\n" +
"</td>\n" +
"<td data-title=\"Ready\">{{pod | numContainersReady}}/{{pod.spec.containers.length}}</td>\n" +
Expand Down Expand Up @@ -10759,7 +10759,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<small class=\"text-muted\">\n" +
"{{debugPod.metadata.name}} &mdash;\n" +
"<status-icon status=\"debugPod | podStatus\"></status-icon>\n" +
"{{debugPod | podStatus | sentenceCase}}\n" +
"{{debugPod | podStatus | humanizePodStatus}}\n" +
"</small>\n" +
"</div>\n" +
"<div class=\"modal-body\">\n" +
Expand Down Expand Up @@ -11008,7 +11008,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"</div>\n" +
"<div class=\"list-group-item-text\">\n" +
"<status-icon status=\"pod | podStatus\" disable-animation></status-icon>\n" +
"{{pod | podStatus | sentenceCase}}\n" +
"{{pod | podStatus | humanizeReason}}\n" +
"<small ng-if=\"(pod | podStatus) === 'Running'\" class=\"text-muted\">\n" +
"&ndash; {{pod | numContainersReady}}/{{pod.spec.containers.length}} ready\n" +
"</small>\n" +
Expand Down

0 comments on commit 613956a

Please sign in to comment.