handle going into Dirs and back from Dirs by doing logic of parent dir on server side, only return eids, and get normal code to handle rendering, no specific get_dir_entries route -> its not get_dir_eids, and the rest is normal code. Much cleaner/simpler. At this point I think the major rewrite it functional, commiting before more testing and then merge code and removed firstEntryOnPage bug (its now pageList[0])

This commit is contained in:
2025-10-12 13:14:53 +11:00
parent cb5ff7e985
commit 0ac0eedef9
3 changed files with 23 additions and 23 deletions

View File

@@ -313,28 +313,31 @@ def process_ids():
################################################################################
# /get_dir_entries -> show thumbnail view of files from import_path(s)
# /get_dir_entries -> FIXME:
################################################################################
@app.route("/get_dir_entries", methods=["POST"])
@app.route("/get_dir_eids", methods=["POST"])
@login_required
def get_dir_entries():
data = request.get_json() # Parse JSON body
dir_id = data.get('dir_id', []) # Extract list of ids
back = data.get('back', False) # Extract back boolean
noo = data.get('noo', "A to Z") # Extract noo ordering
# if we are going back, find the parent id and use that instead
if back:
# find current dir
stmt=( select(EntryDirLink.dir_eid).filter(EntryDirLink.entry_id==dir_id) )
dir_id = db.session.execute(stmt).scalars().all() [0]
dir_id = db.session.execute(stmt).scalars().one_or_none()
# get parent of this dir, to go back
stmt=( select(EntryDirLink.dir_eid).filter(EntryDirLink.entry_id==dir_id) )
dir_id = db.session.execute(stmt).scalars().one_or_none()
# get content of dir_id
stmt=( select(Entry.id).join(EntryDirLink).filter(EntryDirLink.dir_eid==dir_id) )
ids=db.session.execute(stmt).scalars().all()
entries_schema = EntrySchema(many=True)
entries = Entry.query.filter(Entry.id.in_(ids)).all()
return jsonify(entries_schema.dump(entries))
stmt=stmt.order_by(*order_map.get(noo) )
return jsonify( entry_list=db.session.execute(stmt).scalars().all() )
# get Face overrid details
# get Face override details
def getFOT():
stmt = select(FaceOverrideType)
fot=db.session.execute(stmt).scalars().all()