mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Adds inital support for waiting to start. Need to test on more powerful machine.
This commit is contained in:
parent
dfc07fcb4c
commit
f032f4054e
@ -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'],
|
||||
|
@ -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()
|
||||
|
@ -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:
|
||||
|
@ -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>
|
||||
{% 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>
|
||||
<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>
|
||||
|
16
app/migrations/20210915205501_waiting_start_1.py
Normal file
16
app/migrations/20210915205501_waiting_start_1.py
Normal 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.
|
||||
"""
|
@ -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",
|
||||
|
@ -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­käynnistä",
|
||||
"stop": "Sammuta"
|
||||
"stop": "Sammuta",
|
||||
"updating": "Updating",
|
||||
"starting": "Delayed Start"
|
||||
},
|
||||
"serverPlayerManagement": {
|
||||
"players": "Pelaajat",
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user