progress towards allowing overrides. dbox can now allow finding a person and clicking them to post to back-end.. More work to make this real, for now it goes through the routes but does not update the DB, see bottom of face.py for next steps
This commit is contained in:
@@ -257,7 +257,44 @@ $(document).ready( function()
|
||||
} )
|
||||
} );
|
||||
|
||||
// quick wrapper function to make calling this ajax code simpler in SearchForPerson
|
||||
function OverrideForceMatch( person, face )
|
||||
{
|
||||
ofm='&person_id='+person+'&face_id='+face
|
||||
// on success, close the dbox, force face drawing on and redraw the face with the new override
|
||||
$.ajax({ type: 'POST', data: ofm, url: '/override_force_match', success: function(data) {
|
||||
$('#dbox').modal('hide');
|
||||
$('#faces').prop('checked',true);
|
||||
DrawImg();
|
||||
}
|
||||
} )
|
||||
}
|
||||
|
||||
// function to facilitate adding a face match override to this "found" person
|
||||
// uses Ajax to the f/e to get any person matching #stext's content (via any name/tag)
|
||||
// and displays results in #search_person_results
|
||||
function SearchForPerson(face_id)
|
||||
{
|
||||
// make URI safe
|
||||
who = encodeURIComponent( $('#stext').val() )
|
||||
// call ajax to find ppl
|
||||
$.ajax({ type: 'POST', data: null, url: '/find_persons/'+ who,
|
||||
success: function(data) {
|
||||
content='Click one of the link(s) below to manually connect this face as once-off connection to the person:<br><br>'
|
||||
for( var key in data ) {
|
||||
var person = data[key];
|
||||
content+= '<a onClick="OverrideForceMatch('+person.id+','+face_id+')">'+person.firstname+' '+person.surname+'('+person.tag+')</a><br>'
|
||||
}
|
||||
$('#search_person_results').html( content )
|
||||
}
|
||||
} )
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
// function that is called when we click on a face in the viewer and we want to
|
||||
// potentially override the non-match / match... it shows the face, and then
|
||||
// based on which menu item got us here, shows appropriate text to do next action
|
||||
function FaceDBox(key, item)
|
||||
{
|
||||
div ='<p>'
|
||||
@@ -279,9 +316,12 @@ function FaceDBox(key, item)
|
||||
div+=
|
||||
`
|
||||
<div class="input-group mb-3"><input type="text" class="form-control" id="stext" placeholder="tag/name">
|
||||
<button class="btn btn-outline-success" type="button" onClick="console.log('search for: ' + $('#stext').val());return false">Search</button>
|
||||
<button class="btn btn-outline-success" type="button" onClick="SearchForPerson(`
|
||||
div+= item[key]['id']
|
||||
div+=`)">Search</button>
|
||||
</div>
|
||||
`
|
||||
<div id="search_person_results">
|
||||
</div>`
|
||||
}
|
||||
if ( key == 'wrong_person' )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user