mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Seperate refresh statistics for each server
Fixing Broken Things
This commit is contained in:
parent
d016e0a59a
commit
cb1679806e
@ -148,6 +148,8 @@ class Server:
|
||||
self.name = serverName
|
||||
self.settings = server_data_obj
|
||||
|
||||
self.record_server_stats()
|
||||
|
||||
# build our server run command
|
||||
|
||||
if server_data_obj['auto_start']:
|
||||
@ -832,8 +834,8 @@ class Server:
|
||||
|
||||
self.record_server_stats()
|
||||
|
||||
#TODO How I do ?
|
||||
# websocket_helper.broadcast_user_page('/panel/dashboard', user.user_id, 'update_player_status', players_ping)
|
||||
#TODO How I do ?
|
||||
#websocket_helper.broadcast_user_page('/panel/dashboard', user.user_id, 'update_player_status', players_ping)
|
||||
|
||||
if (len(servers_ping) > 0) & (len(websocket_helper.clients) > 0):
|
||||
try:
|
||||
@ -858,7 +860,7 @@ class Server:
|
||||
self.reload_server_settings()
|
||||
|
||||
# world data
|
||||
server_name = server['server_name']
|
||||
world_name = server['server_name']
|
||||
server_path = server['path']
|
||||
|
||||
# process stats
|
||||
@ -867,7 +869,7 @@ class Server:
|
||||
# TODO: search server properties file for possible override of 127.0.0.1
|
||||
internal_ip = server['server_ip']
|
||||
server_port = server['server_port']
|
||||
server = server.get('server_name', f"ID#{server_id}")
|
||||
server_name = server.get('server_name', f"ID#{server_id}")
|
||||
|
||||
logger.debug("Pinging server '{server}' on {internal_ip}:{server_port}")
|
||||
if servers_helper.get_server_type_by_id(server_id) == 'minecraft-bedrock':
|
||||
@ -1002,7 +1004,7 @@ class Server:
|
||||
server_port = server_dt['server_port']
|
||||
|
||||
|
||||
logger.debug(f"Pinging server '{server.name}' on {internal_ip}:{server_port}")
|
||||
logger.debug(f"Pinging server '{self.name}' on {internal_ip}:{server_port}")
|
||||
if servers_helper.get_server_type_by_id(server_id) == 'minecraft-bedrock':
|
||||
int_mc_ping = ping_bedrock(internal_ip, int(server_port))
|
||||
else:
|
||||
|
@ -16,6 +16,10 @@ class StatusHandler(BaseHandler):
|
||||
server_data = srv.get('server_data', False)
|
||||
server_id = server_data.get('server_id', False)
|
||||
srv['raw_ping_result'] = self.controller.servers.get_server_stats_by_id(server_id)
|
||||
srv['raw_ping_result']
|
||||
{
|
||||
'icon': False,
|
||||
}
|
||||
|
||||
template = 'public/status.html'
|
||||
|
||||
@ -31,6 +35,9 @@ class StatusHandler(BaseHandler):
|
||||
server_data = srv.get('server_data', False)
|
||||
server_id = server_data.get('server_id', False)
|
||||
srv['raw_ping_result'] = self.controller.servers.get_server_stats_by_id(server_id)
|
||||
{
|
||||
'icon': False,
|
||||
}
|
||||
|
||||
template = 'public/status.html'
|
||||
|
||||
|
@ -155,9 +155,7 @@
|
||||
data['lang']) }}</i></a>
|
||||
{% elif server['stats']['waiting_start']%}
|
||||
<!-- WHAT HAPPENED HERE -->
|
||||
<a data-id="{{server['server_data']['server_id']}}" class="" title={{
|
||||
translate('dashboard', 'delay-explained' , data['lang'])}}>{{ translate('dashboard', 'starting',
|
||||
data['lang']) }}</i></a>
|
||||
<a data-id="{{server['server_data']['server_id']}}" class="" title={{ translate('dashboard', 'delay-explained' , data['lang'])}}>{{ translate('dashboard', 'starting', data['lang']) }}</i></a>
|
||||
{% else %}
|
||||
<a data-id="{{server['server_data']['server_id']}}" class="play_button"
|
||||
data-toggle="tooltip" title="{{ translate('dashboard', 'start' , data['lang']) }}">
|
||||
@ -438,10 +436,7 @@
|
||||
}
|
||||
|
||||
function update_servers_status(data) {
|
||||
console.log(data);
|
||||
for (server of data) {
|
||||
update_one_server_status(server);
|
||||
}
|
||||
update_one_server_status(data[0]);
|
||||
display_motd();
|
||||
}
|
||||
|
||||
@ -571,15 +566,15 @@
|
||||
<script>
|
||||
var row;
|
||||
|
||||
function start(){
|
||||
row = event.target;
|
||||
function start(){
|
||||
row = event.target;
|
||||
}
|
||||
function dragover(){
|
||||
var e = event;
|
||||
e.preventDefault();
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
let children= Array.from(e.target.parentNode.parentNode.children);
|
||||
|
||||
|
||||
if(children.indexOf(e.target.parentNode)>children.indexOf(row))
|
||||
e.target.parentNode.after(row);
|
||||
else
|
||||
@ -588,7 +583,7 @@
|
||||
|
||||
function dragend(){
|
||||
var id_string = '';
|
||||
const table = document.querySelector("table");
|
||||
const table = document.querySelector("table");
|
||||
for (const row of table.rows) {
|
||||
if (row.getAttribute('id') != null){
|
||||
if (id_string != ''){
|
||||
|
@ -143,9 +143,9 @@
|
||||
}
|
||||
|
||||
function update_servers_status(data) {
|
||||
//for (server of data) {
|
||||
update_one_server_status(data[0]);
|
||||
//}
|
||||
console.log(data);
|
||||
update_one_server_status(data[0]);
|
||||
display_motd();
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
|
Loading…
Reference in New Issue
Block a user