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