Fix domain filter select

This commit is contained in:
Johannes Zellner
2019-05-20 23:40:02 +02:00
parent 9a859629bc
commit 765307ddef
3 changed files with 12 additions and 10 deletions
+5 -7
View File
@@ -225,15 +225,13 @@ app.filter('selectedTagFilter', function () {
});
app.filter('selectedDomainFilter', function () {
return function selectedDomainFilter(apps, selectedDomains) {
return function selectedDomainFilter(apps, selectedDomain) {
return apps.filter(function (app) {
if (selectedDomains.length === 0) return true;
if (!selectedDomain) return true;
if (selectedDomain._alldomains) return true; // magic domain for single select, see apps.js ALL_DOMAINS_DOMAIN
return !!selectedDomains.find(function (domain) {
if (app.domain === domain.domain) return true;
return !!app.alternateDomains.find(function (ad) { return ad.domain === domain.domain; });
});
if (selectedDomain.domain === app.domain) return true;
return !!app.alternateDomains.find(function (ad) { return ad.domain === selectedDomain.domain; });
});
};
});
+2 -2
View File
@@ -487,14 +487,14 @@
Your Apps
<div class="pull-right">
<multiselect ng-model="selectedTags" ng-show="tags.length > 0" ms-header="All Tags" ms-selected="Tags: {{ selectedTags.join(', ') }}" options="tag for tag in tags" data-multiple="true"></multiselect>
<multiselect ng-model="selectedDomains" ng-show="domains.length > 1" ms-header="All Domains" ms-selected="{{ selectedDomains | prettyDomains }}" options="domain.domain for domain in domains" data-multiple="false"></multiselect>
<multiselect ng-model="selectedDomain" ng-show="filterDomains.length > 2" data-compare-by="domain" ms-selected="{{ selectedDomain.domain }}" options="domain.domain for domain in filterDomains" data-multiple="false"></multiselect>
</div>
</h1>
</div>
<div class="animateMeOpacity ng-hide" ng-show="installedApps.length > 0">
<div class="app-grid">
<div class="grid-item" ng-repeat="app in installedApps | selectedTagFilter:selectedTags | selectedDomainFilter:selectedDomains | orderBy:'location'">
<div class="grid-item" ng-repeat="app in installedApps | selectedTagFilter:selectedTags | selectedDomainFilter:selectedDomain | orderBy:'location'">
<a ng-href="{{ app | applicationLink }}" ng-click="((app | installError) === true && showError(app)) || ((app | appIsInstalledAndHealthy) && app.pendingPostInstallConfirmation && appPostInstallConfirm.show(app))" target="_blank" ng-class="{ 'hand': (app | appIsInstalledAndHealthy) }">
<div style="background-color: white;" class="highlight grid-item-content" uib-tooltip="{{ app.fqdn }}">
<div class="grid-item-top">
+5 -1
View File
@@ -4,12 +4,15 @@
/* global $:false */
angular.module('Application').controller('AppsController', ['$scope', '$location', '$timeout', '$interval', 'Client', function ($scope, $location, $timeout, $interval, Client) {
var ALL_DOMAINS_DOMAIN = { _alldomains: true, domain: 'All Domains' }; // dummy record for the single select filter
$scope.HOST_PORT_MIN = 1024;
$scope.HOST_PORT_MAX = 65535;
$scope.installedApps = Client.getInstalledApps();
$scope.tags = Client.getAppTags();
$scope.selectedTags = [];
$scope.selectedDomains = [];
$scope.selectedDomain = ALL_DOMAINS_DOMAIN;
$scope.filterDomains = [ ALL_DOMAINS_DOMAIN ];
$scope.config = Client.getConfig();
$scope.user = Client.getUserInfo();
$scope.domains = [];
@@ -625,6 +628,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
}
$scope.domains = result;
$scope.filterDomains = [ALL_DOMAINS_DOMAIN].concat(result);
});
}