fix incorrect top-5 customers in traffic overview for admins; show manual update command if webupdate is disabled
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -102,6 +102,14 @@ class Traffic
|
||||
$years_avail = $sel_stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
// sort users by total traffic
|
||||
usort($users, function ($user_a, $user_b) {
|
||||
if ($user_a['total'] == $user_b['total']) {
|
||||
return 0;
|
||||
}
|
||||
return ($user_a['total'] < $user_b['total']) ? 1 : -1;
|
||||
});
|
||||
|
||||
return [
|
||||
'metrics' => $metrics,
|
||||
'users' => $users,
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
<p>{{ message }}</p>
|
||||
{% if get_config('enable_webupdate') %}
|
||||
<a class='btn d-block btn-outline-warning' href='admin_autoupdate.php?page=overview'>Open updater</a>
|
||||
{% else %}
|
||||
<p>Run the following command in your shell to update:</p>
|
||||
<code>{{ call_static('\\Froxlor\\Froxlor', 'getInstallDir') }}bin/froxlor-cli froxlor:update</code>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
@@ -152,7 +152,7 @@
|
||||
{% if userinfo.adminsession == 1 %}
|
||||
const labelsC = [];
|
||||
const dataValues = [];
|
||||
{% for user in users|sort((a, b) => a.total <=> b.total)|slice(0, 5) %}
|
||||
{% for user in users|slice(0, 5) %}
|
||||
labelsC.push('{{ user.loginname }}');
|
||||
dataValues.push({value: '{{ user.total|default(0) }}', formatted: '{{ user.total|formatBytes }}'});
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user