add button to custom limits table to generate account reports
and always display results in the table rather than the list view
This commit is contained in:
parent
919af10913
commit
27522b5114
2 changed files with 43 additions and 31 deletions
|
@ -26,7 +26,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
.cp-admin-setlimit-form, .cp-admin-broadcast-form {
|
||||
label {
|
||||
font-weight: normal !important;
|
||||
|
@ -46,6 +45,10 @@
|
|||
}
|
||||
}
|
||||
.cp-admin-getlimits {
|
||||
td {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
code {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
@ -62,6 +65,9 @@
|
|||
max-width: 500px;
|
||||
}
|
||||
@media screen and (max-width: 1200px) {
|
||||
button.cp-report {
|
||||
display: none;
|
||||
}
|
||||
:is(td, th).note {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
@ -1608,8 +1608,6 @@ define([
|
|||
return obj[a].limit > obj[b].limit;
|
||||
});
|
||||
|
||||
var compact = list.length > 10;
|
||||
|
||||
var content = list.map(function (key) {
|
||||
var user = obj[key];
|
||||
var limit = getPrettySize(user.limit);
|
||||
|
@ -1617,32 +1615,42 @@ define([
|
|||
Messages._getKey('admin_limitPlan', [user.plan]) + ', ' +
|
||||
Messages._getKey('admin_limitNote', [user.note]);
|
||||
|
||||
var infoButton = h('button.btn.primary.cp-report', {
|
||||
style: 'margin-left: 10px; cursor: pointer;',
|
||||
}, Messages.admin_diskUsageButton);
|
||||
|
||||
$(infoButton).click(() => {
|
||||
console.log(key);
|
||||
getAccountData(key, (err, data) => {
|
||||
if (err) { return void console.error(err); }
|
||||
console.log(data);
|
||||
var table = renderAccountData(data);
|
||||
UI.alert(table, () => {
|
||||
|
||||
}, {
|
||||
wide: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
var keyEl = h('code.cp-limit-key', key);
|
||||
$(keyEl).click(function () {
|
||||
$('.cp-admin-setlimit-form').find('.cp-setlimit-key').val(key);
|
||||
$('.cp-admin-setlimit-form').find('.cp-setlimit-quota').val(Math.floor(user.limit / 1024 / 1024));
|
||||
$('.cp-admin-setlimit-form').find('.cp-setlimit-note').val(user.note);
|
||||
});
|
||||
if (compact) {
|
||||
return h('tr.cp-admin-limit', {
|
||||
title: title
|
||||
}, [
|
||||
h('td', keyEl),
|
||||
h('td.limit', limit),
|
||||
h('td.plan', user.plan),
|
||||
h('td.note', user.note)
|
||||
]);
|
||||
}
|
||||
return h('li.cp-admin-limit', [
|
||||
|
||||
var attr = { title: title };
|
||||
return h('tr.cp-admin-limit', [
|
||||
h('td', [
|
||||
keyEl,
|
||||
h('ul.cp-limit-data', [
|
||||
h('li.limit', Messages._getKey('admin_limit', [limit])),
|
||||
h('li.plan', Messages._getKey('admin_limitPlan', [user.plan])),
|
||||
h('li.note', Messages._getKey('admin_limitNote', [user.note]))
|
||||
])
|
||||
infoButton,
|
||||
]),
|
||||
h('td.limit', attr, limit),
|
||||
h('td.plan', attr, user.plan),
|
||||
h('td.note', attr, user.note)
|
||||
]);
|
||||
});
|
||||
if (compact) {
|
||||
return $div.append(h('table.cp-admin-all-limits', [
|
||||
h('tr', [
|
||||
h('th', Messages.settings_publicSigningKey),
|
||||
|
@ -1651,8 +1659,6 @@ define([
|
|||
h('th.note', Messages.admin_note)
|
||||
]),
|
||||
].concat(content)));
|
||||
}
|
||||
$div.append(h('ul.cp-admin-all-limits', content));
|
||||
});
|
||||
};
|
||||
APP.refreshLimits();
|
||||
|
|
Loading…
Reference in a new issue