[Web] Update footable to 3.1.6

[Web] Add domain filter to some tables
[Web] Fix lost focus when filtering elements
[Web] Alsmost remove input lag on table filter
This commit is contained in:
André 2018-07-21 22:31:20 +02:00
parent 0af5d5ed89
commit 649ab6c6fc
5 changed files with 95 additions and 18 deletions

File diff suppressed because one or more lines are too long

View File

@ -42,7 +42,7 @@ jQuery(function($){
}),
"empty": lang.empty,
"paging": {"enabled": true,"limit": 5,"size": log_pagination_size},
"filtering": {"enabled": true,"position": "left","connectors": false,"placeholder": lang.filter_table
"filtering": {"enabled": true,"delay": 1,"position": "left","connectors": false,"placeholder": lang.filter_table
},
"sorting": {"enabled": true}
});

View File

@ -60,7 +60,7 @@ jQuery(function($){
}),
"empty": lang.empty,
"paging": {"enabled": true,"limit": 5,"size": log_pagination_size},
"filtering": {"enabled": true,"position": "left","placeholder": lang.filter_table},
"filtering": {"enabled": true,"delay": 1,"position": "left","placeholder": lang.filter_table},
"sorting": {"enabled": true},
"on": {"ready.ft.table": function(e, ft){
heading = ft.$el.parents('.tab-pane').find('.panel-heading')
@ -92,7 +92,7 @@ jQuery(function($){
}),
"empty": lang.empty,
"paging": {"enabled": true,"limit": 5,"size": log_pagination_size},
"filtering": {"enabled": true,"position": "left","placeholder": lang.filter_table},
"filtering": {"enabled": true,"delay": 1,"position": "left","placeholder": lang.filter_table},
"sorting": {"enabled": true},
"on": {
"ready.ft.table": function(e, ft){
@ -126,7 +126,7 @@ jQuery(function($){
}),
"empty": lang.empty,
"paging": {"enabled": true,"limit": 5,"size": log_pagination_size},
"filtering": {"enabled": true,"position": "left","connectors": false,"placeholder": lang.filter_table},
"filtering": {"enabled": true,"delay": 1,"position": "left","connectors": false,"placeholder": lang.filter_table},
"sorting": {"enabled": true},
"on": {
"ready.ft.table": function(e, ft){
@ -161,7 +161,7 @@ jQuery(function($){
}),
"empty": lang.empty,
"paging": {"enabled": true,"limit": 5,"size": log_pagination_size},
"filtering": {"enabled": true,"position": "left","connectors": false,"placeholder": lang.filter_table},
"filtering": {"enabled": true,"delay": 1,"position": "left","connectors": false,"placeholder": lang.filter_table},
"sorting": {"enabled": true},
"on": {
"ready.ft.table": function(e, ft){
@ -193,7 +193,7 @@ jQuery(function($){
}),
"empty": lang.empty,
"paging": {"enabled": true,"limit": 5,"size": log_pagination_size},
"filtering": {"enabled": true,"position": "left","connectors": false,"placeholder": lang.filter_table},
"filtering": {"enabled": true,"delay": 1,"position": "left","connectors": false,"placeholder": lang.filter_table},
"sorting": {"enabled": true},
"on": {
"ready.ft.table": function(e, ft){
@ -226,7 +226,7 @@ jQuery(function($){
}),
"empty": lang.empty,
"paging": {"enabled": true,"limit": 5,"size": log_pagination_size},
"filtering": {"enabled": true,"position": "left","connectors": false,"placeholder": lang.filter_table},
"filtering": {"enabled": true,"delay": 1,"position": "left","connectors": false,"placeholder": lang.filter_table},
"sorting": {"enabled": true},
"on": {
"ready.ft.table": function(e, ft){
@ -259,7 +259,7 @@ jQuery(function($){
}),
"empty": lang.empty,
"paging": {"enabled": true,"limit": 5,"size": log_pagination_size},
"filtering": {"enabled": true,"position": "left","connectors": false,"placeholder": lang.filter_table},
"filtering": {"enabled": true,"delay": 1,"position": "left","connectors": false,"placeholder": lang.filter_table},
"sorting": {"enabled": true},
"on": {
"ready.ft.table": function(e, ft){
@ -292,7 +292,7 @@ jQuery(function($){
}),
"empty": lang.empty,
"paging": {"enabled": true,"limit": 5,"size": log_pagination_size},
"filtering": {"enabled": true,"position": "left","connectors": false,"placeholder": lang.filter_table},
"filtering": {"enabled": true,"delay": 1,"position": "left","connectors": false,"placeholder": lang.filter_table},
"sorting": {"enabled": true},
"on": {
"ready.ft.table": function(e, ft){
@ -334,7 +334,7 @@ jQuery(function($){
}),
"empty": lang.empty,
"paging": {"enabled": true,"limit": 5,"size": log_pagination_size},
"filtering": {"enabled": true,"position": "left","connectors": false,"placeholder": lang.filter_table},
"filtering": {"enabled": true,"delay": 1,"position": "left","connectors": false,"placeholder": lang.filter_table},
"sorting": {"enabled": true},
"on": {
"ready.ft.table": function(e, ft){

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,63 @@
$(document).ready(function() {
FooTable.domainFilter = FooTable.Filtering.extend({
construct: function(instance){
this._super(instance);
var domain_list = [];
$.ajax({
dataType: 'json',
'async': false,
url: '/api/v1/get/domain/all',
jsonp: false,
error: function () {
domain_list.push('Cannot read domain list');
},
success: function (data) {
$.each(data, function (i, item) {
domain_list.push(item.domain_name);
});
}
});
this.domains = domain_list;
this.def = 'All Domains';
this.$domain = null;
},
$create: function(){
this._super();
var self = this,
$form_grp = $('<div/>', {'class': 'form-group'})
.append($('<label/>', {'class': 'sr-only', text: 'Domain'}))
.prependTo(self.$form);
self.$domain = $('<select/>', { 'class': 'form-control' })
.on('change', {self: self}, self._onDomainDropdownChanged)
.append($('<option/>', {text: self.def}))
.appendTo($form_grp);
$.each(self.domains, function(i, domain){
self.$domain.append($('<option/>').text(domain));
});
},
_onDomainDropdownChanged: function(e){
var self = e.data.self,
selected = $(this).val();
if (selected !== self.def){
self.addFilter('domain', selected, ['domain']);
} else {
self.removeFilter('domain');
}
self.filter();
},
draw: function(){
this._super();
var domain = this.find('domain');
if (domain instanceof FooTable.Filter){
this.$domain.val(domain.query.val());
} else {
this.$domain.val(this.def);
}
$(this.$domain).closest("select").selectpicker();
}
});
// Auto-fill domain quota when adding new domain
auto_fill_quota = function(domain) {
$.get("/api/v1/get/domain/" + domain, function(data){
@ -207,6 +266,7 @@ jQuery(function($){
},
"filtering": {
"enabled": true,
"delay": 100,
"position": "left",
"connectors": false,
"placeholder": lang.filter_table
@ -281,10 +341,14 @@ jQuery(function($){
},
"filtering": {
"enabled": true,
"delay": 100,
"position": "left",
"connectors": false,
"placeholder": lang.filter_table
},
"components": {
"filtering": FooTable.domainFilter
},
"sorting": {
"enabled": true
}
@ -334,10 +398,14 @@ jQuery(function($){
},
"filtering": {
"enabled": true,
"delay": 100,
"position": "left",
"connectors": false,
"placeholder": lang.filter_table
},
"components": {
"filtering": FooTable.domainFilter
},
"sorting": {
"enabled": true
}
@ -387,6 +455,7 @@ jQuery(function($){
},
"filtering": {
"enabled": true,
"delay": 100,
"position": "left",
"connectors": false,
"placeholder": lang.filter_table
@ -435,6 +504,7 @@ jQuery(function($){
},
"filtering": {
"enabled": true,
"delay": 100,
"position": "left",
"connectors": false,
"placeholder": lang.filter_table
@ -492,10 +562,14 @@ jQuery(function($){
},
"filtering": {
"enabled": true,
"delay": 100,
"position": "left",
"connectors": false,
"placeholder": lang.filter_table
},
"components": {
"filtering": FooTable.domainFilter
},
"sorting": {
"enabled": true
}
@ -537,10 +611,14 @@ jQuery(function($){
},
"filtering": {
"enabled": true,
"delay": 100,
"position": "left",
"connectors": false,
"placeholder": lang.filter_table
},
"components": {
"filtering": FooTable.domainFilter
},
"sorting": {
"enabled": true
}
@ -603,6 +681,7 @@ jQuery(function($){
},
"filtering": {
"enabled": true,
"delay": 100,
"position": "left",
"connectors": false,
"placeholder": lang.filter_table
@ -657,6 +736,7 @@ jQuery(function($){
},
"filtering": {
"enabled": true,
"delay": 100,
"position": "left",
"connectors": false,
"placeholder": lang.filter_table