Skip to content

Commit 9e9fa0f

Browse files
author
OpenShift Bot
authored
Merge pull request #1961 from jeff-phillips-18/services
Merged by openshift-bot
2 parents 89e0cd3 + 4922a2a commit 9e9fa0f

File tree

4 files changed

+207
-79
lines changed

4 files changed

+207
-79
lines changed

app/scripts/directives/overview/serviceInstanceRow.js

+27-1
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,31 @@
3939
return _.get(row, ['state','serviceClasses', serviceClassName, 'description']);
4040
};
4141

42+
var updateInstanceStatus = function() {
43+
var conditions = _.get(row.apiObject, 'status.conditions');
44+
var readyCondition = _.find(conditions, {type: 'Ready'});
45+
46+
row.instanceError = _.find(conditions, {type: 'Failed', status: 'True'});
47+
48+
if (_.get(row.apiObject, 'metadata.deletionTimestamp')) {
49+
row.instanceStatus = 'deleted';
50+
} else if (row.instanceError) {
51+
row.instanceStatus = 'failed';
52+
} else if (readyCondition && readyCondition.status === 'True') {
53+
row.instanceStatus = 'ready';
54+
} else {
55+
row.instanceStatus = 'pending';
56+
row.pendingMessage = _.get(readyCondition, 'message') || 'The instance is being provisioned asynchronously.';
57+
}
58+
};
59+
4260
row.$doCheck = function() {
61+
updateInstanceStatus();
62+
4363
row.notifications = ListRowUtils.getNotifications(row.apiObject, row.state);
4464
row.displayName = serviceInstanceDisplayName(row.apiObject, row.state.serviceClasses);
45-
row.isBindable = BindingService.isServiceBindable(row.apiObject, row.state.serviceClasses);
65+
row.isBindable = !row.instanceError &&
66+
BindingService.isServiceBindable(row.apiObject, row.state.serviceClasses);
4667
row.description = getDescription();
4768
};
4869

@@ -57,6 +78,11 @@
5778
};
5879

