Adds inital support for waiting to start. Need to test on more powerful machine.

This commit is contained in:
Andrew 2021-09-20 14:46:31 -04:00
parent dfc07fcb4c
commit f032f4054e
8 changed files with 48 additions and 6 deletions

View File

@ -86,6 +86,12 @@ class Controller:
# add this temp object to the list of init servers
self.servers_list.append(temp_server_dict)
if s['auto_start']:
db_helper.set_waiting_start(s['server_id'], True)
server_stats = db_helper.get_server_stats_by_id(s['server_id'])
print(server_stats['waiting_start'])
console.info("Loaded Server: ID {} | Name: {} | Autostart: {} | Delay: {} ".format(
s['server_id'],
s['server_name'],

View File

@ -162,6 +162,7 @@ class Server_Stats(Model):
desc = CharField(default="Unable to Connect")
version = CharField(default="")
updating = BooleanField(default=False)
waiting_start = BooleanField(default=False)
class Meta:
@ -459,6 +460,15 @@ class db_shortcuts:
with database.atomic():
Server_Stats.update(updating=value).where(Server_Stats.server_id == server_id).execute()
@staticmethod
def set_waiting_start(server_id, value):
try:
row = Server_Stats.select().where(Server_Stats.server_id == server_id)
except Exception as ex:
logger.error("Database entry not found. ".format(ex))
with database.atomic():
Server_Stats.update(waiting_start=value).where(Server_Stats.server_id == server_id).execute()
@staticmethod
def get_TTL_without_player(server_id):
last_stat = Server_Stats.select().where(Server_Stats.server_id == server_id).order_by(Server_Stats.created.desc()).first()

View File

@ -195,6 +195,7 @@ class Server:
if helper.check_internet():
loc_server_port = db_helper.get_server_stats_by_id(self.server_id)['server_port']
if helper.check_port(loc_server_port):
db_helper.set_waiting_start(self.server_id, False)
websocket_helper.broadcast('send_start_reload', {
})
else:

View File

@ -131,6 +131,8 @@
<a class="kill_button" data-id="{{server['server_data']['server_id']}}" class="kill_button" data-toggle="tooltip" title={{ translate('dashboard', 'kill') }}> <i class="fas fa-skull"></i></a> &nbsp;
{% elif server['stats']['updating']%}
<a data-id="{{server['server_data']['server_id']}}" class="">{{ translate('serverTerm', 'updating') }}</i></a>
{% elif server['stats']['waiting_start']%}
<a data-id="{{server['server_data']['server_id']}}" class="">{{ translate('serverTerm', 'starting') }}</i></a>
{% else %}
<a data-id="{{server['server_data']['server_id']}}" class="play_button"><i class="fas fa-play" data-toggle="tooltip" title={{ translate('dashboard', 'start') }}></i></a> &nbsp;
<a data-id="{{server['server_data']['server_id']}}" class="clone_button"> <i class="fas fa-clone" data-toggle="tooltip" title={{ translate('dashboard', 'clone') }}></i></a>&nbsp;

View File

@ -0,0 +1,16 @@
# Generated by database migrator
import peewee
def migrate(migrator, database, **kwargs):
migrator.add_columns('server_stats', waiting_start=peewee.BooleanField(default=False))
"""
Write your migrations here.
"""
def rollback(migrator, database, **kwargs):
migrator.drop_columns('server_stats', ['waiting_start'])
"""
Write your rollback migrations here.
"""

View File

@ -98,7 +98,8 @@
"clone": "Clone",
"kill": "Kill Process",
"restart": "Restart",
"killing": "Killing process..."
"killing": "Killing process...",
"starting": "Delayed Start"
},
"accessDenied": {
"accessDenied": "Access Denied",
@ -138,7 +139,8 @@
"start": "Start",
"restart": "Restart",
"stop": "Stop",
"updating": "Updating..."
"updating": "Updating...",
"starting": "Delayed Start"
},
"serverPlayerManagement": {
"players": "Players",

View File

@ -98,7 +98,8 @@
"clone": "Klooni",
"kill": "Tapa prosessi",
"restart": "Uudelleenkäynnistää",
"killing": "Tappamisprosessi ..."
"killing": "Tappamisprosessi ...",
"starting": "Delayed Start"
},
"accessDenied": {
"accessDenied": "Käyttö estetty",
@ -137,7 +138,9 @@
"sendCommand": "Lähetä komento",
"start": "Käynnistä",
"restart": "Uudelleen&shy;käynnistä",
"stop": "Sammuta"
"stop": "Sammuta",
"updating": "Updating",
"starting": "Delayed Start"
},
"serverPlayerManagement": {
"players": "Pelaajat",

View File

@ -98,7 +98,8 @@
"clone": "Cloner",
"kill": "Tuer le processus",
"restart": "Redémarrage",
"killing": "Processus de mise à mort..."
"killing": "Processus de mise à mort...",
"starting": "Delayed Start"
},
"accessDenied": {
"accessDenied": "Accès Interdit",
@ -138,7 +139,8 @@
"start": "Démarrer",
"restart": "Redémarrer",
"stop": "Arrêter",
"updating": "Mise à Jour ..."
"updating": "Mise à Jour ...",
"starting": "Delayed Start"
},
"serverPlayerManagement": {
"players": "Joueurs",