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

Persist app wall selection of cf/org/space in local storage #1214

Merged
merged 5 commits into from
Aug 16, 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
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
/**
* @function getItem
* @memberof app.view.appLocalStorage
* @description Get the item in the local storage for the given key. Optioanlly return the default value if not found.
* @description Get the item in the local storage for the given key. Optionally return the default value if not found.
* @param {string} key - key of value fo retrieve
* @param {string=} defaultValue - default value to be returned if no value is found
* @returns {string} value from local storage for the given key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
appStateMap: {}
},
pageSize: config.pagination.pageSize,
filterParams: {
filterParams: angular.fromJson(appLocalStorage.getItem('cf.filterParams')) || {
cnsiGuid: 'all',
orgGuid: 'all',
spaceGuid: 'all'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@
angular.element($window).off('resize', onResize);
});

$scope.$watch(function () {
return vm.model.filterParams.cnsiGuid + vm.model.filterParams.orgGuid + vm.model.filterParams.spaceGuid;
}, function () {
appLocalStorage.setItem('cf.filterParams', angular.toJson(vm.model.filterParams));
});

function onResize() {
var shouldForceCardLayout = $window.innerWidth <= FORCE_GRID_LAYOUT_WIDTH;
if (shouldForceCardLayout !== vm.forceCardLayout) {
Expand Down
2 changes: 2 additions & 0 deletions components/cloud-foundry/frontend/test/e2e/log-stream.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
return loginPage.loginAsAdmin();
})
.then(function () {
// Ensure that no org or space is selected when we come into the app wall
galleryWall.resetFilters();
return galleryWall.setGridView();
});
// Ensure we don't continue until everything is set up
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
var cfOrganizationModel = $injector.get('cfOrganizationModel');
var cfAppWallActions = $injector.get('cfAppWallActions');
var $window = $injector.get('$window');
var appLocalStorage = $injector.get('appLocalStorage');

var userCnsiModel = modelManager.retrieve('app.model.serviceInstance.user');
if (Object.keys(userCnsiModel.serviceInstances).length === 0) {
Expand All @@ -52,7 +53,7 @@

var ApplicationsListController = $state.get('cf.applications.list').controller;
$controller = new ApplicationsListController($scope, $translate, $state, $timeout, $q, $window, modelManager,
errorService, appUtilsService, cfOrganizationModel, cfAppWallActions);
errorService, appUtilsService, cfOrganizationModel, cfAppWallActions, appLocalStorage);
expect($controller).toBeDefined();

var listAllOrgs = mock.cloudFoundryAPI.Organizations.ListAllOrganizations('default');
Expand Down