From 47c8c182453a9c65bb591e80e721fa802f050791 Mon Sep 17 00:00:00 2001 From: Richard Cox Date: Fri, 25 Aug 2017 12:10:16 +0100 Subject: [PATCH] Pre-sort service instances in cloud foundry space instances table (#1233) * Pre-sort service instances in cloud foundry space instances table * Fix unit tests --- .../space/detail/services/space-services.html | 2 +- .../space/detail/services/space-services.module.js | 8 ++++++-- .../organization/space/space-services.module.spec.js | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/components/cloud-foundry/frontend/src/view/dashboard/cluster/organization/space/detail/services/space-services.html b/components/cloud-foundry/frontend/src/view/dashboard/cluster/organization/space/detail/services/space-services.html index b9064ecf00..3d38139451 100644 --- a/components/cloud-foundry/frontend/src/view/dashboard/cluster/organization/space/detail/services/space-services.html +++ b/components/cloud-foundry/frontend/src/view/dashboard/cluster/organization/space/detail/services/space-services.html @@ -1,5 +1,5 @@
-
cf.space-info.tabs.services.none
diff --git a/components/cloud-foundry/frontend/src/view/dashboard/cluster/organization/space/detail/services/space-services.module.js b/components/cloud-foundry/frontend/src/view/dashboard/cluster/organization/space/detail/services/space-services.module.js index 61d23c70b0..ef9168fc65 100644 --- a/components/cloud-foundry/frontend/src/view/dashboard/cluster/organization/space/detail/services/space-services.module.js +++ b/components/cloud-foundry/frontend/src/view/dashboard/cluster/organization/space/detail/services/space-services.module.js @@ -60,11 +60,15 @@ 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(); } @@ -72,7 +76,7 @@ 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); diff --git a/components/cloud-foundry/frontend/test/unit/view/dashboard/cluster/organization/space/space-services.module.spec.js b/components/cloud-foundry/frontend/test/unit/view/dashboard/cluster/organization/space/space-services.module.spec.js index 1bf16656fc..d98fb518b7 100644 --- a/components/cloud-foundry/frontend/test/unit/view/dashboard/cluster/organization/space/space-services.module.spec.js +++ b/components/cloud-foundry/frontend/test/unit/view/dashboard/cluster/organization/space/space-services.module.spec.js @@ -17,6 +17,7 @@ guid: 'serviceGuid' }, entity: { + name: 'serviceName' } }; var space = {