mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Add spinner to update button
This commit is contained in:
parent
bd38fcd6e4
commit
d5ecfe9128
@ -1173,6 +1173,9 @@ class ServerInstance:
|
||||
self.helper.websocket_helper.broadcast_page(
|
||||
"/panel/dashboard", "send_start_reload", {}
|
||||
)
|
||||
self.helper.websocket_helper.broadcast_page(
|
||||
"/panel/server_detail", "remove_spinner", {}
|
||||
)
|
||||
server_users = PermissionsServers.get_server_user_list(self.server_id)
|
||||
for user in server_users:
|
||||
self.helper.websocket_helper.broadcast_user(
|
||||
|
@ -186,7 +186,8 @@
|
||||
|
||||
{% elif server['stats']['updating']%}
|
||||
<!-- WHAT HAPPENED HERE -->
|
||||
<a data-id="{{server['server_data']['server_id']}}" class="">{{ translate('serverTerm', 'updating',
|
||||
<a data-id="{{server['server_data']['server_id']}}" class=""><i
|
||||
class="fa fa-spinner fa-spin"></i> {{ translate('serverTerm', 'updating',
|
||||
data['lang']) }}</i></a>
|
||||
{% elif server['stats']['waiting_start']%}
|
||||
<!-- WHAT HAPPENED HERE -->
|
||||
|
@ -253,14 +253,31 @@
|
||||
<button onclick="send_command(serverId, 'update_executable');" id="update_executable"
|
||||
style="max-width: 7rem;" class="btn btn-warning m-1 flex-grow-1 disabled">{{ translate('serverConfig',
|
||||
'update', data['lang']) }}</button>
|
||||
{% if data['server_stats']['updating'] %}
|
||||
<button onclick="send_command(serverId, 'update_executable');" id="update_executable"
|
||||
style="max-width: 7rem;" class="btn btn-warning m-1 flex-grow-1 disabled">{{ translate('serverConfig',
|
||||
'update', data['lang']) }} <i id="update-spinner" class="fa fa-spinner fa-spin"></i></button>
|
||||
{% else %}
|
||||
<button onclick="send_command(serverId, 'update_executable');" id="update_executable"
|
||||
style="max-width: 7rem;" class="btn btn-warning m-1 flex-grow-1 disabled">{{ translate('serverConfig',
|
||||
'update', data['lang']) }} <i style="visibility: hidden;" id="update-spinner"
|
||||
class="fa fa-spinner fa-spin"></i></button>
|
||||
{% end %}
|
||||
<a class="btn btn-sm btn-danger disabled">{{ translate('serverConfig', 'deleteServer', data['lang'])
|
||||
}}</a><br />
|
||||
<small>{{ translate('serverConfig', 'stopBeforeDeleting', data['lang']) }}</small>
|
||||
{% else %}
|
||||
{% if not data['failed'] %}
|
||||
{% if data['server_stats']['updating'] %}
|
||||
<button onclick="send_command(serverId, 'update_executable');" id="update_executable"
|
||||
style="max-width: 7rem;" class="btn btn-warning m-1 flex-grow-1">{{ translate('serverConfig',
|
||||
'update', data['lang']) }}</button>
|
||||
'update', data['lang']) }} <i id="update-spinner" class="fa fa-spinner fa-spin"></i></button>
|
||||
{% else %}
|
||||
<button onclick="send_command(serverId, 'update_executable');" id="update_executable"
|
||||
style="max-width: 7rem;" class="btn btn-warning m-1 flex-grow-1">{{ translate('serverConfig',
|
||||
'update', data['lang']) }} <i style="visibility: hidden;" id="update-spinner"
|
||||
class="fa fa-spinner fa-spin"></i></button>
|
||||
{% end %}
|
||||
{% end %}
|
||||
{% if not data['failed'] %}
|
||||
<button onclick="deleteConfirm()" class="btn btn-sm btn-danger">{{ translate('serverConfig',
|
||||
@ -356,6 +373,9 @@
|
||||
function send_command(serverId, command) {
|
||||
//<!-- this getCookie function is in base.html-->
|
||||
var token = getCookie("_xsrf");
|
||||
if (command == "update_executable") {
|
||||
document.getElementById("update-spinner").style.visibility = "visible";
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
@ -508,6 +528,12 @@
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
webSocket.on('remove_spinner', function () {
|
||||
document.getElementById("update-spinner").style.visibility = "hidden";
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
{% end %}
|
@ -55,7 +55,8 @@
|
||||
{% if data['permissions']['Commands'] in data['user_permissions'] %}
|
||||
{% if data['server_stats']['updating']%}
|
||||
<div id="update_control_buttons" class="mt-4 flex-wrap d-flex justify-content-between justify-content-md-center align-items-center px-5 px-md-0" style="visibility: visible">
|
||||
<button onclick="" id="start-btn" style="max-width: 7rem;" class="btn btn-warning m-1 flex-grow-1 disabled">{{ translate('serverTerm', 'updating', data['lang']) }}</button>
|
||||
<button onclick="" id="start-btn" style="max-width: 7rem;" class="btn btn-warning m-1 flex-grow-1 disabled"><i
|
||||
class="fa fa-spinner fa-spin"></i> {{ translate('serverTerm', 'updating', data['lang']) }}</button>
|
||||
<button onclick="" id="restart-btn" style="max-width: 7rem;" class="btn btn-outline-primary m-1 flex-grow-1 disabled">{% raw translate('serverTerm', 'restart', data['lang']) %}</button>
|
||||
<button onclick="" id="stop-btn" style="max-width: 7rem;" class="btn btn-danger m-1 flex-grow-1 disabled">{{ translate('serverTerm', 'stop', data['lang']) }}</button>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user