diff --git a/components/cloud-foundry/src/view/applications/list/list.module.js b/components/cloud-foundry/src/view/applications/list/list.module.js index a50b3a14de..8748f287e8 100644 --- a/components/cloud-foundry/src/view/applications/list/list.module.js +++ b/components/cloud-foundry/src/view/applications/list/list.module.js @@ -82,8 +82,8 @@ // Width at which we automatically switch to the grid layout var FORCE_GRID_LAYOUT_WIDTH = 640; - // If we have previous apps show the stale values from cache. This avoids showing a blank screen for the majority - // use case where nothing has changed. + // If we have previous apps then show the stale values from cache. This avoids showing a blank screen for + // the majority of use cases where nothing has changed. this.ready = this.model.hasApps; // Force card layout on smaller screen sizes - listen for resize events @@ -206,8 +206,15 @@ if (this.model.filterLastCluster) { var intersection = _.intersection(this.model.filterLastCluster, clusterGuids); if (this.model.filterLastCluster.length !== intersection.length || clusterGuids.length !== intersection.length) { - // Set of GUIDs has changed, so reset the filter + // Set of GUIDs has changed, so reset the all filters. This avoids confusion for users when they add a new cf + // and don't see any new apps due to a pre-existing filter. this.model.filterParams.cnsiGuid = 'all'; + this.model.filterParams.orgGuid = 'all'; + this.model.filterParams.spaceGuid = 'all'; + // Also up front reset local filter values + this.filter.cnsiGuid = this.model.filterParams.cnsiGuid; + this.filter.orgGuid = this.model.filterParams.orgGuid; + this.filter.spaceGuid = this.model.filterParams.spaceGuid; } } @@ -253,9 +260,6 @@ } }); } else { - // Ensure any previous values are wiped - that.model.filterParams.orgGuid = 'all'; - that.filter.orgGuid = that.model.filterParams.orgGuid; return this.$q.resolve(); } }, @@ -293,9 +297,6 @@ } }); } else { - // Ensure any previous values are wiped - that.model.filterParams.spaceGuid = 'all'; - that.filter.spaceGuid = that.model.filterParams.spaceGuid; return this.$q.resolve(); } }, diff --git a/components/cloud-foundry/test/unit/view/applications/list/list.module.spec.js b/components/cloud-foundry/test/unit/view/applications/list/list.module.spec.js index 20f378a2f6..d62eb0196c 100644 --- a/components/cloud-foundry/test/unit/view/applications/list/list.module.spec.js +++ b/components/cloud-foundry/test/unit/view/applications/list/list.module.spec.js @@ -438,8 +438,7 @@ appModel.filterParams.spaceGuid = 'junk3'; setUp(); - // Kick of a digest, we only make a call when we have a valid org - $scope.$digest(); + $httpBackend.flush(); check(allFilterValue, 3, allFilterValue, 1, allFilterValue, 1); }); @@ -449,7 +448,6 @@ appModel.filterParams.cnsiGuid = 'junk1'; setUp(); - // Kick of a digest, we only make a call when we have a valid org $scope.$digest(); check(allFilterValue, 3, allFilterValue, 1, allFilterValue, 1); @@ -461,7 +459,6 @@ appModel.filterParams.orgGuid = 'junk2'; setUp(); - // Kick of a digest, we only make a call when we have a valid org $scope.$digest(); check(cnsiGuid, 3, allFilterValue, 3, allFilterValue, 1);