2021-08-26 21:06:22 -04:00
|
|
|
import logging
|
|
|
|
|
|
|
|
from app.classes.shared.helpers import helper
|
|
|
|
from app.classes.web.base_handler import BaseHandler
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
class StatusHandler(BaseHandler):
|
|
|
|
def get(self):
|
|
|
|
page_data = {}
|
2022-01-15 17:38:08 +02:00
|
|
|
page_data['lang'] = helper.get_setting('language')
|
2022-03-05 12:01:36 +01:00
|
|
|
page_data['lang_page'] = helper.getLangPage(helper.get_setting('language'))
|
2021-09-09 00:01:10 +02:00
|
|
|
page_data['servers'] = self.controller.servers.get_all_servers_stats()
|
2021-08-29 00:48:30 +02:00
|
|
|
for srv in page_data['servers']:
|
|
|
|
server_data = srv.get('server_data', False)
|
|
|
|
server_id = server_data.get('server_id', False)
|
2022-03-03 22:01:12 +01:00
|
|
|
srv['raw_ping_result'] = self.controller.servers.get_server_stats_by_id(server_id)
|
2022-03-04 17:30:17 -05:00
|
|
|
if 'icon' not in srv['raw_ping_result']:
|
|
|
|
srv['raw_ping_result']['icon'] = False
|
2021-08-26 21:06:22 -04:00
|
|
|
|
|
|
|
template = 'public/status.html'
|
|
|
|
|
|
|
|
self.render(
|
|
|
|
template,
|
|
|
|
data=page_data,
|
|
|
|
translate=self.translator.translate,
|
|
|
|
)
|
|
|
|
def post(self):
|
|
|
|
page_data = {}
|
2021-09-09 00:01:10 +02:00
|
|
|
page_data['servers'] = self.controller.servers.get_all_servers_stats()
|
2021-08-29 00:48:30 +02:00
|
|
|
for srv in page_data['servers']:
|
|
|
|
server_data = srv.get('server_data', False)
|
|
|
|
server_id = server_data.get('server_id', False)
|
2022-03-03 22:01:12 +01:00
|
|
|
srv['raw_ping_result'] = self.controller.servers.get_server_stats_by_id(server_id)
|
2021-08-26 21:06:22 -04:00
|
|
|
template = 'public/status.html'
|
|
|
|
|
|
|
|
self.render(
|
|
|
|
template,
|
|
|
|
data=page_data,
|
|
|
|
translate=self.translator.translate,
|
2022-01-26 01:45:30 +00:00
|
|
|
)
|