mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 09:34:39 +00:00
clean, move jquery-bootgrid converters now included in library
This commit is contained in:
parent
8933feae1e
commit
0672cd0483
@ -64,13 +64,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
"commands": function (column, row) {
|
||||
return "<button type=\"button\" class=\"btn btn-xs btn-default command-disconnect\" data-row-id=\"" + row.sessionid + "\"><span class=\"fa fa-trash-o\"></span></button>";
|
||||
}
|
||||
},
|
||||
converters: {
|
||||
// convert datetime type fields from unix timestamp to readable format
|
||||
datetime: {
|
||||
from: function (value) { return moment(parseInt(value)*1000); },
|
||||
to: function (value) { return value.format("lll"); }
|
||||
}
|
||||
}
|
||||
};
|
||||
$("#grid-clients").bootgrid('destroy');
|
||||
|
||||
@ -29,7 +29,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
<script>
|
||||
'use strict';
|
||||
const modifiers = ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
|
||||
|
||||
$( document ).ready(function() {
|
||||
/**
|
||||
@ -40,30 +39,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
ajax: false,
|
||||
selection: true,
|
||||
multiSelect: true,
|
||||
converters: {
|
||||
memsize: {
|
||||
from: function (value) {
|
||||
let ret = parseInt(value);
|
||||
let modifier = value.slice(-1);
|
||||
|
||||
for (let exponent = modifiers.length - 1; exponent >= 0; exponent--) {
|
||||
if (modifier === modifiers[exponent]) {
|
||||
ret *= Math.pow(1024, exponent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
to: function (value) {
|
||||
for (let exponent = modifiers.length - 1; exponent >= 0; exponent--) {
|
||||
if (value >= (5 * Math.pow(1024, exponent))) {
|
||||
return parseInt(value / Math.pow(1024, exponent)) + modifiers[exponent];
|
||||
}
|
||||
}
|
||||
return parseInt(value) + '';
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
$("#grid-top").bootgrid('destroy');
|
||||
ajaxGet("/api/diagnostics/activity/getActivity", {}, function (data, status) {
|
||||
|
||||
@ -58,17 +58,6 @@
|
||||
'add':'/api/proxy/settings/addPACMatch/',
|
||||
'del':'/api/proxy/settings/delPACMatch/',
|
||||
'options': {
|
||||
converters: {
|
||||
notprefixable: {
|
||||
to: function (value) {
|
||||
if (value.not) {
|
||||
return '<i class="fa fa-exclamation"></i> ' + value.val;
|
||||
} else {
|
||||
return value.val;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
responseHandler: function (response) {
|
||||
// concatenate fields for not.
|
||||
if ('rows' in response) {
|
||||
|
||||
@ -67,17 +67,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
del:'/api/trafficshaper/settings/delRule/',
|
||||
toggle:'/api/trafficshaper/settings/toggleRule/',
|
||||
options: {
|
||||
converters: {
|
||||
notprefixable: {
|
||||
to: function (value) {
|
||||
if (value.not) {
|
||||
return '<i class="fa fa-exclamation"></i> ' + value.val;
|
||||
} else {
|
||||
return value.val;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
responseHandler: function (response) {
|
||||
// concatenate fields for not.
|
||||
if ('rows' in response) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user