Skip to content

Commit b8ac5a0

Browse files
committed
Preserve newlines in broker status messages
Preserve newlines in service instance status messages on the overview and the provisioned service page. Truncate long message when displayed in a tooltip.
1 parent 567a1d9 commit b8ac5a0

File tree

9 files changed

+203
-160
lines changed

9 files changed

+203
-160
lines changed

app/scripts/directives/overview/serviceInstanceRow.js

+16
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
var row = this;
3030
var isBindingFailed = $filter('isBindingFailed');
3131
var isBindingReady = $filter('isBindingReady');
32+
var serviceInstanceFailedMessage = $filter('serviceInstanceFailedMessage');
33+
var truncate = $filter('truncate');
3234

3335
_.extend(row, ListRowUtils.ui);
3436

@@ -111,6 +113,20 @@
111113
_.set(row, 'overlay.state', state);
112114
};
113115

116+
row.getFailedTooltipText = function() {
117+
var message = serviceInstanceFailedMessage(row.apiObject);
118+
if (!message) {
119+
return '';
120+
}
121+
122+
var truncated = truncate(message, 128);
123+
if (message.length !== truncated.length) {
124+
truncated += '...';
125+
}
126+
127+
return truncated;
128+
};
129+
114130
row.deprovision = function() {
115131
ServiceInstancesService.deprovision(row.apiObject, row.deleteableBindings);
116132
};

app/styles/_instances.less

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.service-instance-details .instance-status-message {
2+
white-space: pre-line;
3+
}

app/styles/_overview.less

+5
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
margin-top: 5px;
3030
}
3131
}
32+
.instance-status-message .truncated-content,
33+
.instance-status-notification .tooltip {
34+
// Preserve newlines in broker error messages.
35+
white-space: pre-line;
36+
}
3237
.instance-status-notification,
3338
.notification-icon-count {
3439
display: inline-block;

app/styles/main.less

+1
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,4 @@
6565
@import "_builds.less";
6666
@import "_editor.less";
6767
@import "_add-config-to-application.less";
68+
@import "_instances.less";

app/views/browse/service-instance.html

+2-4
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ <h1 class="contains-actions">
5454
</div>
5555
</div>
5656
</div><!-- /middle-header-->
57-
<div class="middle-content" persist-tab-state>
57+
<div class="middle-content service-instance-details" persist-tab-state>
5858
<div class="container-fluid">
5959
<div class="row" ng-if="serviceInstance">
6060
<div class="col-md-12">
@@ -78,9 +78,7 @@ <h3>Status</h3>
7878
<span flex>{{serviceInstance | serviceInstanceStatus | sentenceCase}}</span>
7979
</dd>
8080
<dt ng-if-start="serviceInstance | serviceInstanceConditionMessage">Status Reason:</dt>
81-
<dd ng-if-end>
82-
{{serviceInstance | serviceInstanceConditionMessage}}
83-
</dd>
81+
<dd ng-if-end class="instance-status-message">{{serviceInstance | serviceInstanceConditionMessage}}</dd>
8482
</dl>
8583
<div class="hidden-lg">
8684
<h3 ng-if-start="serviceClass.spec.description || serviceClass.spec.externalMetadata.longDescription">Description</h3>

app/views/overview/_service-instance-row.html

+21-9
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ <h3>
99
<a ng-href="{{row.apiObject | navigateResourceURL}}" ng-bind-html="row.displayName | highlightKeywords : row.state.filterKeywords"></a>
1010
<div ng-bind-html="row.apiObject.metadata.name | highlightKeywords : row.state.filterKeywords" class="list-row-longname"></div>
1111
</h3>
12-
<div class="status-icons" ng-if="!row.expanded">
12+
<div class="status-icons" ng-if="!row.expanded" ng-init="tooltipID = 'instance-status-tooltip-' + $id">
1313
<notification-icon alerts="row.notifications"></notification-icon>
14-
<div ng-switch="row.instanceStatus" class="instance-status-notification">
14+
<div ng-switch="row.instanceStatus" class="instance-status-notification" id="{{tooltipID}}">
15+
<!-- Set the tooltip container so we can add write CSS rules that target the message. -->
1516
<span ng-switch-when="failed"
16-
dynamic-content="{{row.apiObject | serviceInstanceFailedMessage}}"
17+
dynamic-content="{{row.getFailedTooltipText()}}"
1718
data-toggle="tooltip"
18-
data-trigger="hover">
19+
data-trigger="hover"
20+
data-container="#{{tooltipID}}">
1921
<span class="pficon pficon-error-circle-o" aria-hidden="true"></span>
2022
Error
2123
</span>
@@ -111,12 +113,16 @@ <h3>
111113
<span class="pficon pficon-error-circle-o" aria-hidden="true"></span>
112114
<span class="sr-only">error</span>
113115
<span class="strong">The service failed.</span>
114-
<span class="mar-right-md">
115-
<truncate-long-text content="row.apiObject | serviceInstanceFailedMessage" limit="265"></truncate-long-text>
116+
<span class="instance-status-message">
117+
<truncate-long-text
118+
content="row.apiObject | serviceInstanceFailedMessage"
119+
expandable="true"
120+
limit="265"
121+
newline-limit="4"></truncate-long-text>
116122
</span>
117-
<span ng-if="row.serviceInstancesVersion | canI : 'delete'" class="nowrap">
123+
<div ng-if="row.serviceInstancesVersion | canI : 'delete'">
118124
<a href="" ng-click="row.deprovision()">Delete This Service</a>
119-
</span>
125+
</div>
120126
</div>
121127
</div>
122128
</div>
@@ -126,7 +132,13 @@ <h3>
126132
<span class="pficon pficon-info" aria-hidden="true"></span>
127133
<span class="sr-only">info</span>
128134
<span class="strong">The service is not yet ready.</span>
129-
<truncate-long-text content="row.apiObject | serviceInstanceReadyMessage" limit="265"></truncate-long-text>
135+
<span class="instance-status-message">
136+
<truncate-long-text
137+
content="row.apiObject | serviceInstanceReadyMessage"
138+
expandable="true"
139+
limit="265"
140+
newline-limit="4"></truncate-long-text>
141+
</span>
130142
</div>
131143
</div>
132144
</div>

0 commit comments

Comments
 (0)