Skip to content

Commit

Permalink
Merge pull request #2147 from jeff-phillips-18/bind
Browse files Browse the repository at this point in the history
Merged by openshift-bot
  • Loading branch information
OpenShift Bot committed Sep 22, 2017
2 parents d9b8e75 + bb43395 commit 1dae20b
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 27 deletions.
1 change: 1 addition & 0 deletions app/scripts/directives/overview/serviceBindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ angular.module('openshiftConsole').component('overviewServiceBindings', {
bindings: {
sectionTitle: '@',
namespace: '<',
refApiObject: '<',
bindings: '<',
bindableServiceInstances: '<',
serviceClasses: '<',
Expand Down
11 changes: 7 additions & 4 deletions app/scripts/directives/serviceBinding.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@

function ServiceBinding() {
var ctrl = this;

var updateServiceClass = function() {
var instanceName = _.get(ctrl.binding, 'spec.instanceRef.name');
var instance = _.get(ctrl.serviceInstances, [instanceName]);
var serviceClassName = _.get(instance, 'spec.serviceClassName');
ctrl.serviceClass = _.get(ctrl.serviceClasses, [serviceClassName]);
if (_.get(ctrl.refApiObject, 'kind') !== 'ServiceInstance') {
var instanceName = _.get(ctrl.binding, 'spec.instanceRef.name');
var instance = _.get(ctrl.serviceInstances, [instanceName]);
var serviceClassName = _.get(instance, 'spec.serviceClassName');
ctrl.serviceClass = _.get(ctrl.serviceClasses, [serviceClassName]);
}
};

this.$onChanges = function(changes) {
Expand Down
15 changes: 5 additions & 10 deletions app/views/directives/_service-binding.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,13 @@ <h3>
<div class="component-label">
Secret
</div>
<span ng-if="$ctrl.serviceClass">
<span ng-if="$ctrl.refApiObject.kind !== 'ServiceInstance'">
{{$ctrl.binding.metadata.name}}
<span ng-if="$ctrl.refApiObject.kind !== 'ServiceInstance'">
<small ng-if="$ctrl.serviceClass">
{{$ctrl.serviceClass.externalMetadata.displayName || $ctrl.serviceClass.metadata.name}}
</span>
<span ng-if="$ctrl.refApiObject.kind === 'ServiceInstance'">
{{$ctrl.binding.spec.secretName}}
</span>
</small>
<small>{{$ctrl.binding.spec.instanceRef.name}}</small>
</span>
<span ng-if="!$ctrl.serviceClass">
{{$ctrl.binding.spec.instanceRef.name}}
</span>
<small ng-if="$ctrl.serviceClass">{{$ctrl.binding.spec.instanceRef.name}}</small>
<small>created <span am-time-ago="$ctrl.binding.metadata.creationTimestamp"></span></small>
</h3>
</div>
Expand Down
2 changes: 2 additions & 0 deletions app/views/overview/_list-row-expanded.html
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ <h4 class="h5">Average Usage <small>Last 15 Minutes</small></h4>
<uib-tab-heading>Bindings</uib-tab-heading>
<overview-service-bindings
section-title="Service Bindings"
ref-api-object="row.apiObject"
namespace="row.apiObject.metadata.namespace"
bindings="row.bindings"
bindable-service-instances="row.state.bindableServiceInstances"
Expand Down Expand Up @@ -216,6 +217,7 @@ <h4 class="h5">Average Usage <small>Last 15 Minutes</small></h4>
<overview-service-bindings
section-title="Service Bindings"
ng-if="row.showBindings && (row.bindings | size)"
ref-api-object="row.apiObject"
namespace="row.apiObject.metadata.namespace"
bindings="row.bindings"
bindable-service-instances="row.state.bindableServiceInstances"
Expand Down
1 change: 1 addition & 0 deletions app/views/overview/_service-bindings.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
ng-repeat="binding in $ctrl.bindings track by (binding | uid)"
is-overview="true"
namespace="$ctrl.namespace"
ref-api-object="$ctrl.refApiObject"
binding="binding"
service-classes="$ctrl.serviceClasses"
service-instances="$ctrl.serviceInstances"
Expand Down
1 change: 1 addition & 0 deletions app/views/overview/_service-instance-row.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ <h3>
<overview-service-bindings
ng-if="row.isBindable || row.bindings"
section-title="Bindings"
ref-api-object="row.apiObject"
namespace="row.apiObject.metadata.namespace"
bindings="row.bindings"
bindable-service-instances="row.state.bindableServiceInstances"
Expand Down
3 changes: 3 additions & 0 deletions dist/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -13170,8 +13170,10 @@ n.imageIDs = r ? [ r ] : t.getImageIDs(n.pods, e.name);
angular.module("openshiftConsole").component("serviceBinding", {
controller: [ function() {
var e = this, t = function() {
if ("ServiceInstance" !== _.get(e.refApiObject, "kind")) {
var t = _.get(e.binding, "spec.instanceRef.name"), n = _.get(e.serviceInstances, [ t ]), a = _.get(n, "spec.serviceClassName");
e.serviceClass = _.get(e.serviceClasses, [ a ]);
}
};
this.$onChanges = function(e) {
(e.binding || e.serviceInstances || e.serviceClasses) && t();
Expand Down Expand Up @@ -13591,6 +13593,7 @@ controllerAs: "$ctrl",
bindings: {
sectionTitle: "@",
namespace: "<",
refApiObject: "<",
bindings: "<",
bindableServiceInstances: "<",
serviceClasses: "<",
Expand Down
21 changes: 8 additions & 13 deletions dist/scripts/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -5606,18 +5606,13 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<div class=\"component-label\">\n" +
"Secret\n" +
"</div>\n" +
"<span ng-if=\"$ctrl.serviceClass\">\n" +
"{{$ctrl.binding.metadata.name}}\n" +
"<span ng-if=\"$ctrl.refApiObject.kind !== 'ServiceInstance'\">\n" +
"<small ng-if=\"$ctrl.serviceClass\">\n" +
"{{$ctrl.serviceClass.externalMetadata.displayName || $ctrl.serviceClass.metadata.name}}\n" +
"</small>\n" +
"<small>{{$ctrl.binding.spec.instanceRef.name}}</small>\n" +
"</span>\n" +
"<span ng-if=\"$ctrl.refApiObject.kind === 'ServiceInstance'\">\n" +
"{{$ctrl.binding.spec.secretName}}\n" +
"</span>\n" +
"</span>\n" +
"<span ng-if=\"!$ctrl.serviceClass\">\n" +
"{{$ctrl.binding.spec.instanceRef.name}}\n" +
"</span>\n" +
"<small ng-if=\"$ctrl.serviceClass\">{{$ctrl.binding.spec.instanceRef.name}}</small>\n" +
"<small>created <span am-time-ago=\"$ctrl.binding.metadata.creationTimestamp\"></span></small>\n" +
"</h3>\n" +
"</div>\n" +
Expand Down Expand Up @@ -12065,7 +12060,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"</uib-tab>\n" +
"<uib-tab ng-if=\"row.showBindings && (row.bindings | size)\" active=\"row.selectedTab.bindings\">\n" +
"<uib-tab-heading>Bindings</uib-tab-heading>\n" +
"<overview-service-bindings section-title=\"Service Bindings\" namespace=\"row.apiObject.metadata.namespace\" bindings=\"row.bindings\" bindable-service-instances=\"row.state.bindableServiceInstances\" service-classes=\"row.state.serviceClasses\" service-instances=\"row.state.serviceInstances\" create-binding=\"row.showOverlayPanel('bindService', {target: row.apiObject})\">\n" +
"<overview-service-bindings section-title=\"Service Bindings\" ref-api-object=\"row.apiObject\" namespace=\"row.apiObject.metadata.namespace\" bindings=\"row.bindings\" bindable-service-instances=\"row.state.bindableServiceInstances\" service-classes=\"row.state.serviceClasses\" service-instances=\"row.state.serviceInstances\" create-binding=\"row.showOverlayPanel('bindService', {target: row.apiObject})\">\n" +
"</overview-service-bindings>\n" +
"</uib-tab>\n" +
"</uib-tabset>\n" +
Expand All @@ -12081,7 +12076,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"\n" +
"<overview-builds build-configs=\"row.buildConfigs\" recent-builds-by-build-config=\"row.state.recentBuildsByBuildConfig\" context=\"row.state.context\" hide-log=\"row.state.limitWatches\">\n" +
"</overview-builds>\n" +
"<overview-service-bindings section-title=\"Service Bindings\" ng-if=\"row.showBindings && (row.bindings | size)\" namespace=\"row.apiObject.metadata.namespace\" bindings=\"row.bindings\" bindable-service-instances=\"row.state.bindableServiceInstances\" service-classes=\"row.state.serviceClasses\" service-instances=\"row.state.serviceInstances\" create-binding=\"row.showOverlayPanel('bindService', {target: row.apiObject})\">\n" +
"<overview-service-bindings section-title=\"Service Bindings\" ng-if=\"row.showBindings && (row.bindings | size)\" ref-api-object=\"row.apiObject\" namespace=\"row.apiObject.metadata.namespace\" bindings=\"row.bindings\" bindable-service-instances=\"row.state.bindableServiceInstances\" service-classes=\"row.state.serviceClasses\" service-instances=\"row.state.serviceInstances\" create-binding=\"row.showOverlayPanel('bindService', {target: row.apiObject})\">\n" +
"</overview-service-bindings>\n" +
"</div>\n" +
"</div>\n" +
Expand Down Expand Up @@ -12261,7 +12256,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
$templateCache.put('views/overview/_service-bindings.html',
"<div class=\"expanded-section\">\n" +
"<div class=\"section-title hidden-xs\">{{$ctrl.sectionTitle}}</div>\n" +
"<service-binding ng-repeat=\"binding in $ctrl.bindings track by (binding | uid)\" is-overview=\"true\" namespace=\"$ctrl.namespace\" binding=\"binding\" service-classes=\"$ctrl.serviceClasses\" service-instances=\"$ctrl.serviceInstances\" secrets=\"$ctrl.secrets\">\n" +
"<service-binding ng-repeat=\"binding in $ctrl.bindings track by (binding | uid)\" is-overview=\"true\" namespace=\"$ctrl.namespace\" ref-api-object=\"$ctrl.refApiObject\" binding=\"binding\" service-classes=\"$ctrl.serviceClasses\" service-instances=\"$ctrl.serviceInstances\" secrets=\"$ctrl.secrets\">\n" +
"</service-binding>\n" +
"<div ng-if=\"($ctrl.bindableServiceInstances | size) && ({resource: 'serviceinstancecredentials', group: 'servicecatalog.k8s.io'} | canI : 'create')\">\n" +
"<a href=\"\" ng-click=\"$ctrl.createBinding()\" role=\"button\">\n" +
Expand Down Expand Up @@ -12423,7 +12418,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<p class=\"pre-wrap\" ng-bind-html=\"row.description | linky\"></p>\n" +
"</div>\n" +
"</div>\n" +
"<overview-service-bindings ng-if=\"row.isBindable || row.bindings\" section-title=\"Bindings\" namespace=\"row.apiObject.metadata.namespace\" bindings=\"row.bindings\" bindable-service-instances=\"row.state.bindableServiceInstances\" service-classes=\"row.state.serviceClasses\" create-binding=\"row.showOverlayPanel('bindService', {target: row.apiObject})\">\n" +
"<overview-service-bindings ng-if=\"row.isBindable || row.bindings\" section-title=\"Bindings\" ref-api-object=\"row.apiObject\" namespace=\"row.apiObject.metadata.namespace\" bindings=\"row.bindings\" bindable-service-instances=\"row.state.bindableServiceInstances\" service-classes=\"row.state.serviceClasses\" create-binding=\"row.showOverlayPanel('bindService', {target: row.apiObject})\">\n" +
"</overview-service-bindings>\n" +
"</div>\n" +
"</div>\n" +
Expand Down

0 comments on commit 1dae20b

Please sign in to comment.