dashboard: grid view is the default

This commit is contained in:
Johannes Zellner
2024-04-29 09:32:00 +02:00
parent 7eda1136ea
commit d2ae6c2353
2 changed files with 12 additions and 6 deletions

View File

@@ -140,7 +140,7 @@
<button class="btn btn-default" type="button" ng-class="{ 'active': showFilter }" ng-click="toggleFilter()"><i class="fas fa-filter"></i> <span ng-show="selectedTags.length || selectedState.state || !selectedGroup._unset || !selectedDomain._alldomains">{{ !!selectedTags.length + !!selectedState.state + !selectedGroup._unset + !selectedDomain._alldomains }}</span></button>
</span>
</div>
<button class="btn btn-default" type="button" ng-click="toggleView()"><i class="fas" ng-class="{ 'fa-list': view === 'grid', 'fa-grip': view === 'list' }"></i></button>
<button class="btn btn-default" type="button" ng-click="toggleView()"><i class="fas" ng-class="{ 'fa-list': view === VIEWS.GRID, 'fa-grip': view === VIEWS.LIST }"></i></button>
</form>
</div>
</h1>
@@ -156,7 +156,7 @@
</div>
<div class="animateMeOpacity ng-hide" ng-show="installedApps.length > 0">
<div class="app-grid" ng-show="view === 'grid'">
<div class="app-grid" ng-show="view === VIEWS.GRID">
<div class="grid-item" ng-class="{ 'stopped': app.runState === 'stopped' }" ng-repeat="app in installedApps | selectedGroupAccessFilter:selectedGroup | selectedStateFilter:selectedState | selectedTagFilter:selectedTags | selectedDomainFilter:selectedDomain | appSearchFilter:appSearch | orderBy:orderByFilter">
<div class="grid-item-content" uib-tooltip="{{ app.fqdn }}">
<a ng-show="app.type !== APP_TYPES.LINK && isOperator(app)" ng-href="#/app/{{ app.id}}/info" class="btn btn-lg btn-default grid-item-action"><i class="fas fa-cog"></i></a>
@@ -201,7 +201,7 @@
</div>
</div>
<div class="app-list card card-large" ng-show="view === 'list'">
<div class="app-list card card-large" ng-show="view === VIEWS.LIST">
<table class="table table-hover" style="margin: 0;">
<thead>
<tr>

View File

@@ -31,7 +31,13 @@ angular.module('Application').controller('AppsController', ['$scope', '$translat
$scope.APP_TYPES = APP_TYPES;
$scope.showFilter = false;
$scope.filterActive = false;
$scope.view = 'list';
$scope.VIEWS = {
GRID: 'grid',
LIST: 'list'
};
$scope.view = $scope.VIEWS.GRID;
$scope.orderBy = 'location'; // or app, status, sso
$scope.orderByReverse = false;
@@ -70,14 +76,14 @@ angular.module('Application').controller('AppsController', ['$scope', '$translat
};
$scope.setView = function (view) {
if (view !== 'list' && view !== 'grid') return;
if (view !== $scope.VIEWS.LIST && view !== $scope.VIEWS.GRID) return;
$scope.view = view;
localStorage.appsView = view;
};
$scope.toggleView = function () {
$scope.view = $scope.view === 'grid' ? 'list' : 'grid';
$scope.view = $scope.view === $scope.VIEWS.GRID ? $scope.VIEWS.LIST : $scope.VIEWS.GRID;
localStorage.appsView = $scope.view;
};