if > 100 logs, truncate them and add button to show all logs, and stop auto-refresh too
This commit is contained in:
3
TODO
3
TODO
@@ -1,8 +1,5 @@
|
||||
## GENERAL
|
||||
|
||||
* trim joblog > (say) 100 ... [DONE]
|
||||
* then click for rest
|
||||
|
||||
* refimgs need to be done via job_mgr:
|
||||
- have local FS chooser of ref img, do html file upload to b/e -> job mgr -> save it to reference_images/<p.tag>/<ref-img-fname>
|
||||
- remove refimg menu from top-level -> sub of Person (to view/mangage?)
|
||||
|
||||
12
job.py
12
job.py
@@ -105,18 +105,24 @@ def jobs():
|
||||
###############################################################################
|
||||
# /job/<id> -> GET -> shows status/history of jobs
|
||||
################################################################################
|
||||
@app.route("/job/<id>", methods=["GET"])
|
||||
@app.route("/job/<id>", methods=["GET","POST"])
|
||||
@login_required
|
||||
def joblog(id):
|
||||
page_title='Show Job Details'
|
||||
joblog = Job.query.get(id)
|
||||
logs=Joblog.query.filter(Joblog.job_id==id).order_by(Joblog.log_date).all()
|
||||
log_cnt = db.session.execute( f"select count(id) from joblog where job_id = {id}" ).first()[0]
|
||||
first_logs_only = True
|
||||
if request.method == 'POST':
|
||||
logs=Joblog.query.filter(Joblog.job_id==id).order_by(Joblog.log_date).all()
|
||||
first_logs_only = False
|
||||
else:
|
||||
logs=Joblog.query.filter(Joblog.job_id==id).order_by(Joblog.log_date).limit(50).all()
|
||||
if joblog.pa_job_state == "Completed":
|
||||
duration=(joblog.last_update-joblog.start_time)
|
||||
else:
|
||||
duration=(datetime.now(pytz.utc)-joblog.start_time)
|
||||
duration= duration-timedelta(microseconds=duration.microseconds)
|
||||
return render_template("joblog.html", job=joblog, logs=logs, duration=duration, page_title=page_title)
|
||||
return render_template("joblog.html", job=joblog, logs=logs, log_cnt=log_cnt, duration=duration, page_title=page_title, first_logs_only=first_logs_only)
|
||||
|
||||
###############################################################################
|
||||
# /job/<id> -> GET -> shows status/history of jobs
|
||||
|
||||
Reference in New Issue
Block a user