Compare commits
2 Commits
9bdd9d5b78
...
4421da0d1d
| Author | SHA1 | Date | |
|---|---|---|---|
| 4421da0d1d | |||
| 6eba21e028 |
4
BUGs
4
BUGs
@@ -1,4 +1,6 @@
|
|||||||
### Next: 143
|
### Next: 146
|
||||||
|
BUG-145: when I selected a few files with ctrl-click, moved them, the end result was "no files in path"
|
||||||
|
BUG-143: if I skip next fast enough in files_ip, it can get the warning about changes to entry list... (would have though I disabled next page until loaded)
|
||||||
BUG-142: after transforming, the face data is still in the old spots, really should delete it / make it recalc
|
BUG-142: after transforming, the face data is still in the old spots, really should delete it / make it recalc
|
||||||
BUG-141: can currently try to flip a video (in a highlighted group)
|
BUG-141: can currently try to flip a video (in a highlighted group)
|
||||||
BUG-140: When db is restarted underneath PA, it crashes job mgr... It should just accept timeouts, and keep trying to reconnect every 2? mins
|
BUG-140: When db is restarted underneath PA, it crashes job mgr... It should just accept timeouts, and keep trying to reconnect every 2? mins
|
||||||
|
|||||||
3
files.py
3
files.py
@@ -674,8 +674,7 @@ def move_files():
|
|||||||
for el in request.form:
|
for el in request.form:
|
||||||
jex.append( JobExtra( name=f"{el}", value=str(request.form[el]) ) )
|
jex.append( JobExtra( name=f"{el}", value=str(request.form[el]) ) )
|
||||||
job=NewJob( name="move_files", num_files=0, wait_for=None, jex=jex, desc="to move selected file(s)" )
|
job=NewJob( name="move_files", num_files=0, wait_for=None, jex=jex, desc="to move selected file(s)" )
|
||||||
# data is not used, but send response to trigger CheckForJobs()
|
return jsonify( job=job_schema.dump(job) )
|
||||||
return jsonify( job_id=job.id )
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@app.route("/view/", methods=["POST"])
|
@app.route("/view/", methods=["POST"])
|
||||||
|
|||||||
@@ -87,18 +87,6 @@ function GetExistingDirsAsDiv( dt, divname, ptype )
|
|||||||
} )
|
} )
|
||||||
}
|
}
|
||||||
|
|
||||||
// wrapper to do some clean up before POST to /move_files or /delete_files
|
|
||||||
// used to remove the highlighted item(s) && reset the numbering so highlighting continues to work
|
|
||||||
function MoveOrDelCleanUpUI()
|
|
||||||
{
|
|
||||||
// remove the images being moved (so UI immediately 'sees' the move)
|
|
||||||
$("[name^=eid-]").each( function() { $('#'+$(this).attr('value')).remove() } )
|
|
||||||
// reorder the images via ecnt again, so future highlighting can work
|
|
||||||
// document.mf_id=0; $('.figure').each( function() { $(this).attr('ecnt', document.mf_id ); document.mf_id++ } )
|
|
||||||
$('#dbox').modal('hide')
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// show the DBox for a move file, includes all thumbnails of selected files to move
|
// show the DBox for a move file, includes all thumbnails of selected files to move
|
||||||
// and a pre-populated folder to move them into, with text field to add a suffix
|
// and a pre-populated folder to move them into, with text field to add a suffix
|
||||||
function MoveDBox(path_details)
|
function MoveDBox(path_details)
|
||||||
@@ -116,7 +104,7 @@ function MoveDBox(path_details)
|
|||||||
yr=$('.highlight').first().attr('yr')
|
yr=$('.highlight').first().attr('yr')
|
||||||
dt=$('.highlight').first().attr('date')
|
dt=$('.highlight').first().attr('date')
|
||||||
div+='<div class="row">Use Existing Directory (in the chosen path):</div><div id="existing"></div>'
|
div+='<div class="row">Use Existing Directory (in the chosen path):</div><div id="existing"></div>'
|
||||||
GetExistingDirsAsDiv( dt, "existing", path_details[0].type.name )
|
GetExistingDirsAsDiv( dt, "existing", 'Storage' )
|
||||||
div+=`
|
div+=`
|
||||||
<div class="input-group my-3">
|
<div class="input-group my-3">
|
||||||
<alert class="alert alert-primary my-auto py-1">
|
<alert class="alert alert-primary my-auto py-1">
|
||||||
@@ -125,7 +113,7 @@ function MoveDBox(path_details)
|
|||||||
div+= '<svg id="move_path_icon" width="20" height="20" fill="currentColor"><use xlink:href="' + path_details[0].icon_url + '"></svg>'
|
div+= '<svg id="move_path_icon" width="20" height="20" fill="currentColor"><use xlink:href="' + path_details[0].icon_url + '"></svg>'
|
||||||
div+= '<select id="rp_sel" name="rel_path" class="text-primary alert-primary py-1 border border-primary rounded" onChange="change_rp_sel()">'
|
div+= '<select id="rp_sel" name="rel_path" class="text-primary alert-primary py-1 border border-primary rounded" onChange="change_rp_sel()">'
|
||||||
for(p of path_details) {
|
for(p of path_details) {
|
||||||
div+= '<option path_type="'+p.type.name+'" icon_url="'+p.icon_url+'">'+p.root_dir+'</option>'
|
div+= `<option path_type="${p.type.name}" icon_url="${p.icon_url}" ${(p.type.name=='Storage') ? "selected" : ""}>${p.root_dir}</option>`
|
||||||
}
|
}
|
||||||
div+= '</select>'
|
div+= '</select>'
|
||||||
div+=`
|
div+=`
|
||||||
@@ -139,8 +127,16 @@ function MoveDBox(path_details)
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-row col-12 mt-2">
|
<div class="form-row col-12 mt-2">
|
||||||
<button onClick="$('#dbox').modal('hide'); return false;" class="btn btn-outline-secondary offset-1 col-2">Cancel</button>
|
<button onClick="$('#dbox').modal('hide'); return false;" class="btn btn-outline-secondary offset-1 col-2">Cancel</button>
|
||||||
<button id="move_submit" onClick="MoveOrDelCleanUpUI(); $.ajax({ type: 'POST', data: $('#mv_fm').serialize(), url: '/move_files', success: function(data) {
|
<button onClick="
|
||||||
if( $(location).attr('pathname').match('search') !== null ) { window.location='/' }; CheckForJobs() } }); return false" class="btn btn-outline-primary col-2">Ok</button>
|
$.ajax({ type: 'POST', data: $('#mv_fm').serialize(), url: '/move_files',
|
||||||
|
success: function(data) {
|
||||||
|
processAmendments( data.job.amendments )
|
||||||
|
checkForAmendmentJobToComplete(data.job.id)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('#dbox').modal('hide')
|
||||||
|
return false"
|
||||||
|
class="btn btn-outline-secondary col-2">Ok</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
`
|
`
|
||||||
@@ -183,7 +179,7 @@ function processAmendments( ams )
|
|||||||
// function to add data for document.amendment based on id and amt
|
// function to add data for document.amendment based on id and amt
|
||||||
// used when we transform several images in files_*, or single image in viewer
|
// used when we transform several images in files_*, or single image in viewer
|
||||||
// show the DBox for a delete/restore file, includes all thumbnails of selected files
|
// show the DBox for a delete/restore file, includes all thumbnails of selected files
|
||||||
// with appropriate coloured button to Delete or Restore files`
|
// with appropriate coloured button to Delete or Restore files
|
||||||
function DelDBox(del_or_undel)
|
function DelDBox(del_or_undel)
|
||||||
{
|
{
|
||||||
to_del = GetSelnAsData()
|
to_del = GetSelnAsData()
|
||||||
@@ -208,10 +204,6 @@ function DelDBox(del_or_undel)
|
|||||||
<button onClick="
|
<button onClick="
|
||||||
$.ajax({ type: 'POST', data: to_del, url: '/${which}_files',
|
$.ajax({ type: 'POST', data: to_del, url: '/${which}_files',
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
// FIXME: what is the ! search stuff for???
|
|
||||||
// FIXME: really, also why not show 'delete' throbber, and on success of actual delete go back to /
|
|
||||||
if( $(location).attr('pathname').match('search') !== null || document.viewing ) { window.location='/' }
|
|
||||||
|
|
||||||
processAmendments( data.job.amendments )
|
processAmendments( data.job.amendments )
|
||||||
checkForAmendmentJobToComplete(data.job.id)
|
checkForAmendmentJobToComplete(data.job.id)
|
||||||
}
|
}
|
||||||
@@ -854,10 +846,10 @@ function changeSize()
|
|||||||
// when a delete or restore files job has completed successfullly, then get ids
|
// when a delete or restore files job has completed successfullly, then get ids
|
||||||
// find the page we are on, remove amendments & ids from entryList and re-get page
|
// find the page we are on, remove amendments & ids from entryList and re-get page
|
||||||
// which will reset pageList and the UI of images for that page
|
// which will reset pageList and the UI of images for that page
|
||||||
function handleDeleteOrRestoreFileJobCompleted(job)
|
function handleMoveOrDeleteOrRestoreFileJobCompleted(job)
|
||||||
{
|
{
|
||||||
// this grabs the values from the object attributes of eid-0, eid-1, etc.
|
// this grabs the values from the object attributes of eid-0, eid-1, etc.
|
||||||
const ids = job.extra.map(item => item.value)
|
const ids = job.extra.filter(item => item.name.startsWith("eid-")).map(item => item.value);
|
||||||
|
|
||||||
// find page number of first element to delete (this is the page we will return too)
|
// find page number of first element to delete (this is the page we will return too)
|
||||||
pnum=getPageNumberForId( ids[0] )
|
pnum=getPageNumberForId( ids[0] )
|
||||||
@@ -903,8 +895,8 @@ function handleCheckAmendmentJobStatus(data)
|
|||||||
// transforms contain the single transformed entry data for convenience
|
// transforms contain the single transformed entry data for convenience
|
||||||
if( data.job.name == 'transform_image' )
|
if( data.job.name == 'transform_image' )
|
||||||
handleTransformImageJobCompleted(data.job, data.entry)
|
handleTransformImageJobCompleted(data.job, data.entry)
|
||||||
else if ( data.job.name == 'delete_files' || data.job.name == 'restore_files' )
|
else if ( data.job.name == 'delete_files' || data.job.name == 'restore_files' || data.job.name == 'move_files' )
|
||||||
handleDeleteOrRestoreFileJobCompleted(data.job)
|
handleMoveOrDeleteOrRestoreFileJobCompleted(data.job)
|
||||||
}
|
}
|
||||||
else { setTimeout( function() { checkForAmendmentJobToComplete(data.job.id) }, 1000 ); }
|
else { setTimeout( function() { checkForAmendmentJobToComplete(data.job.id) }, 1000 ); }
|
||||||
}
|
}
|
||||||
|
|||||||
4
job.py
4
job.py
@@ -127,13 +127,11 @@ def NewJob(name, num_files="0", wait_for=None, jex=None, desc="No description pr
|
|||||||
ea=EntryAmendment( eid=id, job_id=job.id, amend_type=at_id )
|
ea=EntryAmendment( eid=id, job_id=job.id, amend_type=at_id )
|
||||||
db.session.add(ea)
|
db.session.add(ea)
|
||||||
job.amendments.append(ea)
|
job.amendments.append(ea)
|
||||||
# FIXME: add ea to job.amend
|
elif job.name == 'delete_files' or job.name == 'restore_files' or job.name == 'move_files':
|
||||||
elif job.name == 'delete_files' or job.name == 'restore_files':
|
|
||||||
for j in jex:
|
for j in jex:
|
||||||
if 'eid-' in j.name:
|
if 'eid-' in j.name:
|
||||||
ea=EntryAmendment( eid=j.value, job_id=job.id, amend_type=at_id )
|
ea=EntryAmendment( eid=j.value, job_id=job.id, amend_type=at_id )
|
||||||
db.session.add(ea)
|
db.session.add(ea)
|
||||||
# FIXME: add ea to job.amend
|
|
||||||
job.amendments.append(ea)
|
job.amendments.append(ea)
|
||||||
|
|
||||||
SetFELog( message=f'Created <a class="link-light" href="/job/{job.id}">Job #{job.id}</a> to {desc}', level="success" )
|
SetFELog( message=f'Created <a class="link-light" href="/job/{job.id}">Job #{job.id}</a> to {desc}', level="success" )
|
||||||
|
|||||||
@@ -2199,6 +2199,7 @@ def JobMoveFiles(job):
|
|||||||
if 'eid-' in jex.name:
|
if 'eid-' in jex.name:
|
||||||
move_me=session.query(Entry).get(jex.value)
|
move_me=session.query(Entry).get(jex.value)
|
||||||
MoveEntriesToOtherFolder( job, move_me, dst_storage_path, f"{prefix}{suffix}" )
|
MoveEntriesToOtherFolder( job, move_me, dst_storage_path, f"{prefix}{suffix}" )
|
||||||
|
removeEntryAmendment( job, move_me.id )
|
||||||
NewJob( name="check_dups", num_files=0, wait_for=None, jex=None, parent_job=None, desc="check for duplicate files" )
|
NewJob( name="check_dups", num_files=0, wait_for=None, jex=None, parent_job=None, desc="check for duplicate files" )
|
||||||
FinishJob(job, f"Finished move selected file(s)")
|
FinishJob(job, f"Finished move selected file(s)")
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user