mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-01-19 09:45:28 +01:00
Merge branch 'feature/pretzel-status-page-show' into 'dev'
Toggle Visible servers on status page See merge request crafty-controller/crafty-4!399
This commit is contained in:
commit
d96845bae3
@ -4,6 +4,7 @@
|
|||||||
### New features
|
### New features
|
||||||
- Task toggle ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/398))
|
- 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))
|
- 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
|
### Bug fixes
|
||||||
- Fixes stats recording for Oracle hosts ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/397))
|
- Fixes stats recording for Oracle hosts ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/397))
|
||||||
### Tweaks
|
### Tweaks
|
||||||
|
@ -37,6 +37,7 @@ class Servers(BaseModel):
|
|||||||
server_port = IntegerField(default=25565)
|
server_port = IntegerField(default=25565)
|
||||||
logs_delete_after = IntegerField(default=0)
|
logs_delete_after = IntegerField(default=0)
|
||||||
type = CharField(default="minecraft-java")
|
type = CharField(default="minecraft-java")
|
||||||
|
show_status = BooleanField(default=1)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
table_name = "servers"
|
table_name = "servers"
|
||||||
@ -80,6 +81,7 @@ class HelperServers:
|
|||||||
server_type: This is the type of server you're creating.
|
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_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
|
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:
|
Returns:
|
||||||
int: The new server's id
|
int: The new server's id
|
||||||
|
@ -1384,6 +1384,7 @@ class PanelHandler(BaseHandler):
|
|||||||
server_ip = self.get_argument("server_ip", None)
|
server_ip = self.get_argument("server_ip", None)
|
||||||
server_port = self.get_argument("server_port", None)
|
server_port = self.get_argument("server_port", None)
|
||||||
executable_update_url = self.get_argument("executable_update_url", None)
|
executable_update_url = self.get_argument("executable_update_url", None)
|
||||||
|
show_status = int(float(self.get_argument("show_status", "0")))
|
||||||
else:
|
else:
|
||||||
execution_command = server_obj.execution_command
|
execution_command = server_obj.execution_command
|
||||||
executable = server_obj.executable
|
executable = server_obj.executable
|
||||||
@ -1461,6 +1462,7 @@ class PanelHandler(BaseHandler):
|
|||||||
server_obj.server_ip = server_ip
|
server_obj.server_ip = server_ip
|
||||||
server_obj.server_port = server_port
|
server_obj.server_port = server_port
|
||||||
server_obj.executable_update_url = executable_update_url
|
server_obj.executable_update_url = executable_update_url
|
||||||
|
server_obj.show_status = show_status
|
||||||
else:
|
else:
|
||||||
server_obj.path = server_obj.path
|
server_obj.path = server_obj.path
|
||||||
server_obj.log_path = server_obj.log_path
|
server_obj.log_path = server_obj.log_path
|
||||||
|
@ -21,6 +21,18 @@
|
|||||||
display: block;
|
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 {
|
.sidebar>.nav>.nav-item:not(.nav-profile)>.nav-link:before {
|
||||||
content: none;
|
content: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -176,24 +176,35 @@
|
|||||||
<div class="form-check-flat">
|
<div class="form-check-flat">
|
||||||
<label for="auto_start" class="form-check-label ml-4 mb-4">
|
<label for="auto_start" class="form-check-label ml-4 mb-4">
|
||||||
{% if data['server_stats']['server_id']['auto_start'] %}
|
{% if data['server_stats']['server_id']['auto_start'] %}
|
||||||
<input type="checkbox" class="form-check-input" id="auto_start" name="auto_start" checked=""
|
<input type="checkbox" class="form-check-input" id="auto_start" name="auto_start" checked="" data-toggle="toggle"
|
||||||
value="1">{{ translate('serverConfig', 'serverAutoStart', data['lang']) }}
|
value="1"> {{ translate('serverConfig', 'serverAutoStart', data['lang']) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
<input type="checkbox" class="form-check-input" id="auto_start" name="auto_start" value="1">{{
|
<input type="checkbox" class="form-check-input" id="auto_start" name="auto_start" value="1" data-toggle="toggle"> {{
|
||||||
translate('serverConfig', 'serverAutoStart', data['lang']) }}
|
translate('serverConfig', 'serverAutoStart', data['lang']) }}
|
||||||
{% end %}
|
{% end %}
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label for="crash_detection" class="form-check-label ml-4 mb-4">
|
<label for="crash_detection" class="form-check-label ml-4 mb-4">
|
||||||
{% if data['server_stats']['server_id']['crash_detection'] %}
|
{% if data['server_stats']['server_id']['crash_detection'] %}
|
||||||
<input type="checkbox" class="form-check-input" id="crash_detection" name="crash_detection"
|
<input type="checkbox" class="form-check-input" id="crash_detection" name="crash_detection" data-toggle="toggle"
|
||||||
checked="" value="1">{{ translate('serverConfig', 'serverCrashDetection', data['lang']) }}
|
checked="" value="1"> {{ translate('serverConfig', 'serverCrashDetection', data['lang']) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
<input type="checkbox" class="form-check-input" id="crash_detection" name="crash_detection"
|
<input type="checkbox" class="form-check-input" id="crash_detection" name="crash_detection" data-toggle="toggle"
|
||||||
value="1">{{ translate('serverConfig', 'serverCrashDetection', data['lang']) }}
|
value="1"> {{ translate('serverConfig', 'serverCrashDetection', data['lang']) }}
|
||||||
{% end %}
|
{% end %}
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
{% if data['super_user'] %}
|
||||||
|
<label for="show_status" class="form-check-label ml-4 mb-4">
|
||||||
|
{% if data['server_stats']['server_id']['show_status'] %}
|
||||||
|
<input type="checkbox" class="form-check-input" id="show_status" name="show_status" data-toggle="toggle"
|
||||||
|
checked="" value="1"> {{ translate('serverConfig', 'showStatus', data['lang']) }}
|
||||||
|
{% else %}
|
||||||
|
<input type="checkbox" class="form-check-input" id="show_status" name="show_status" data-toggle="toggle"
|
||||||
|
value="1"> {{ translate('serverConfig', 'showStatus', data['lang']) }}
|
||||||
|
{% end %}
|
||||||
|
</label>
|
||||||
|
{% end %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="submit" class="btn btn-success mr-2"><i class="fas fa-save"></i> {{
|
<button type="submit" class="btn btn-success mr-2"><i class="fas fa-save"></i> {{
|
||||||
@ -243,13 +254,33 @@
|
|||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<style>
|
||||||
|
.toggle-handle {
|
||||||
|
background-color: white !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle-on {
|
||||||
|
color: black !important;
|
||||||
|
background-color: blueviolet !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle {
|
||||||
|
height: 0px !important;
|
||||||
|
background-color: grey !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<!-- content-wrapper ends -->
|
<!-- content-wrapper ends -->
|
||||||
|
|
||||||
{% end %}
|
{% end %}
|
||||||
|
|
||||||
{% block js %}
|
{% block js %}
|
||||||
<script>
|
<script>
|
||||||
|
$(function() {
|
||||||
|
$('.form-check-input').bootstrapToggle({
|
||||||
|
on: '',
|
||||||
|
off: ''
|
||||||
|
});
|
||||||
|
})
|
||||||
const serverId = new URLSearchParams(document.location.search).get('id')
|
const serverId = new URLSearchParams(document.location.search).get('id')
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
<span id="sync" style="margin-left: 5px;"><i class="fas fa-sync fa-spin"></i></span></h4>
|
<span id="sync" style="margin-left: 5px;"><i class="fas fa-sync fa-spin"></i></span></h4>
|
||||||
{% end %}
|
{% end %}
|
||||||
{% for server in data['servers'] %}
|
{% for server in data['servers'] %}
|
||||||
|
{% if server['server_data']['show_status'] %}
|
||||||
<tr>
|
<tr>
|
||||||
<td id="server_name_{{ server['stats']['server_id']['server_id'] }}">
|
<td id="server_name_{{ server['stats']['server_id']['server_id'] }}">
|
||||||
<i class="fas fa-server"></i>
|
<i class="fas fa-server"></i>
|
||||||
@ -71,6 +72,7 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% end %}
|
{% end %}
|
||||||
|
{% end %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
16
app/migrations/20220226_server_order copy.py
Normal file
16
app/migrations/20220226_server_order copy.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# Generated by database migrator
|
||||||
|
import peewee
|
||||||
|
|
||||||
|
|
||||||
|
def migrate(migrator, database, **kwargs):
|
||||||
|
migrator.add_columns("servers", show_status=peewee.BooleanField(default=1))
|
||||||
|
"""
|
||||||
|
Write your migrations here.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
def rollback(migrator, database, **kwargs):
|
||||||
|
migrator.drop_columns("servers", ["show_status"])
|
||||||
|
"""
|
||||||
|
Write your rollback migrations here.
|
||||||
|
"""
|
@ -323,7 +323,8 @@
|
|||||||
"stopBeforeDeleting": "Please stop the server before deleting it",
|
"stopBeforeDeleting": "Please stop the server before deleting it",
|
||||||
"update": "Update Executable",
|
"update": "Update Executable",
|
||||||
"yesDelete": "Yes, delete",
|
"yesDelete": "Yes, delete",
|
||||||
"yesDeleteFiles": "Yes, delete files"
|
"yesDeleteFiles": "Yes, delete files",
|
||||||
|
"showStatus": "Show On Public Status Page"
|
||||||
},
|
},
|
||||||
"serverConfigHelp": {
|
"serverConfigHelp": {
|
||||||
"desc": "Here is where you can change the configuration of your server",
|
"desc": "Here is where you can change the configuration of your server",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user