diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b9c9bd2..b4117d32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### New features - Task toggle ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/398)) - Basic API for modifying tasks ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/398)) +- Toggle Visible servers on status page ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/399)) ### Bug fixes - Fixes stats recording for Oracle hosts ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/397)) ### Tweaks diff --git a/app/classes/models/servers.py b/app/classes/models/servers.py index 5a9bb268..71ca4851 100644 --- a/app/classes/models/servers.py +++ b/app/classes/models/servers.py @@ -37,6 +37,7 @@ class Servers(BaseModel): server_port = IntegerField(default=25565) logs_delete_after = IntegerField(default=0) type = CharField(default="minecraft-java") + show_status = BooleanField(default=1) class Meta: table_name = "servers" @@ -80,6 +81,7 @@ class HelperServers: server_type: This is the type of server you're creating. server_port: The port the server will be monitored on, defaults to 25565 server_host: The host the server will be monitored on, defaults to 127.0.0.1 + show_status: Should Crafty show this server on the public status page Returns: int: The new server's id diff --git a/app/classes/web/panel_handler.py b/app/classes/web/panel_handler.py index 321e9e20..f161ab47 100644 --- a/app/classes/web/panel_handler.py +++ b/app/classes/web/panel_handler.py @@ -1376,6 +1376,7 @@ class PanelHandler(BaseHandler): server_ip = self.get_argument("server_ip", None) server_port = self.get_argument("server_port", None) executable_update_url = self.get_argument("executable_update_url", None) + show_status = int(float(self.get_argument("show_status", "0"))) else: execution_command = server_obj.execution_command executable = server_obj.executable @@ -1453,6 +1454,7 @@ class PanelHandler(BaseHandler): server_obj.server_ip = server_ip server_obj.server_port = server_port server_obj.executable_update_url = executable_update_url + server_obj.show_status = show_status else: server_obj.path = server_obj.path server_obj.log_path = server_obj.log_path diff --git a/app/frontend/static/assets/css/crafty.css b/app/frontend/static/assets/css/crafty.css index a4bfe57c..7c533ee2 100644 --- a/app/frontend/static/assets/css/crafty.css +++ b/app/frontend/static/assets/css/crafty.css @@ -21,6 +21,18 @@ display: block; } +.toggle-handle { + background-color: white !important; +} + +.toggle-on { + color: black !important; +} + +.toggle { + height: 0px !important; +} + .sidebar>.nav>.nav-item:not(.nav-profile)>.nav-link:before { content: none; position: absolute; diff --git a/app/frontend/templates/panel/server_config.html b/app/frontend/templates/panel/server_config.html index 3c107d30..9bb03a71 100644 --- a/app/frontend/templates/panel/server_config.html +++ b/app/frontend/templates/panel/server_config.html @@ -176,24 +176,35 @@
+ {% if data['super_user'] %} + + {% end %}