5980
row.actionsDropdownVisible = function() {
81+
// no actions on those marked for deletion
82+
if (_.get(row.apiObject, 'metadata.deletionTimestamp')) {
83+
return false;
84+
}
85+
6086
// We can create bindings
6187
if (row.isBindable && AuthorizationService.canI({resource: 'bindings', group: 'servicecatalog.k8s.io'}, 'create')) {
6288
return true;

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

+102-53
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,24 @@ <h3>
1313
<notification-icon ng-if="!row.expanded" alerts="row.notifications"></notification-icon>
1414
</div>
1515
</div>
16-
<div class="list-pf-details">
17-
<div ng-if="!row.expanded">
16+
<div class="list-pf-details" ng-if="!row.expanded" ng-switch="row.instanceStatus">
17+
18+
<span ng-switch-when="failed"
19+
dynamic-content="{{row.instanceError.message}}"
20+
data-toggle="tooltip"
21+
data-trigger="hover">
22+
<span class="pficon pficon-error-circle-o" aria-hidden="true"></span>
23+
<span>Error</span>
24+
</span>
25+
<span ng-switch-when="deleted">
26+
<span class="pficon pficon-warning-triangle-o" aria-hidden="true"></span>
27+
<span>Marked for Deletion</span>
28+
</span>
29+
<span ng-switch-when="pending">
30+
<span class="spinner spinner-xs spinner-inline" aria-hidden="true"></span>
31+
<span>Pending</span>
32+
</span>
33+
<div ng-switch-default>
1834
<div class="hidden-xs hidden-sm">
1935
<span ng-if="!row.bindings.length
2036
&& row.isBindable
@@ -44,15 +60,15 @@ <h3>
4460
</div>
4561
<div
4662
class="hidden-xs"
47-
ng-if="!row.expanded && row.apiObject.status.dashboardURL">
63+
ng-if="(!row.instanceStatus || row.instanceStatus === 'ready') && row.apiObject.status.dashboardURL">
4864
<a ng-href="{{row.apiObject.status.dashboardURL}}" target="_blank">
4965
Console
5066
</a> <i class="fa fa-external-link small" aria-hidden="true"></i>
5167
</div>
5268
</div>
5369
</div>
54-
<div class="list-pf-actions" ng-if="row.actionsDropdownVisible()">
55-
<div uib-dropdown>
70+
<div class="list-pf-actions">
71+
<div uib-dropdown ng-if="row.actionsDropdownVisible()">
5672
<a href=""
5773
uib-dropdown-toggle
5874
class="actions-dropdown-kebab"><i class="fa fa-ellipsis-v"></i><span class="sr-only">Actions</span></a>
@@ -97,59 +113,92 @@ <h3>
97113
</div>
98114
</div>
99115
-->
100-
<div class="row">
101-
<div class="col-sm-12" ng-if="row.description">
102-
<p class="pre-wrap" ng-bind-html="row.description | linky"></p>
116+
<div ng-switch="row.instanceStatus">
117+
<div ng-switch-when="deleted" class="row">
118+
<div class="col-sm-12">
119+
<div class="alert word-break alert-warning">
120+
<span class="pficon pficon-warning-triangle-o" aria-hidden="true"></span>
121+
<span class="sr-only">warning</span>
122+
<span class="strong">The service was marked for deletion</span>
123+
<span class="strong" am-time-ago="row.apiObject.metadata.deletionTimestamp"></span>
124+
</div>
125+
</div>
103126
</div>
104-
</div>
105-
<div class="section-title" ng-if="row.isBindable || row.bindings">
106-
Bindings
107-
</div>
108-
<div class="row overview-bindings" ng-repeat="(name, binding) in row.bindings">
109-
<div class="col-sm-5 col-md-6">
110-
<div ng-if="!(row.state.applicationsByBinding[binding.metadata.name] | size)">
111-
<h3>
112-
<div class="component-label">
113-
Secret
127+
<div ng-switch-when="failed" class="row">
128+
<div class="col-sm-12">
129+
<div class="alert word-break alert-danger">
130+
<span class="pficon pficon-error-circle-o" aria-hidden="true"></span>
131+
<span class="sr-only">error</span>
132+
<span class="strong">{{row.instanceError.message}}</span>
133+
</div>
134+
</div>
135+
</div>
136+
<div ng-switch-when="pending" class="row">
137+
<div class="col-sm-12">
138+
<div class="alert word-break alert-info">
139+
<span class="pficon pficon-info" aria-hidden="true"></span>
140+
<span class="sr-only">info</span>
141+
<span>The service is not yeat ready.</span>
142+
<span>{{row.pendingMessage}}</span>
143+
</div>
144+
</div>
145+
</div>
146+
<div ng-switch-default>
147+
<div class="row">
148+
<div class="col-sm-12" ng-if="row.description">
149+
<p class="pre-wrap" ng-bind-html="row.description | linky"></p>
150+
</div>
151+
</div>
152+
<div class="section-title" ng-if="row.isBindable || row.bindings">
153+
Bindings
154+
</div>
155+
<div class="row overview-bindings" ng-repeat="(name, binding) in row.bindings">
156+
<div class="col-sm-5 col-md-6">
157+
<div ng-if="!(row.state.applicationsByBinding[binding.metadata.name] | size)">
158+
<h3>
159+
<div class="component-label">
160+
Secret
161+
</div>
162+
<a ng-if="('secrets' | canI : 'get')"
163+
ng-href="{{binding.spec.secretName | navigateResourceURL : 'Secret' : row.apiObject.metadata.namespace}}">
164+
{{binding.spec.secretName}}
165+
</a>
166+
<span ng-if="!('secrets' | canI : 'get')">
167+
{{binding.spec.secretName}}
168+
</span>
169+
</h3>
114170
</div>
115-
<a ng-if="('secrets' | canI : 'get')"
116-
ng-href="{{binding.spec.secretName | navigateResourceURL : 'Secret' : row.apiObject.metadata.namespace}}">
117-
{{binding.spec.secretName}}
118-
</a>
119-
<span ng-if="!('secrets' | canI : 'get')">
120-
{{binding.spec.secretName}}
171+
<div ng-repeat="target in row.state.applicationsByBinding[binding.metadata.name] track by (target | uid)">
172+
<h3>
173+
<div class="component-label">
174+
{{target.kind | humanizeKind : true}}
175+
</div>
176+
<a ng-href="{{target | navigateResourceURL}}">{{target.metadata.name}}</a>
177+
</h3>
178+
</div>
179+
</div>
180+
<div class="col-sm-7 col-md-6 overview-bindings">
181+
<span ng-if="binding.metadata.deletionTimestamp">
182+
<status-icon status="'Pending'"></status-icon> Deleting
183+
</span>
184+
<span ng-if="!(binding | isBindingReady) && !binding.metadata.deletionTimestamp">
185+
<status-icon status="'Pending'"></status-icon> Pending
121186
</span>
122-
</h3>
187+
</div>
123188
</div>
124-
<div ng-repeat="target in row.state.applicationsByBinding[binding.metadata.name] track by (target | uid)">
125-
<h3>
126-
<div class="component-label">
127-
{{target.kind | humanizeKind : true}}
128-
</div>
129-
<a ng-href="{{target | navigateResourceURL}}">{{target.metadata.name}}</a>
130-
</h3>
189+
<div class="row" ng-if="row.isBindable && ({resource: 'bindings', group: 'servicecatalog.k8s.io'} | canI : 'create')">
190+
<div class="col-sm-12">
191+
<a href="" ng-click="row.showOverlayPanel('bindService', {target: row.apiObject})">
192+
<span class="pficon pficon-add-circle-o" aria-hidden="true"></span>
193+
Create Binding
194+
</a>
195+
</div>
196+
</div>
197+
<div class="row" ng-if="!row.bindings.length && (!row.isBindable || !({resource: 'bindings', group: 'servicecatalog.k8s.io'} | canI : 'create'))">
198+
<div class="col-sm-12">
199+
<em>No bindings</em>
200+
</div>
131201
</div>
132-
</div>
133-
<div class="col-sm-7 col-md-6 overview-bindings">
134-
<span ng-if="binding.metadata.deletionTimestamp">
135-
<status-icon status="'Pending'"></status-icon> Deleting
136-
</span>
137-
<span ng-if="!(binding | isBindingReady) && !binding.metadata.deletionTimestamp">
138-
<status-icon status="'Pending'"></status-icon> Pending
139-
</span>
140-
</div>
141-
</div>
142-
<div class="row" ng-if="row.isBindable && ({resource: 'bindings', group: 'servicecatalog.k8s.io'} | canI : 'create')">
143-
<div class="col-sm-12">
144-
<a href="" ng-click="row.showOverlayPanel('bindService', {target: row.apiObject})">
145-
<span class="pficon pficon-add-circle-o" aria-hidden="true"></span>
146-
Create Binding
147-
</a>
148-
</div>
149-
</div>
150-
<div class="row" ng-if="!row.bindings.length && (!row.isBindable || !({resource: 'bindings', group: 'servicecatalog.k8s.io'} | canI : 'create'))">
151-
<div class="col-sm-12">
152-
<em>No bindings</em>
153202
</div>
154203
</div>
155204
</div>

dist/scripts/scripts.js

+28-20
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
function OverviewController(e, t, n, a, r, o, i, s, c, l, u, d, m, p, g, f, h, v, y, b, C, S, w, k, j) {
44
var P = this, R = t("isIE")() || t("isEdge")();
55
e.projectName = n.project;
6-
var E, T, N = t("annotation"), I = t("buildConfigForBuild"), D = t("deploymentIsInProgress"), A = t("imageObjectRef"), B = t("isJenkinsPipelineStrategy"), L = t("isNewerResource"), U = t("label"), O = t("podTemplate"), x = {}, F = {}, M = {}, V = P.state = {
6+
var E, T, N = t("annotation"), I = t("buildConfigForBuild"), D = t("deploymentIsInProgress"), A = t("imageObjectRef"), B = t("isJenkinsPipelineStrategy"), L = t("isNewerResource"), U = t("label"), O = t("podTemplate"), F = {}, x = {}, M = {}, V = P.state = {
77
alerts: {},
88
builds: {},
99
clusterQuotas: {},
@@ -124,7 +124,7 @@ P.filteredDeploymentConfigs = re(P.deploymentConfigs), P.filteredReplicationCont
124124
P.viewBy = localStorage.getItem(se) || "app", e.$watch(function() {
125125
return P.viewBy;
126126
}, function(e) {
127-
localStorage.setItem(se, e), ee(), ne = "app" === P.viewBy ? [ "metadata.name", "metadata.labels.app" ] : [ "metadata.name" ], ie(), "pipeline" === P.viewBy ? f.setLabelSuggestions(F) : f.setLabelSuggestions(x);
127+
localStorage.setItem(se, e), ee(), ne = "app" === P.viewBy ? [ "metadata.name", "metadata.labels.app" ] : [ "metadata.name" ], ie(), "pipeline" === P.viewBy ? f.setLabelSuggestions(x) : f.setLabelSuggestions(F);
128128
}), c.DISABLE_OVERVIEW_METRICS || (v.isAvailable(!0).then(function(e) {
129129
V.showMetrics = e;
130130
}), e.$on("metrics-connection-failed", function(e, t) {
@@ -201,9 +201,9 @@ e.$evalAsync(function() {
201201
Se(), ve(), Ce();
202202
});
203203
}, 500), we = function(e) {
204-
_.isEmpty(e) || (f.addLabelSuggestionsFromResources(e, x), "pipeline" !== P.viewBy && f.setLabelSuggestions(x));
204+
_.isEmpty(e) || (f.addLabelSuggestionsFromResources(e, F), "pipeline" !== P.viewBy && f.setLabelSuggestions(F));
205205
}, ke = function(e) {
206-
_.isEmpty(e) || (f.addLabelSuggestionsFromResources(e, F), "pipeline" === P.viewBy && f.setLabelSuggestions(F));
206+
_.isEmpty(e) || (f.addLabelSuggestionsFromResources(e, x), "pipeline" === P.viewBy && f.setLabelSuggestions(x));
207207
}, je = function(e) {
208208
return "Succeeded" !== e.status.phase && "Failed" !== e.status.phase && (!U(e, "openshift.io/deployer-pod-for.name") && (!N(e, "openshift.io/build.name") && "slave" !== U(e, "jenkins")));
209209
}, Pe = function() {
@@ -273,13 +273,13 @@ _.each(a, function(t) {
273273
V.recentPipelinesByDeploymentConfig[t] = V.recentPipelinesByDeploymentConfig[t] || [], V.recentPipelinesByDeploymentConfig[t].push(e);
274274
}), X();
275275
}
276-
}, Oe = {}, xe = function() {
276+
}, Oe = {}, Fe = function() {
277277
Oe = i.groupBuildConfigsByOutputImage(P.buildConfigs);
278-
}, Fe = function(e) {
278+
}, xe = function(e) {
279279
var t = H(e);
280280
if (t) return _.get(V, [ "buildConfigsByObjectUID", t ], []);
281281
}, Me = function(e) {
282-
var t = [], n = Fe(e);
282+
var t = [], n = xe(e);
283283
_.each(n, function(e) {
284284
var n = _.get(V, [ "recentBuildsByBuildConfig", e.metadata.name ], []);
285285
t = t.concat(n);
@@ -415,7 +415,7 @@ P.routes = e.by("metadata.name"), Be(), h.log("routes (subscribe)", P.routes);
415415
poll: R,
416416
pollInterval: 6e4
417417
})), Ye.push(l.watch("buildConfigs", a, function(e) {
418-
P.buildConfigs = e.by("metadata.name"), xe(), He(), Ge(), ie(), h.log("buildconfigs (subscribe)", P.buildConfigs);
418+
P.buildConfigs = e.by("metadata.name"), Fe(), He(), Ge(), ie(), h.log("buildconfigs (subscribe)", P.buildConfigs);
419419
}, {
420420
poll: R,
421421
pollInterval: 6e4
@@ -5901,9 +5901,9 @@ details: t("getErrorDetails")(n)
59015901
};
59025902
});
59035903
};
5904-
var x = t("hasDeploymentConfig");
5904+
var F = t("hasDeploymentConfig");
59055905
e.isScalable = function() {
5906-
return !!_.isEmpty(e.autoscalers) && (!x(e.replicaSet) && !w(e.replicaSet) || (!(!e.deploymentConfigMissing && !e.deploymentMissing) || !(!e.deploymentConfig && !e.deployment) && (e.isActive && !B)));
5906+
return !!_.isEmpty(e.autoscalers) && (!F(e.replicaSet) && !w(e.replicaSet) || (!(!e.deploymentConfigMissing && !e.deploymentMissing) || !(!e.deploymentConfig && !e.deployment) && (e.isActive && !B)));
59075907
}, e.removeVolume = function(n) {
59085908
var a = "This will remove the volume from the " + t("humanizeKind")(e.replicaSet.kind) + ".";
59095909
n.persistentVolumeClaim ? a += " It will not delete the persistent volume claim." : n.secret ? a += " It will not delete the secret." : n.configMap && (a += " It will not delete the config map.");
@@ -11286,7 +11286,7 @@ var t = r.defer();
1128611286
return A ? (A.onClose(function() {
1128711287
t.resolve();
1128811288
}), A.stop()) : t.resolve(), e || (U.cancel(), l && (l.innerHTML = ""), L = document.createDocumentFragment()), t.promise;
11289-
}, x = function() {
11289+
}, F = function() {
1129011290
O().then(function() {
1129111291
t.$evalAsync(function() {
1129211292
if (t.run) {
@@ -11368,11 +11368,11 @@ toggleAutoScroll: function() {
1136811368
t.autoScrollActive = !t.autoScrollActive, t.autoScrollActive && B();
1136911369
},
1137011370
goChromeless: d.chromelessLink,
11371-
restartLogs: x
11371+
restartLogs: F
1137211372
}), t.$on("$destroy", function() {
1137311373
O(), p.off("resize", D), p.off("scroll", P), g.off("scroll", P);
1137411374
}), "deploymentconfigs/logs" === b && !C) return t.state = "empty", void (t.emptyStateMessage = "Logs are not available for this replication controller because it was not generated from a deployment configuration.");
11375-
t.$watchGroup([ "name", "options.container", "run" ], x);
11375+
t.$watchGroup([ "name", "options.container", "run" ], F);
1137611376
} ],
1137711377
require: "logViewer",
1137811378
link: function(e, n, a, r) {
@@ -13043,24 +13043,32 @@ _.extend(s, r.ui);
1304313043
var c = e("getErrorDetails"), l = e("serviceInstanceDisplayName"), u = function() {
1304413044
var e = s.apiObject.spec.serviceClassName;
1304513045
return _.get(s, [ "state", "serviceClasses", e, "description" ]);
13046+
}, d = function() {
13047+
var e = _.get(s.apiObject, "status.conditions"), t = _.find(e, {
13048+
type: "Ready"
13049+
});
13050+
s.instanceError = _.find(e, {
13051+
type: "Failed",
13052+
status: "True"
13053+
}), _.get(s.apiObject, "metadata.deletionTimestamp") ? s.instanceStatus = "deleted" : s.instanceError ? s.instanceStatus = "failed" : t && "True" === t.status ? s.instanceStatus = "ready" : (s.instanceStatus = "pending", s.pendingMessage = _.get(t, "message") || "The instance is being provisioned asynchronously.");
1304613054
};
1304713055
s.$doCheck = function() {
13048-
s.notifications = r.getNotifications(s.apiObject, s.state), s.displayName = l(s.apiObject, s.state.serviceClasses), s.isBindable = a.isServiceBindable(s.apiObject, s.state.serviceClasses), s.description = u();
13056+
d(), s.notifications = r.getNotifications(s.apiObject, s.state), s.displayName = l(s.apiObject, s.state.serviceClasses), s.isBindable = !s.instanceError && a.isServiceBindable(s.apiObject, s.state.serviceClasses), s.description = u();
1304913057
}, s.$onChanges = function(e) {
1305013058
e.bindings && (s.deleteableBindings = _.reject(s.bindings, "metadata.deletionTimestamp"));
1305113059
}, s.getSecretForBinding = function(e) {
1305213060
return e && _.get(s, [ "state", "secrets", e.spec.secretName ]);
1305313061
}, s.actionsDropdownVisible = function() {
13054-
return !(!s.isBindable || !i.canI({
13062+
return !(_.get(s.apiObject, "metadata.deletionTimestamp") || (!s.isBindable || !i.canI({
1305513063
resource: "bindings",
1305613064
group: "servicecatalog.k8s.io"
13057-
}, "create")) || !(_.isEmpty(s.deleteableBindings) || !i.canI({
13065+
}, "create")) && (_.isEmpty(s.deleteableBindings) || !i.canI({
1305813066
resource: "bindings",
1305913067
group: "servicecatalog.k8s.io"
13060-
}, "delete")) || !!i.canI({
13068+
}, "delete")) && !i.canI({
1306113069
resource: "instances",
1306213070
group: "servicecatalog.k8s.io"
13063-
}, "delete");
13071+
}, "delete"));
1306413072
}, s.closeOverlayPanel = function() {
1306513073
_.set(s, "overlay.panelVisible", !1);
1306613074
}, s.showOverlayPanel = function(e, t) {
@@ -13957,15 +13965,15 @@ return _.get(e, "params.project") !== _.get(t, "params.project");
1395713965
C(r.project).then(function() {
1395813966
k(r.project, B), $(r.project), A();
1395913967
});
13960-
}, x = function() {
13968+
}, F = function() {
1396113969
r.project && O(), f.push(o.$on("$routeChangeSuccess", function(e, t, n) {
1396213970
U(t, n) && (g.customScope.projectName = r.project, O());
1396313971
})), f.push(o.$on("NotificationDrawerWrapper.toggle", function() {
1396413972
g.drawerHidden = !g.drawerHidden;
1396513973
}));
1396613974
};
1396713975
g.$onInit = function() {
13968-
m || p || x();
13976+
m || p || F();
1396913977
}, g.$onDestroy = function() {
1397013978
j(), w(), D();
1397113979
};

0 commit comments

Comments
 (0)