1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-25 08:19:40 +02:00

feat(ux): always display search bar in datatables (#2034)

This commit is contained in:
Anthony Lapenna 2018-07-11 16:18:44 +02:00 committed by GitHub
parent b6792461a4
commit cdf79c731b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
76 changed files with 66 additions and 244 deletions

View file

@ -5,11 +5,6 @@
<div class="toolBarTitle">
<i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }}
</div>
<div class="settings">
<span class="setting" ng-class="{ 'setting-active': $ctrl.state.displayTextFilter }" ng-click="$ctrl.updateDisplayTextFilter()" ng-if="$ctrl.showTextFilter">
<i class="fa fa-search" aria-hidden="true"></i> Search
</span>
</div>
</div>
<div class="actionBar">
<div class="btn-group">
@ -29,7 +24,7 @@
<i class="fa fa-plus space-right" aria-hidden="true"></i>Build a new image
</button>
</div>
<div class="searchBar" ng-if="$ctrl.state.displayTextFilter">
<div class="searchBar">
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
<input type="text" class="searchInput" ng-model="$ctrl.state.textFilter" placeholder="Search..." auto-focus>
</div>

View file

@ -8,7 +8,6 @@ angular.module('portainer.docker').component('imagesDatatable', {
tableKey: '@',
orderBy: '@',
reverseOrder: '<',
showTextFilter: '<',
showHostColumn: '<',
removeAction: '<',
forceRemoveAction: '<'

View file

@ -12,7 +12,7 @@ function (PaginationService, DatatableService) {
selectedItemCount: 0,
selectedItems: []
};
this.filters = {
usage: {
open: false,
@ -52,23 +52,16 @@ function (PaginationService, DatatableService) {
PaginationService.setPaginationLimit(this.tableKey, this.state.paginatedItemLimit);
};
this.updateDisplayTextFilter = function() {
this.state.displayTextFilter = !this.state.displayTextFilter;
if (!this.state.displayTextFilter) {
delete this.state.textFilter;
}
};
this.applyFilters = function(value, index, array) {
var image = value;
var filters = ctrl.filters;
if ((image.ContainerCount === 0 && filters.usage.showUnusedImages)
if ((image.ContainerCount === 0 && filters.usage.showUnusedImages)
|| (image.ContainerCount !== 0 && filters.usage.showUsedImages)) {
return true;
}
return false;
};
this.onUsageFilterChange = function() {
var filters = this.filters.usage;
var filtered = false;
@ -87,7 +80,7 @@ function (PaginationService, DatatableService) {
this.state.reverseOrder = storedOrder.reverse;
this.state.orderBy = storedOrder.orderBy;
}
var storedFilters = DatatableService.getDataTableFilters(this.tableKey);
if (storedFilters !== null) {
this.filters = storedFilters;