diff --git a/src/js/index.js b/src/js/index.js index 42fd6ee9d..a14488dc6 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -196,6 +196,21 @@ app.filter('selectedStateFilter', function () { }; }); +app.filter('selectedGroupAccessFilter', function () { + return function selectedGroupAccessFilter(apps, group) { + return apps.filter(function (app) { + if (!group.id) return true; // case for no filter entry + if (!app.accessRestriction) return true; + + if (!app.accessRestriction.groups) return false; + + if (app.accessRestriction.groups.indexOf(group.id) !== -1) return true; + + return false; + }); + }; +}); + app.filter('selectedTagFilter', function () { return function selectedTagFilter(apps, selectedTags) { return apps.filter(function (app) { diff --git a/src/views/apps.html b/src/views/apps.html index 2f824b5b4..fc6d2995a 100644 --- a/src/views/apps.html +++ b/src/views/apps.html @@ -107,6 +107,7 @@
+ @@ -117,7 +118,7 @@
-
+
diff --git a/src/views/apps.js b/src/views/apps.js index 2075c0c9b..e27d9d2a5 100644 --- a/src/views/apps.js +++ b/src/views/apps.js @@ -5,6 +5,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$translate', '$interval', '$location', 'Client', function ($scope, $translate, $interval, $location, Client) { var ALL_DOMAINS_DOMAIN = { _alldomains: true, domain: 'All Domains' }; // dummy record for the single select filter + var GROUP_ACCESS_UNSET = { _unset: true, name: 'No Group Filter' }; // dummy record for the single select filter $scope.installedApps = Client.getInstalledApps(); $scope.tags = Client.getAppTags(); @@ -16,12 +17,14 @@ angular.module('Application').controller('AppsController', ['$scope', '$translat ]; $scope.selectedState = $scope.states[0]; $scope.selectedTags = []; + $scope.selectedGroup = GROUP_ACCESS_UNSET; $scope.selectedDomain = ALL_DOMAINS_DOMAIN; $scope.filterDomains = [ ALL_DOMAINS_DOMAIN ]; $scope.config = Client.getConfig(); $scope.user = Client.getUserInfo(); $scope.domains = []; $scope.appSearch = ''; + $scope.groups = [ GROUP_ACCESS_UNSET ]; $translate(['apps.stateFilterHeader', 'apps.domainsFilterHeader', 'app.states.running', 'app.states.stopped', 'app.states.notResponding']).then(function (tr) { if (tr['apps.domainsFilterHeader']) ALL_DOMAINS_DOMAIN.domain = tr['apps.domainsFilterHeader']; @@ -107,6 +110,12 @@ angular.module('Application').controller('AppsController', ['$scope', '$translat else $scope.selectedTags = localStorage.selectedTags.split(','); } + Client.getGroups(function (error, result) { + if (error) Client.error(error); + + $scope.groups = [ GROUP_ACCESS_UNSET ].concat(result); + }); + Client.getDomains(function (error, result) { if (error) Client.error(error);