mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2024-11-22 15:20:09 +01:00
Finished the log system, now move on to something else...
This commit is contained in:
parent
63e8553a09
commit
935129f0a5
@ -142,10 +142,6 @@ class Logger:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
return logs
|
return logs
|
||||||
return logs
|
return logs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class PeerJob:
|
class PeerJob:
|
||||||
def __init__(self, JobID: str, Configuration: str, Peer: str,
|
def __init__(self, JobID: str, Configuration: str, Peer: str,
|
||||||
@ -176,7 +172,6 @@ class PeerJob:
|
|||||||
def __dict__(self):
|
def __dict__(self):
|
||||||
return self.toJson()
|
return self.toJson()
|
||||||
|
|
||||||
|
|
||||||
class PeerJobs:
|
class PeerJobs:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -232,12 +227,19 @@ class PeerJobs:
|
|||||||
self.jobdbCursor.execute('''
|
self.jobdbCursor.execute('''
|
||||||
INSERT INTO PeerJobs VALUES (?, ?, ?, ?, ?, ?, strftime('%Y-%m-%d %H:%M:%S','now'), NULL, ?)
|
INSERT INTO PeerJobs VALUES (?, ?, ?, ?, ?, ?, strftime('%Y-%m-%d %H:%M:%S','now'), NULL, ?)
|
||||||
''', (Job.JobID, Job.Configuration, Job.Peer, Job.Field, Job.Operator, Job.Value, Job.Action,))
|
''', (Job.JobID, Job.Configuration, Job.Peer, Job.Field, Job.Operator, Job.Value, Job.Action,))
|
||||||
|
JobLogger.log(Job.JobID, Message=f"Job is created if {Job.Field} {Job.Operator} {Job.Value} then {Job.Action}")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.jobdbCursor.execute('''
|
currentJob = self.jobdbCursor.execute('SELECT * FROM PeerJobs WHERE JobID = ?', (Job.JobID, )).fetchone()
|
||||||
UPDATE PeerJobs SET Field = ?, Operator = ?, Value = ?, Action = ? WHERE JobID = ?
|
if currentJob is not None:
|
||||||
''', (Job.Field, Job.Operator, Job.Value, Job.Action, Job.JobID))
|
self.jobdbCursor.execute('''
|
||||||
|
UPDATE PeerJobs SET Field = ?, Operator = ?, Value = ?, Action = ? WHERE JobID = ?
|
||||||
|
''', (Job.Field, Job.Operator, Job.Value, Job.Action, Job.JobID))
|
||||||
|
JobLogger.log(Job.JobID,
|
||||||
|
Message=f"Job is updated from if {currentJob['Field']} {currentJob['Operator']} {currentJob['value']} then {currentJob['Action']}; to if {Job.Field} {Job.Operator} {Job.Value} then {Job.Action}")
|
||||||
self.jobdb.commit()
|
self.jobdb.commit()
|
||||||
self.__getJobs()
|
self.__getJobs()
|
||||||
|
|
||||||
return True, list(
|
return True, list(
|
||||||
filter(lambda x: x.Configuration == Job.Configuration and x.Peer == Job.Peer and x.JobID == Job.JobID,
|
filter(lambda x: x.Configuration == Job.Configuration and x.Peer == Job.Peer and x.JobID == Job.JobID,
|
||||||
self.Jobs))
|
self.Jobs))
|
||||||
@ -252,6 +254,7 @@ class PeerJobs:
|
|||||||
UPDATE PeerJobs SET ExpireDate = strftime('%Y-%m-%d %H:%M:%S','now') WHERE JobID = ?
|
UPDATE PeerJobs SET ExpireDate = strftime('%Y-%m-%d %H:%M:%S','now') WHERE JobID = ?
|
||||||
''', (Job.JobID,))
|
''', (Job.JobID,))
|
||||||
self.jobdb.commit()
|
self.jobdb.commit()
|
||||||
|
JobLogger.log(Job.JobID, Message=f"Job is removed due to being deleted or finshed.")
|
||||||
self.__getJobs()
|
self.__getJobs()
|
||||||
return True, list(
|
return True, list(
|
||||||
filter(lambda x: x.Configuration == Job.Configuration and x.Peer == Job.Peer and x.JobID == Job.JobID,
|
filter(lambda x: x.Configuration == Job.Configuration and x.Peer == Job.Peer and x.JobID == Job.JobID,
|
||||||
|
1
src/static/app/.gitignore
vendored
1
src/static/app/.gitignore
vendored
@ -27,5 +27,4 @@ coverage
|
|||||||
*.sw?
|
*.sw?
|
||||||
|
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
proxy.js
|
|
||||||
.vite/*
|
.vite/*
|
Loading…
Reference in New Issue
Block a user