dashboard: preserve apps view type in localStorage

This commit is contained in:
Johannes Zellner
2024-04-06 16:16:48 +02:00
parent 24c8fca971
commit 052b705c3c
2 changed files with 15 additions and 1 deletions

View File

@@ -51,6 +51,18 @@ angular.module('Application').controller('AppsController', ['$scope', '$translat
return item.label || item.fqdn;
};
$scope.setView = function (view) {
if (view !== 'list' && view !== 'grid') return;
$scope.view = view;
localStorage.appsView = view;
};
$scope.toggleView = function () {
$scope.view = $scope.view === 'grid' ? 'list' : 'grid';
localStorage.appsView = $scope.view;
};
$scope.$watch('selectedTags', function (newVal, oldVal) {
if (newVal === oldVal) return;
@@ -257,6 +269,8 @@ angular.module('Application').controller('AppsController', ['$scope', '$translat
});
});
$scope.setView(localStorage.appsView);
if (!$scope.user.isAtLeastAdmin) return;
// load local settings and apply tag filter