Skip to content

Commit c9e0ba3

Browse files
committed
Add username requester on bind for template broker
1 parent 4216093 commit c9e0ba3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

app/scripts/directives/bindService.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
newestNotReady = instance;
3939
}
4040
});
41-
ctrl.serviceToBind = _.get(newestReady, 'metadata.name') || _.get(newestNotReady, 'metadata.name');
41+
ctrl.serviceToBind = newestReady || newestNotReady;
4242
};
4343

4444
var sortServiceInstances = function() {
@@ -201,14 +201,15 @@
201201
};
202202

203203
ctrl.bindService = function() {
204-
var svcToBind = ctrl.target.kind === 'Instance' ? ctrl.target : ctrl.serviceInstances[ctrl.serviceToBind];
204+
var svcToBind = ctrl.target.kind === 'Instance' ? ctrl.target : ctrl.serviceToBind;
205205
var application = ctrl.bindType === 'application' ? ctrl.appToBind : undefined;
206206

207207
var context = {
208208
namespace: _.get(svcToBind, 'metadata.namespace')
209209
};
210210

211-
BindingService.bindService(context, _.get(svcToBind, 'metadata.name'), application).then(function(binding){
211+
var serviceClass = BindingService.getServiceClassForInstance(svcToBind, ctrl.serviceClasses);
212+
BindingService.bindService(svcToBind, application, serviceClass).then(function(binding){
212213
ctrl.binding = binding;
213214
ctrl.error = null;
214215

0 commit comments

Comments
 (0)