Hide empty tables

This commit is contained in:
yflory 2024-03-21 16:29:52 +01:00
parent e3a9a2793b
commit 606de4c38d
4 changed files with 24 additions and 5 deletions

View File

@ -189,8 +189,10 @@
margin-right: @sidebar_base-margin;
}
}
tr:nth-child(odd) {
background-color: @cp_sidebar-left-item-bg;
tbody {
tr:nth-child(odd) {
background-color: @cp_sidebar-left-item-bg;
}
}
}
.cp-sidebar-input-block {

View File

@ -75,5 +75,9 @@
}
}
}
.cp-limit-key {
padding: @sidebar_base-margin 0;
cursor: pointer;
}
}

View File

@ -1047,6 +1047,11 @@ define([
});
};
let sort = all => {
return (k1, k2) => {
return all[k1].time - all[k2].time;
};
};
refreshInvite = function () {
sFrameChan.query('Q_ADMIN_RPC', {
cmd: 'GET_ALL_INVITATIONS',
@ -1060,7 +1065,7 @@ define([
var all = response[0];
var newEntries = [];
Object.keys(all).forEach(function (key) {
Object.keys(all).sort(sort(all)).forEach(function (key) {
var data = all[key];
var url = privateData.origin + Hash.hashToHref(key, 'register');
@ -1368,6 +1373,11 @@ define([
refreshUsers();
});
};
let sort = all => {
return (k1, k2) => {
return all[k2].time - all[k1].time;
};
};
refreshUsers = function () {
sFrameChan.query('Q_ADMIN_RPC', {
cmd: 'GET_ALL_USERS',
@ -1380,7 +1390,7 @@ define([
if (!Array.isArray(response)) { return; }
var all = response[0];
var newEntries = [];
Object.keys(all).forEach(function (key) {
Object.keys(all).sort(sort(all)).forEach(function (key) {
var data = all[key];
var editUser = () => {};
var del = blocks.button('danger', 'fa fa-trash', Messages.admin_usersRemove);

View File

@ -165,7 +165,10 @@ define([
}));
};
table.updateContent = (newEntries) => {
$(table).find('tbody').remove();
$(table).show().find('tbody').remove();
if (!newEntries.length) {
return void $(table).hide();
}
let bodyContent = [];
newEntries.forEach(line => {
const row = getRow(line);