First commit for unloaded server. Working Frontend

This commit is contained in:
amcmanu3 2022-08-05 17:56:44 -04:00
parent ad318296dc
commit b039eec857
3 changed files with 60 additions and 44 deletions

View File

@ -146,6 +146,7 @@ class ServersController(metaclass=Singleton):
def init_all_servers(self): def init_all_servers(self):
servers = self.get_all_defined_servers() servers = self.get_all_defined_servers()
self.failed_servers = []
for server in servers: for server in servers:
server_id = server.get("server_id") server_id = server.get("server_id")
@ -169,6 +170,7 @@ class ServersController(metaclass=Singleton):
f"{server['server_name']} at path {server['path']}. " f"{server['server_name']} at path {server['path']}. "
f"Skipping this server" f"Skipping this server"
) )
self.failed_servers.append(server)
continue continue
temp_server_dict = { temp_server_dict = {

View File

@ -287,6 +287,7 @@ class PanelHandler(BaseHandler):
"update_available": self.helper.update_available, "update_available": self.helper.update_available,
"serverTZ": tz, "serverTZ": tz,
"version_data": self.helper.get_version_string(), "version_data": self.helper.get_version_string(),
"failed_servers": self.controller.servers.failed_servers,
"user_data": exec_user, "user_data": exec_user,
"user_role": exec_user_role, "user_role": exec_user_role,
"user_crafty_permissions": exec_user_crafty_permissions, "user_crafty_permissions": exec_user_crafty_permissions,

View File

@ -125,7 +125,7 @@
</div> </div>
<div class="card-body"> <div class="card-body">
{% if len(data['servers']) == 0%} {% if len(data['servers']) == 0 and len(data['failed_servers']) == 0 %}
<div style="text-align: center; color: grey;"> <div style="text-align: center; color: grey;">
<h1>{{ translate('dashboard', 'welcome', data['lang']) }}</h1> <h1>{{ translate('dashboard', 'welcome', data['lang']) }}</h1>
<br> <br>
@ -134,7 +134,7 @@
</div> </div>
{% end %} {% end %}
{% if len(data['servers']) > 0 %} {% if len(data['servers']) > 0 or len(data['failed_servers']) > 0 %}
<!-- View for Large screen --> <!-- View for Large screen -->
<div class="table-responsive d-none d-sm-block"> <div class="table-responsive d-none d-sm-block">
<table id="servers_table" class="table table-hover"> <table id="servers_table" class="table table-hover">
@ -290,6 +290,19 @@
data-players="{{ server['stats']['online']}}" data-max="{{ server['stats']['max'] }}"></span> data-players="{{ server['stats']['online']}}" data-max="{{ server['stats']['max'] }}"></span>
</tr> </tr>
{% end %} {% end %}
{% for server in data['failed_servers'] %}
<tr id="{{server['server_id']}}" draggable="false">
<td class="text-warning"><i class="fas fa-server"></i>&nbsp;<a class="text-warning"
href="/panel/server_detail?id={{server['server_id']}}&subpage=config">{{server['server_name']}}</a>
</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td><i class="fas fa-cloud"></i>&nbsp;Unloaded</td>
</tr>
{% end %}
</tbody> </tbody>
</table> </table>
</div> </div>