git commit, converted over to base.html pulling Status*, rather than every render_template calling it. Tightened up naming for job manager, fixed a few bugs in there with items like div by zero, created the active jobs link/badge in navbar, have it invoked each time by base.html template and it gets active jobs from DB, pa_job_manager now initiliases from an empty DB and can work out where it is at, no loop/thread/or actual job code yet. jobs.py has basics of a NewJob(), so next step is to force that job to be executed in pa_job_manager, but its tea time

This commit is contained in:
2021-01-16 17:51:16 +11:00
parent dc2ea1265f
commit e138ab22aa
12 changed files with 156 additions and 72 deletions

View File

@@ -20,7 +20,7 @@ import time
# Local Class imports
################################################################################
from settings import Settings
from job import Job, Joblog
from job import Job, Joblog, NewJob
class FileData():
def __init__(self):
@@ -176,22 +176,26 @@ filedata.GenerateFileData()
################################################################################
@app.route("/file_list", methods=["GET"])
def file_list():
return render_template("file_list.html", page_title='View Files (details)', file_data=filedata, alert=st.GetAlert(), message=st.GetMessage() )
return render_template("file_list.html", page_title='View Files (details)', file_data=filedata)
################################################################################
# /files -> show thumbnail view of files from import_path(s)
################################################################################
@app.route("/files", methods=["GET"])
def files():
return render_template("files.html", page_title='View Files', file_data=filedata, alert=st.GetAlert(), message=st.GetMessage() )
return render_template("files.html", page_title='View Files', file_data=filedata)
################################################################################
# /files/scannow -> allows us to force a check for new files
################################################################################
@app.route("/files/scannow", methods=["GET"])
def scannow():
job=NewJob("scannow", 1 )
print("beginning of using a job to scan for new files, rather than do it in code here: {}".format(job))
filedata.GenerateFileData()
return render_template("base.html", page_title='Forced look for new items', file_data=filedata, alert="success", message="Scanned for new files" )
st.SetAlert("success")
st.SetMessage("Scanned for new files")
return render_template("base.html", page_title='Forced look for new items', file_data=filedata)
################################################################################
# /files/forcescan -> deletes old data in DB, and does a brand new scan
@@ -202,7 +206,9 @@ def forcescan():
Settings.query.all()[0].last_import_date=0
db.session.commit()
filedata.GenerateFileData()
return render_template("base.html", page_title='Forced look for new items', file_data=filedata, alert="success", message="Forced remove and recreation of all file data" )
st.SetAlert("success")
st.SetMessage("Forced remove and recreation of all file data")
return render_template("base.html", page_title='Forced look for new items')
################################################################################
# /static -> returns the contents of any file referenced inside /static.