quick fix for view being a POST, its now redirected to a GET, but I want to fix up the viewlist properly as well, should work for now though
This commit is contained in:
15
TODO
15
TODO
@@ -1,10 +1,15 @@
|
||||
## GENERAL
|
||||
* optim to not run_ai_on_* for scan, needs to make sure last run_ai_on actually ran/worked - might have failed (or in my case was marked stale and I cancelled it)
|
||||
* going forward into search page (and probably all POSTs) does not work
|
||||
don't render_template instead do a redirect to a GET of the new, or list? for del...
|
||||
files.py:@app.route("/view/<id>", methods=["POST"])
|
||||
job.py:@app.route("/jobs", methods=["GET", "POST"])
|
||||
job.py:@app.route("/job/<id>", methods=["GET","POST"])
|
||||
files.py:@app.route("/fix_dups", methods=["POST"])
|
||||
files.py:@app.route("/viewlist", methods=["POST"])
|
||||
-- this will need a total rewrite for viewer to handle fullscreen across offset/size boundaries so fix that instead
|
||||
|
||||
* going forward into search page (and probably all POSTs) does not work - no data posted (e.g. no search term)
|
||||
- okay somehow (maybe cache-control?) is causing flask to handle this and gunicorn does not!
|
||||
- seems we could make the /search url be /search/term and use a GET, this would make it not run into this issue
|
||||
- OR, seems we can follow a different pattern... don't render_template instead do a redirect to a GET of the new, or list? for del...
|
||||
* optim to not run_ai_on_* for scan, needs to make sure last run_ai_on actually ran/worked - might have failed (or in my case was marked stale and I cancelled it)
|
||||
-- also the case for get file details though, need to make sure last one was completed
|
||||
|
||||
* per file you could select an unknown face and add it as a ref img to an existing person, or make a new person and attach?
|
||||
* [DONE] order/ find face with largest size and at least show that as unmatched
|
||||
|
||||
40
files.py
40
files.py
@@ -292,10 +292,13 @@ def clear_jm_msg(id):
|
||||
################################################################################
|
||||
# /file_list -> show detailed file list of files from import_path(s)
|
||||
################################################################################
|
||||
@app.route("/file_list_ip", methods=["GET","POST"])
|
||||
@app.route("/file_list_ip", methods=["GET", "POST"])
|
||||
@login_required
|
||||
def file_list_ip():
|
||||
OPT=Options( request )
|
||||
# now we have reset the offset, etc. into the prefs, we can use a GET and this will be back/forward browser button safe
|
||||
if request.method=='POST':
|
||||
redirect("/file_list_ip")
|
||||
entries=GetEntries( OPT )
|
||||
return render_template("file_list.html", page_title='View File Details (Import Path)', entry_data=entries, OPT=OPT )
|
||||
|
||||
@@ -306,6 +309,9 @@ def file_list_ip():
|
||||
@login_required
|
||||
def files_ip():
|
||||
OPT=Options( request )
|
||||
# now we have reset the offset, etc. into the prefs, we can use a GET and this will be back/forward browser button safe
|
||||
if request.method=='POST':
|
||||
redirect("/files_ip")
|
||||
entries=GetEntries( OPT )
|
||||
people = Person.query.all()
|
||||
move_paths = MovePathDetails()
|
||||
@@ -318,6 +324,9 @@ def files_ip():
|
||||
@login_required
|
||||
def files_sp():
|
||||
OPT=Options( request )
|
||||
# now we have reset the offset, etc. into the prefs, we can use a GET and this will be back/forward browser button safe
|
||||
if request.method=='POST':
|
||||
redirect("/files_sp")
|
||||
entries=GetEntries( OPT )
|
||||
people = Person.query.all()
|
||||
move_paths = MovePathDetails()
|
||||
@@ -331,6 +340,9 @@ def files_sp():
|
||||
@login_required
|
||||
def files_rbp():
|
||||
OPT=Options( request )
|
||||
# now we have reset the offset, etc. into the prefs, we can use a GET and this will be back/forward browser button safe
|
||||
if request.method=='POST':
|
||||
redirect("/files_rbp")
|
||||
entries=GetEntries( OPT )
|
||||
people = Person.query.all()
|
||||
move_paths = MovePathDetails()
|
||||
@@ -404,7 +416,7 @@ def fix_dups():
|
||||
|
||||
if rows.returns_rows == False:
|
||||
st.SetMessage(f"Err, no dups - should now clear the FE 'danger' message?")
|
||||
return render_template("base.html")
|
||||
return redirect("/")
|
||||
|
||||
if 'pagesize' not in request.form:
|
||||
# default to 10, see if we have a larger value as someone reset it in the gui, rather than first time invoked
|
||||
@@ -448,7 +460,7 @@ def rm_dups():
|
||||
job=NewJob( "rmdups", 0, None, jex )
|
||||
st.SetMessage( f"Created <a href=/job/{job.id}>Job #{job.id}</a> to delete duplicate files")
|
||||
|
||||
return render_template("base.html")
|
||||
return redirect("/jobs")
|
||||
|
||||
################################################################################
|
||||
# /restore_files -> create a job to restore files for the b/e to process
|
||||
@@ -462,7 +474,7 @@ def restore_files():
|
||||
|
||||
job=NewJob( "restore_files", 0, None, jex )
|
||||
st.SetMessage( f"Created <a href=/job/{job.id}>Job #{job.id}</a> to restore selected file(s)")
|
||||
return render_template("base.html")
|
||||
return redirect("/jobs")
|
||||
|
||||
################################################################################
|
||||
# /delete_files -> create a job to delete files for the b/e to process
|
||||
@@ -476,7 +488,7 @@ def delete_files():
|
||||
|
||||
job=NewJob( "delete_files", 0, None, jex )
|
||||
st.SetMessage( f"Created <a href=/job/{job.id}>Job #{job.id}</a> to delete selected file(s)")
|
||||
return render_template("base.html")
|
||||
return redirect("/jobs")
|
||||
|
||||
################################################################################
|
||||
# /move_files -> create a job to move files for the b/e to process
|
||||
@@ -490,7 +502,7 @@ def move_files():
|
||||
jex.append( JobExtra( name=f"{el}", value=request.form[el] ) )
|
||||
job=NewJob( "move_files", 0, None, jex )
|
||||
st.SetMessage( f"Created <a href=/job/{job.id}>Job #{job.id}</a> to move selected file(s)")
|
||||
return render_template("base.html")
|
||||
return redirect("/jobs")
|
||||
|
||||
################################################################################
|
||||
# /viewlist -> get new set of eids and set current to new img to view
|
||||
@@ -533,6 +545,20 @@ def viewlist():
|
||||
|
||||
return render_template("viewer.html", current=current, eids=eids, objs=objs, OPT=OPT )
|
||||
|
||||
@login_required
|
||||
@app.route("/new_view/<id>", methods=["GET"])
|
||||
def newview_img(id):
|
||||
OPT=Options( request )
|
||||
objs = {}
|
||||
lst = OPT.view_eids.split(',')
|
||||
print( f"lst={lst}" )
|
||||
for e in Entry.query.join(File).filter(Entry.id.in_(lst)).all():
|
||||
objs[e.id]=e
|
||||
# put locn data back into array format
|
||||
for face in e.file_details.faces:
|
||||
face.locn = json.loads(face.locn)
|
||||
return render_template("viewer.html", current=int(id), eids=OPT.view_eids, objs=objs, OPT=OPT )
|
||||
|
||||
################################################################################
|
||||
# /view/id -> grabs data from DB and views it
|
||||
################################################################################
|
||||
@@ -540,7 +566,7 @@ def viewlist():
|
||||
@login_required
|
||||
def view_img(id):
|
||||
OPT=Options( request )
|
||||
eids=request.form['eids'].rstrip(',')
|
||||
return redirect( "/new_view/" + id );
|
||||
objs = {}
|
||||
lst = eids.split(',')
|
||||
for e in Entry.query.join(File).filter(Entry.id.in_(lst)).all():
|
||||
|
||||
12
options.py
12
options.py
@@ -23,9 +23,10 @@ class PA_PREF(db.Model):
|
||||
fullscreen = db.Column(db.Boolean, unique=False, nullable=False )
|
||||
root = db.Column(db.String, unique=False, nullable=False )
|
||||
cwd = db.Column(db.String, unique=False, nullable=False )
|
||||
view_eids = db.Column(db.String, unique=False, nullable=False )
|
||||
|
||||
def __repr__(self):
|
||||
return f"<pa_user_dn: {self.pa_user_dn}, path_type: {self.path_type}, noo: {self.noo}, grouping: {self.grouping}, how_many: {self.how_many}, st_offset: {self.st_offset}, size: {self.size}, folders: {self.folders}, root: {self.root}, cwd: {self.cwd}>"
|
||||
return f"<pa_user_dn: {self.pa_user_dn}, path_type: {self.path_type}, noo: {self.noo}, grouping: {self.grouping}, how_many: {self.how_many}, st_offset: {self.st_offset}, size: {self.size}, folders: {self.folders}, root: {self.root}, cwd: {self.cwd}, view_eids: {self.view_eids}>"
|
||||
|
||||
|
||||
################################################################################
|
||||
@@ -37,8 +38,13 @@ class Options(PA):
|
||||
def __init__(self, request):
|
||||
if 'orig_url' in request.form:
|
||||
url = request.form['orig_url']
|
||||
if 'eids' in request.form:
|
||||
print( "setting view_eids due to form" )
|
||||
self.view_eids = request.form['eids'].rstrip(',')
|
||||
else:
|
||||
url = request.path
|
||||
print( "setting view_eids due to null (for now)" )
|
||||
self.view_eids=""
|
||||
self.orig_url=url
|
||||
if 'files_sp' in url:
|
||||
self.path_type = 'Storage'
|
||||
@@ -78,6 +84,7 @@ class Options(PA):
|
||||
if pref:
|
||||
self.folders=pref.folders
|
||||
self.noo=pref.noo
|
||||
self.view_eids=pref.view_eids
|
||||
else:
|
||||
self.folders=False
|
||||
self.noo="Oldest"
|
||||
@@ -138,7 +145,7 @@ class Options(PA):
|
||||
pref=PA_PREF.query.filter(PA_PREF.pa_user_dn==current_user.dn,PA_PREF.path_type==self.path_type).first()
|
||||
if not pref:
|
||||
pref=PA_PREF( pa_user_dn=current_user.dn, path_type=self.path_type, noo=self.noo, grouping=self.grouping, how_many=self.how_many,
|
||||
st_offset=self.offset, size=self.size, folders=self.folders, root=self.root, cwd=self.cwd)
|
||||
st_offset=self.offset, size=self.size, folders=self.folders, root=self.root, cwd=self.cwd, view_eids=self.view_eids)
|
||||
else:
|
||||
pref.noo=self.noo
|
||||
pref.grouping=self.grouping
|
||||
@@ -148,6 +155,7 @@ class Options(PA):
|
||||
pref.folders=self.folders
|
||||
pref.root = self.root
|
||||
pref.cwd = self.cwd
|
||||
pref.view_eids = self.view_eids
|
||||
|
||||
db.session.add(pref)
|
||||
db.session.commit()
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
<form id="main_form" method="POST">
|
||||
<input id="offset" type="hidden" name="offset" value="{{OPT.offset}}">
|
||||
<input id="grouping" type="hidden" name="grouping" value="">
|
||||
<input id="size" type="hidden" name="size" value="">
|
||||
<input id="cwd" type="hidden" name="cwd" value="">
|
||||
<input id="folders" type="hidden" name="folders" value="False">
|
||||
<div class="col col-auto">
|
||||
<div class="input-group">
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<table id="prefs_table" class="table table-striped table-sm" data-toolbar="#toolbar" data-search="true">
|
||||
<thead>
|
||||
<tr class="table-primary"><th>Path</th><th>New or Oldest</th><th>How Many</th><th>Folders?</th><th>Group by</th><th>Thumb size</th><th>Fullscreen</th><th>DB retrieve offset</th><th>Root</th><th>cwd</th></tr>
|
||||
<tr class="table-primary"><th>Path</th><th>New or Oldest</th><th>How Many</th><th>Folders?</th><th>Group by</th><th>Thumb size</th><th>Fullscreen</th><th>DB retrieve offset</th><th>Root</th><th>cwd</th><th>View eids</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for pref in prefs %}
|
||||
@@ -20,6 +20,7 @@
|
||||
<td>{{pref.st_offset}}</td>
|
||||
<td>{{pref.root}}</td>
|
||||
<td>{{pref.cwd}}</td>
|
||||
<td>{{pref.view_eids}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user