another large clean up of code, all POSTs are now using make_response() and returning json OR are for a form that flask handles with rendering direct html. Where there is a POST with json response, the jscript now calls CheckForJobs() to show it in the F/E. Removed several debugs. Fixed up undocumented BUG where import datetime was wrong, and prefix/suffix also to offer directories near the date of an image. Removed unused routes for clearing messages
This commit is contained in:
15
job.py
15
job.py
@@ -297,6 +297,7 @@ def joblog_search():
|
||||
for ent in ent_cursor:
|
||||
jobs_cursor=db.engine.execute( f"select l.log, j.id, j.name, j.state, l.log_date from joblog l, job j where l.job_id = j.id and l.log ilike '%%{ent[0]}%%' order by l.log_date")
|
||||
|
||||
print("HERE")
|
||||
# turn DB output into json and return it to the f/e
|
||||
ret='[ '
|
||||
first_job=1
|
||||
@@ -312,7 +313,7 @@ def joblog_search():
|
||||
ret+= '}'
|
||||
first_job=0
|
||||
ret+= ' ]'
|
||||
return ret
|
||||
return make_response( ret )
|
||||
|
||||
|
||||
###############################################################################
|
||||
@@ -331,18 +332,6 @@ def CheckForJobs():
|
||||
sts.append( { 'id': msg.id, 'message': u+msg.message, 'level': msg.level, 'job_id': msg.job_id, 'persistent': msg.persistent, 'cant_close': msg.cant_close } )
|
||||
return make_response( jsonify( num_active_jobs=num, sts=sts ) )
|
||||
|
||||
###############################################################################
|
||||
# / -> POST -> looks for pa_job_manager status to F/E jobs and sends json of
|
||||
# them back to F/E (called form internal/js/jobs.js:CheckForJobs()
|
||||
################################################################################
|
||||
@app.route("/clearmsgforjob/<id>", methods=["POST"])
|
||||
@login_required
|
||||
def ClearMessageForJob(id):
|
||||
PA_JobManager_Message.query.filter(PA_JobManager_Message.job_id==id).delete()
|
||||
db.session.commit()
|
||||
# no real need for this response, as if it succeeded/failed the F/E ignores it
|
||||
return make_response( jsonify( status="success" ) )
|
||||
|
||||
###############################################################################
|
||||
# / -> POST -> looks for pa_job_manager status to F/E jobs and sends json of
|
||||
# them back to F/E (called form internal/js/jobs.js:CheckForJobs()
|
||||
|
||||
Reference in New Issue
Block a user