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

Special case some humanized reasons codes #2266

Merged
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
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 @@ -15350,6 +15350,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 @@ -1247,7 +1247,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 @@ -6881,7 +6881,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 @@ -6991,11 +6991,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 @@ -8819,7 +8819,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 @@ -10770,7 +10770,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 @@ -11019,7 +11019,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