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

Fix issue where app wall filters were only semi cleared after being reset #2 #1077

Merged
merged 5 commits into from
Jun 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions components/cloud-foundry/src/view/applications/list/list.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
}

Expand Down Expand Up @@ -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();
}
},
Expand Down Expand Up @@ -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();
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand All @@ -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);
Expand All @@ -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);
Expand Down