From bd9e4501847cb7e2ce9a1123dcc2774931fc621a Mon Sep 17 00:00:00 2001 From: Silversthorn Date: Tue, 6 Aug 2024 23:08:22 +0200 Subject: [PATCH] Fixing Dashboard --- app/frontend/static/assets/css/crafty.css | 21 ++++ app/frontend/templates/panel/dashboard.html | 109 ++++++-------------- 2 files changed, 55 insertions(+), 75 deletions(-) diff --git a/app/frontend/static/assets/css/crafty.css b/app/frontend/static/assets/css/crafty.css index d411aa64..f876c2d1 100644 --- a/app/frontend/static/assets/css/crafty.css +++ b/app/frontend/static/assets/css/crafty.css @@ -205,6 +205,27 @@ body { color: gray !important; } +.disk-usage { + height: 20px; + width: 100%; + background-color: rgb(139, 139, 139) !important +} + +.disk-usage>.progress-bar { + color: black; + height: 100%; +} + +.server-desc { + overflow-wrap: break-word !important; + max-width: 85px !important; + overflow: scroll; +} + +.server-alert { + color: var(--red) !important; +} + /**************************************************************/ /**************************************************************/ diff --git a/app/frontend/templates/panel/dashboard.html b/app/frontend/templates/panel/dashboard.html index 6c319989..5db5ca22 100644 --- a/app/frontend/templates/panel/dashboard.html +++ b/app/frontend/templates/panel/dashboard.html @@ -15,7 +15,7 @@ @@ -101,7 +101,7 @@ {% if len(data['hosts_data']['disk_json']) > 0 %}
-
+
{% if len(data["monitored"]) > 0 %}
{{ translate('dashboard', 'storage', data['lang']) }} @@ -112,9 +112,9 @@ {% for item in data['hosts_data']['disk_json'] %} {% if item["mount"] in data["monitored"] %}
-

+

{{item["mount"]}}

-
+
{{item["used"]}} / + " role="progressbar" style="width: {{item['percent_used']}}%" aria-valuenow="{{item['percent_used']}}" aria-valuemin="0" aria-valuemax="100">{{item["used"]}} / {{item["total"]}}
@@ -188,7 +188,7 @@ {% if server['alert'] %} - + {{ server['server_data']['server_name'] }}  {% else %} @@ -197,7 +197,6 @@ {% end %} - {% if server['user_command_permission'] %} {% if server['stats']['importing'] and server['stats']['running'] %} @@ -242,7 +241,6 @@ {% end %} {% end %} -
+ " role="progressbar" style="width: {{server['stats']['cpu']}}%" aria-valuenow="{{server['stats']['cpu']}}" aria-valuemin="0" aria-valuemax="100">
{{server['stats']['cpu']}}% -
+ " role="progressbar" style="width: {{server['stats']['mem_percent']}}%" aria-valuenow="{{server['stats']['mem_percent']}}" aria-valuemin="0" aria-valuemax="100">
{{server['stats']['mem_percent']}}% - @@ -284,41 +281,28 @@ {% if server['stats']['int_ping_results'] %} {{ server['stats']['online'] }} / {{ server['stats']['max'] }} {{ translate('dashboard', 'max', - data['lang']) }}
- - {% if server['stats']['desc'] != 'False' %} -
{{ translate('serverStats', 'loadingMotd', data['lang']) }}

