From 5d80c40b2506cdbf25cf217ef9d27cfa9cd313ec Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Thu, 17 Feb 2022 14:57:08 +0100 Subject: [PATCH] a bit more dashboard work Signed-off-by: Michael Kaufmann --- admin_index.php | 5 +- customer_index.php | 2 - lng/english.lng.php | 2 + lng/german.lng.php | 2 + templates/Froxlor/user/index.html.twig | 141 ++++++++++++++++++++----- 5 files changed, 123 insertions(+), 29 deletions(-) diff --git a/admin_index.php b/admin_index.php index 067ad4a8..6547a2c7 100644 --- a/admin_index.php +++ b/admin_index.php @@ -124,8 +124,6 @@ if ($page == 'overview') { $userinfo['traffic_used'] = \Froxlor\PhpHelper::sizeReadable($userinfo['traffic_used'] * 1024, null, 'bi'); $userinfo = \Froxlor\PhpHelper::strReplaceArray('-1', $lng['customer']['unlimited'], $userinfo, 'customers domains diskspace diskspace_bytes traffic traffic_bytes mysqls emails email_accounts email_forwarders email_quota ftps subdomains'); - $userinfo['custom_notes'] = ($userinfo['custom_notes'] != '') ? nl2br($userinfo['custom_notes']) : ''; - $cron_last_runs = \Froxlor\System\Cronjob::getCronjobsLastRun(); $outstanding_tasks = \Froxlor\System\Cronjob::getOutstandingTasks(); @@ -187,7 +185,8 @@ if ($page == 'overview') { // @fixme add all the overview/dashboard data from above UI::Twig()->addGlobal('userinfo', $userinfo); UI::TwigBuffer('user/index.html.twig', [ - 'sysinfo' => $sysinfo + 'sysinfo' => $sysinfo, + 'overview' => $overview ]); UI::TwigOutputBuffer(); } elseif ($page == 'change_password') { diff --git a/customer_index.php b/customer_index.php index a636f373..48b50534 100644 --- a/customer_index.php +++ b/customer_index.php @@ -115,8 +115,6 @@ if ($page == 'overview') { $userinfo['traffic_used'] = \Froxlor\PhpHelper::sizeReadable($userinfo['traffic_used'] * 1024, null, 'bi'); $userinfo = \Froxlor\PhpHelper::strReplaceArray('-1', $lng['customer']['unlimited'], $userinfo, 'diskspace diskspace_bytes traffic traffic_bytes mysqls emails email_accounts email_forwarders email_quota ftps subdomains'); - $userinfo['custom_notes'] = ($userinfo['custom_notes'] != '') ? nl2br($userinfo['custom_notes']) : ''; - UI::Twig()->addGlobal('userinfo', $userinfo); UI::TwigBuffer('user/index.html.twig', [ 'domains' => $domainArray, diff --git a/lng/english.lng.php b/lng/english.lng.php index f6a890f7..e04f1fe1 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -2139,3 +2139,5 @@ $lng['serversettings']['phpfpm_settings']['allow_all_customers']['description'] $lng['error']['pathmustberelative'] = 'The user does not have the permission to specify directories outside the customers home-directory. Please specify a relative path (no leading /).'; $lng['serversettings']['acmeshpath']['title'] = 'Path to acme.sh'; $lng['serversettings']['acmeshpath']['description'] = 'Set this to where acme.sh is installed to, including the acme.sh script
Default is /root/.acme.sh/acme.sh'; + +$lng['panel']['usage_statistics'] = 'Resource usage'; diff --git a/lng/german.lng.php b/lng/german.lng.php index b6f42c76..cf9e1013 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -1785,3 +1785,5 @@ $lng['serversettings']['phpfpm_settings']['allow_all_customers']['description'] $lng['error']['pathmustberelative'] = 'Der Benutzer hat nicht die benötigten Berechtigungen, um Pfade außerhalb des Kunden-Heimatverzeichnisses anzugeben. Bitte einen relativen Pfad angeben (kein führendes /).'; $lng['serversettings']['acmeshpath']['title'] = 'Pfad zu acme.sh'; $lng['serversettings']['acmeshpath']['description'] = 'Installationspfad zu acme.sh, inklusive acme.sh Script
Standard ist /root/.acme.sh/acme.sh'; + +$lng['panel']['usage_statistics'] = 'Resourcen-Verbrauch'; diff --git a/templates/Froxlor/user/index.html.twig b/templates/Froxlor/user/index.html.twig index a7323319..6bad5acd 100644 --- a/templates/Froxlor/user/index.html.twig +++ b/templates/Froxlor/user/index.html.twig @@ -14,16 +14,109 @@
-
+
+
+ + {{ lng('panel.usage_statistics') }} +
-

Test

+
+ {# admin-resources #} + {% if userinfo.adminsession == 1 %} +
+
+
{{ lng('admin.customers') }} {{ overview.number_customers }}/{{ userinfo.customers }}
+
+
+
+
+
+
+
+
{{ lng('admin.customers') }} {{ overview.number_customers }}/{{ userinfo.customers }}
+
+
+
+
+
+
+
+
{{ lng('admin.customers') }} {{ overview.number_customers }}/{{ userinfo.customers }}
+
+
+
+
+
+
+
+
{{ lng('admin.customers') }} {{ overview.number_customers }}/{{ userinfo.customers }}
+
+
+
+
+
+
+
+
{{ lng('admin.customers') }} {{ overview.number_customers }}/{{ userinfo.customers }}
+
+
+
+
+
+ {% else %} + {# customer-resources #} +
+
+
{{ lng('admin.customers') }} {{ overview.number_customers }}/{{ userinfo.customers }}
+
+
+
+
+
+
+
+
{{ lng('admin.customers') }} {{ overview.number_customers }}/{{ userinfo.customers }}
+
+
+
+
+
+
+
+
{{ lng('admin.customers') }} {{ overview.number_customers }}/{{ userinfo.customers }}
+
+
+
+
+
+
+
+
{{ lng('admin.customers') }} {{ overview.number_customers }}/{{ userinfo.customers }}
+
+
+
+
+
+
+
+
{{ lng('admin.customers') }} {{ overview.number_customers }}/{{ userinfo.customers }}
+
+
+
+
+
+ {% endif %} +
{% if userinfo.adminsession == 1 %} -
+
{# system infos #} -
+
+
{{ lng('admin.systemdetails') }}
@@ -59,12 +152,12 @@
{% if sysinfo.memory is not empty %} -
  • -
    -
    {{ lng('admin.memory') }}
    -
    {{ sysinfo.memory }}
    -
    -
  • +
  • +
    +
    {{ lng('admin.memory') }}
    +
    {{ sysinfo.memory }}
    +
    +
  • {% endif %}
  • @@ -73,20 +166,20 @@
  • {% if sysinfo.kernel is not empty %} -
  • -
    -
    Kernel
    - {{ sysinfo.kernel }} -
    -
  • +
  • +
    +
    Kernel
    + {{ sysinfo.kernel }} +
    +
  • {% endif %} {% if sysinfo.uptime is not empty %} -
  • -
    -
    Uptime
    - {{ sysinfo.uptime }} -
    -
  • +
  • +
    +
    Uptime
    + {{ sysinfo.uptime }} +
    +
  • {% endif %}
    @@ -134,7 +227,7 @@ {% if userinfo.custom_notes is not empty and userinfo.custom_notes_show == 1 %}
    - {{ userinfo.custom_notes }} + {{ userinfo.custom_notes|nl2br|raw }}
    {% endif %} @@ -256,7 +349,7 @@ {% if userinfo.custom_notes is not empty and userinfo.custom_notes_show == 1 %}
  • - {{ userinfo.custom_notes }} + {{ userinfo.custom_notes|nl2br|raw }}
  • {% endif %}