Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Commit

Permalink
Pre-sort service instances in cloud foundry space instances table (#1233
Browse files Browse the repository at this point in the history
)

* Pre-sort service instances in cloud foundry space instances table

* Fix unit tests
  • Loading branch information
richard-cox authored and nwmac committed Aug 25, 2017
1 parent 5643f21 commit 47c8c18
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
@@ -1,5 +1,5 @@
<div class="space-services-table">
<div ng-if="!spaceSrvsCtrl.serviceInstances || spaceSrvsCtrl.serviceInstances.length < 1"
<div ng-if="spaceSrvsCtrl.serviceInstances && spaceSrvsCtrl.serviceInstances.length < 1"
class="panel panel-default cluster-empty-list">
<div class="panel-body" translate>cf.space-info.tabs.services.none</div>
</div>
Expand Down
Expand Up @@ -60,19 +60,23 @@

appUtilsService.chainStateResolve('endpoint.clusters.cluster.organization.space.detail.services', $state, init);

function setServiceInstances(serviceInstances) {
vm.serviceInstances = _.sortBy(serviceInstances, function (o) { return o.entity.name.toLowerCase(); });
}

function init() {
if (angular.isUndefined(spaceDetail().instances)) {
return update();
}
vm.serviceInstances = spaceDetail().instances;
setServiceInstances(spaceDetail().instances);
return $q.resolve();
}

function update(serviceInstance) {
return spaceModel.listAllServiceInstancesForSpace(vm.clusterGuid, vm.spaceGuid, {
return_user_provided_service_instances: true
}).then(function () {
vm.serviceInstances = spaceDetail().instances;
setServiceInstances(spaceDetail().instances);
if (serviceInstance) {
updateActions([serviceInstance]);
spaceModel.updateServiceInstanceCount(vm.clusterGuid, vm.spaceGuid, _.keys(spaceDetail().instances).length);
Expand Down
Expand Up @@ -17,6 +17,7 @@
guid: 'serviceGuid'
},
entity: {
name: 'serviceName'
}
};
var space = {
Expand Down

0 comments on commit 47c8c18

Please sign in to comment.