fixed BUG-114 -> only show path-specific existing options in movedbox. Added test doc to read to TODO

This commit is contained in:
2023-01-13 16:48:35 +11:00
parent f98369e118
commit f875b50dc8
4 changed files with 23 additions and 10 deletions

3
BUGs
View File

@@ -6,6 +6,3 @@ BUG-106: cant add trudy /pat? as refimgs via FaceDBox
(it came from a face bbox, BUT, I have grown the face seln by 10%?)
BUG-109: add mich force override, removed it, then re-added it, then rebuild DB form scratch and metadata has a duplicate
- redo disco metadata with md5 not UUID of face dataS
BUG-114: when moving files, the offered similar dirs include those from other paths:
- when we change the sel_rp (and icon), should also change offered similar dirs
- AND its showing 'Import/Camera_Uploads/...' - is this a path issue in files.py / GetExisting* or?

2
TODO
View File

@@ -9,6 +9,8 @@
* think about security - in job_mgr anywhere I can os.replace/remove NEED to protect, etc
* read this: https://flask.palletsprojects.com/en/2.2.x/testing/#faking-resources-and-context
* could get better AI optim, by keeping track of just new files since scan (even if we did this from the DB),
then we could just feed those eid's explicitly into a 'run_ai_on_new_files' :) -- maybe particularly
if count('new files') < say 1000 do eids, otherwise do path AND no new refimgs

View File

@@ -815,9 +815,10 @@ def GetExistingPathsAsDiv(dt):
ret+= '{ '
ret+= '"prefix":"' + bits[0] + '-", '
if len(bits)>1:
ret+= '"suffix":"' + bits[1] + '"'
ret+= '"suffix":"' + bits[1] + '", '
else:
ret+= '"suffix":"''"'
ret+= '"suffix":"''", '
ret += '"ptype": "'+dir.in_path.type.name+'"'
ret+= ' } '
first_dir=0
ret+= ' ]'

View File

@@ -35,12 +35,18 @@ function change_rp_sel()
icon_url = $('option:selected', '#rp_sel').attr('icon_url')
$('#move_path_icon').html( '<svg id="move_path_icon" width="20" height="20" fill="currentColor"><use xlink:href="'
+ icon_url + '"></svg>' )
$('#move_path_type').val( $('option:selected', '#rp_sel').attr('path_type') )
seld_ptype=$('option:selected', '#rp_sel').attr('path_type')
$('#move_path_type').val( seld_ptype )
// clear all 'existing' buttons
$('.move_Import').addClass('d-none')
$('.move_Storage').addClass('d-none')
// show just selected path's (relevant) buttons
$('.move_'+seld_ptype).removeClass('d-none')
}
// POST to see if there are any other existing directories named around this date
// (if so display them as options for a move)
function GetExistingDirsAsDiv( dt, divname )
function GetExistingDirsAsDiv( dt, divname, ptype )
{
$.ajax({
type: 'POST', data: null, url: '/getexistingpaths/'+dt,
@@ -49,10 +55,17 @@ function GetExistingDirsAsDiv( dt, divname )
dirs = JSON.parse(data)
s=''
dirs.forEach( function(item, index) {
s+= '<button class="btn btn-outline-primary" type="button" onClick="$(\'#prefix\').val(\''+item.prefix+'\'); $(\'#suffix\').val(\''+item.suffix+'\');return false;">'+item.prefix+item.suffix+'</button>'
if( item.ptype != ptype )
vis = 'd-none '
else
vis = ''
s+= '<button class="btn btn-outline-primary move_'+item.ptype+ ' ' + vis + '" '
s+= 'onClick="$(\'#prefix\').val(\''+item.prefix+'\'); $(\'#suffix\').val(\''+item.suffix+'\');return false;">'+item.prefix+item.suffix+'</button>'
} )
if( s == '' )
$('#existing').html('')
else
$('#move_'+ptype).removeClass('invisible')
$('#'+divname).html(s)
}
} )
@@ -86,8 +99,8 @@ function MoveDBox(path_details, db_url)
div+=GetSelnAsDiv()
yr=$('.highlight').first().attr('yr')
dt=$('.highlight').first().attr('date')
div+='<div id="existing" class="col-12">Use Existing:</div><div id="existing"></div>'
GetExistingDirsAsDiv( dt, "existing" )
div+='<div class="row">Use Existing Directory (in the chosen path):</div><div id="existing"></div>'
GetExistingDirsAsDiv( dt, "existing", path_details[0].type )
div+=`
<div class="input-group my-3">
<alert class="alert alert-primary my-auto py-1">