reverted partial client side back button logic, but also now tested / validated if somehow we are in a flat view and ask for entries and dont get all of them back, or we are in folder view and we try to go into a folder or back up a folder and we get no data as someone deleted it since we made the view, so then show appropriate client-side errors

This commit is contained in:
2025-10-12 16:02:21 +11:00
parent e3f6b416ce
commit b61f048dec
3 changed files with 43 additions and 9 deletions

View File

@@ -313,7 +313,9 @@ def process_ids():
################################################################################
# /get_dir_entries -> FIXME:
# /get_dir_entries:
# -> if back is false - returns list of eids inside this dir
# -> if back is true - returns list of eids inside the parent of this dir
################################################################################
@app.route("/get_dir_eids", methods=["POST"])
@login_required
@@ -325,17 +327,24 @@ def get_dir_entries():
# 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().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()
if not dir_id:
# return valid as false, we need to let user know this is not an empty dir, it does not exist
return jsonify( valid=False, entry_list=[] )
# Just double-check this is still in the DB, in case it got deleted since client made view
stmt=( select(Entry.id).where(Entry.id==dir_id) )
ent_id = db.session.execute(stmt).scalars().one_or_none()
if not ent_id:
# return valid as false, we need to let user know this is not an empty dir, it does not exist
return jsonify( valid=False, entry_list=[] )
# get content of dir_id
stmt=( select(Entry.id).join(EntryDirLink).filter(EntryDirLink.dir_eid==dir_id) )
stmt=stmt.order_by(*order_map.get(noo) )
return jsonify( entry_list=db.session.execute(stmt).scalars().all() )
return jsonify( valid=True, entry_list=db.session.execute(stmt).scalars().all() )
# get Face override details
def getFOT():