From 0933c5750d020394df9df377d2fd28673936b9e3 Mon Sep 17 00:00:00 2001 From: Silversthorn Date: Sun, 20 Mar 2022 14:41:27 +0100 Subject: [PATCH] Trying to do table dropdown for Dashboard page --- app/frontend/templates/panel/dashboard.html | 178 +++++++++++++++++++- 1 file changed, 176 insertions(+), 2 deletions(-) diff --git a/app/frontend/templates/panel/dashboard.html b/app/frontend/templates/panel/dashboard.html index 4c357f01..0804a4a0 100644 --- a/app/frontend/templates/panel/dashboard.html +++ b/app/frontend/templates/panel/dashboard.html @@ -111,7 +111,8 @@ {% end %} {% if len(data['servers']) > 0 %} - + +
@@ -252,7 +253,164 @@ {% end %} + +
{{ translate('dashboard', 'server', data['lang']) }}
+ + + + + + + + + + + + {% for server in data['servers'] %} + + + + + + + + + + {% end %}
{{ translate('dashboard', 'server', data['lang']) }}{{ translate('dashboard', 'actions', data['lang']) }}{{ translate('dashboard', 'status', data['lang']) }}
+ + {{ server['server_data']['server_name'] }} + + + {% if server['user_command_permission'] %} + {% if server['stats']['running'] %} + + +   + + +   + + + +   + + {% elif server['stats']['updating']%} + + {{ translate('serverTerm', 'updating', data['lang']) }} + {% elif server['stats']['waiting_start']%} + + {{ translate('dashboard', 'starting', data['lang']) }} + {% elif server['stats']['downloading']%} + {{ translate('serverTerm', 'downloading', data['lang']) }} + {% else %} + + +   + + +   + + +   + {% 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 %} + + +
+
+
+
+
{{ translate('dashboard', 'cpuUsage', data['lang']) }}
+
+
+
+
+ {{server['stats']['cpu']}}% +
+
+
+
{{ translate('dashboard', 'memUsage', data['lang']) }}
+
+
+
+
+ {{server['stats']['mem_percent']}}% - + + {% if server['stats']['mem'] == 0 %} + 0 MB + {% else %} + {{server['stats']['mem']}} + {% end %} +
+
+
+
+
+
+
{{ translate('dashboard', 'size', data['lang']) }}
+
+ {{ 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 %} + {% end %} +
+
+
+
+
{% end %} @@ -273,7 +431,7 @@ #desc_id { -ms-overflow-style: none; /* for Internet Explorer, Edge */ scrollbar-width: none; /* for Firefox */ - overflow-y: scroll; + overflow-y: scroll; } #desc_id::-webkit-scrollbar { @@ -359,6 +517,7 @@ } function update_one_server_status(server) { + /* Mobile view update */ server_cpu = document.getElementById('server_cpu_' + server.id); server_mem = document.getElementById('server_mem_' + server.id); server_world = document.getElementById('server_world_' + server.id); @@ -367,6 +526,13 @@ server_players = document.getElementById('server_players_' + server.id); total_players = document.getElementById('total_players'); + /* Mobile view update */ + m_server_cpu = document.getElementById('m_server_cpu_' + server.id); + m_server_mem = document.getElementById('m_server_mem_' + server.id); + m_server_world = document.getElementById('m_server_world_' + server.id); + m_server_desc = document.getElementById('m_server_desc_' + server.id); + m_server_online_status = document.getElementById('m_server_running_status_' + server.id); + console.log("Received Data : " + server.id + ": " + server); /* TODO Update each element */ @@ -379,6 +545,7 @@ } server_cpu.innerHTML = `
`+ server.cpu +`%`; + m_server_cpu.innerHTML = `
`+ server.cpu +`%`; /* Update Memory */ @@ -396,15 +563,18 @@ } server_mem.innerHTML = `
`+ server.mem_percent +`% - ` + total_mem; + m_server_mem.innerHTML = `
`+ server.mem_percent +`% - ` + total_mem; /* Update World Infos */ server_world.innerHTML = server.world_size + m_server_world.innerHTML = server.world_size /* Update Server Infos */ 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_players.setAttribute('data-players', server.online); server_players.setAttribute('data-max', server.max); @@ -425,6 +595,7 @@ server_infos = ""; + m_server_infos = ""; server_infos = server.online + " / " + server.max + " {{ translate('dashboard', 'max', data['lang']) }}
" } @@ -432,14 +603,17 @@ let motd = ""; if (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_desc.innerHTML = server_infos; + m_server_desc.innerHTML = m_server_infos; } /* Update Online Status */