+ data['lang']) }} {% end %} - - {% if server['stats']['version'] != 'False' %} - {{ server['stats']['version'] }} - {% end %} - {% end %} - + - -
- {% if server['stats']['running'] %} - {{ translate('dashboard', 'online', - data['lang']) }} - {% elif server['stats']['crashed'] %} - {{ translate('dashboard', - 'crashed', - data['lang']) }} - {% else %} - {{ translate('dashboard', 'offline', - data['lang']) }} - {% end %} -
-
+
+ {% if server['stats']['running'] %} + {{ translate('dashboard', 'online', + data['lang']) }} + {% elif server['stats']['crashed'] %} + {{ translate('dashboard', + 'crashed', + data['lang']) }} + {% else %} + {{ translate('dashboard', 'offline', + data['lang']) }} + {% end %} - {% end %}
- {% for server in data['failed_servers'] %}  {{server['server_name']}} @@ -346,7 +330,7 @@
{% if server['alert'] %} - + {{ server['server_data']['server_name'] }}  {% else %} @@ -462,7 +446,7 @@ {% else %} bg-danger {% end %} - " role="progressbar" style="width: {{server['stats']['cpu']}}%" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">
+ " role="progressbar" style="width: {{server['stats']['cpu']}}%" aria-valuenow="{{server['stats']['cpu']}}" aria-valuemin="0" aria-valuemax="100">
{{server['stats']['cpu']}}%
@@ -479,7 +463,7 @@ {% else %} bg-danger {% end %} - " role="progressbar" style="width: {{server['stats']['mem_percent']}}%" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">
+ " role="progressbar" style="width: {{server['stats']['mem_percent']}}%" aria-valuenow="{{server['stats']['mem_percent']}}" aria-valuemin="0" aria-valuemax="100">
{{server['stats']['mem_percent']}}% - @@ -499,22 +483,11 @@ {{ server['stats']['world_size'] }} -
+
{{ translate('dashboard', 'players', data['lang']) }}
{% if server['stats']['int_ping_results'] %} - {{ server['stats']['online'] }} / {{ server['stats']['max'] }} {{ translate('dashboard', - 'max', - data['lang']) }}
- - {% if server['stats']['desc'] != 'False' %} -
- {{ server['stats']['desc'] }}

- {% end %} - - {% if server['stats']['version'] != 'False' %} - {{ server['stats']['version'] }} - {% end %} + {{ server['stats']['online'] }} / {{ server['stats']['max'] }} {{ translate('dashboard', 'max', data['lang']) }} {% end %}
@@ -702,8 +675,8 @@ if (server.int_ping_results) { /* Update Players */ if (server.players) { - server_desc.innerHTML = server.online + ` / ` + server.max + ` {{ translate('dashboard', 'max', data['lang']) }}
` - m_server_desc.innerHTML = server.online + ` / ` + server.max + ` {{ translate('dashboard', 'max', data['lang']) }}
` + server_desc.innerHTML = server.online + ` / ` + server.max + ` {{ translate('dashboard', 'max', data['lang']) }}` + m_server_desc.innerHTML = server.online + ` / ` + server.max + ` {{ translate('dashboard', 'max', data['lang']) }}` server_players.setAttribute('data-players', server.online); server_players.setAttribute('data-max', server.max); @@ -732,22 +705,8 @@ server_infos = ""; m_server_infos = ""; - server_infos = server.online + " / " + server.max + " {{ translate('dashboard', 'max', data['lang']) }}
" - } - - /* Update Motd */ - let motd = ""; - if (server.desc) { - m_motd = `` + server.desc + ``; - motd = `` + server.desc + ``; - m_server_infos = server_infos + '
' + motd + '
' + "
"; - server_infos = server_infos + '
' + motd + '
' + "
"; - } - - /* Version */ - if (server.version) { - server_infos = server_infos + server.version - m_server_infos = m_server_infos + server.version + server_infos = server.online + " / " + server.max + " {{ translate('dashboard', 'max', data['lang']) }}" + m_server_infos = server.online + " / " + server.max + " {{ translate('dashboard', 'max', data['lang']) }}" } server_desc.innerHTML = server_infos; m_server_desc.innerHTML = m_server_infos; @@ -857,7 +816,7 @@ if (hostStats.mounts.includes(hostStats.disk_usage[i].mount)) { storage_html += `

${hostStats.disk_usage[i].mount}

-
+
${hostStats.disk_usage[i].used} / ${hostStats.disk_usage[i].total}