Compare commits

...

3 Commits

4 changed files with 44 additions and 34 deletions

5
TODO
View File

@@ -4,11 +4,6 @@
# also all the add ref img/add override, etc are non-functional - FIX the override* stuff first to get table/naming consistency as that is half the problem # also all the add ref img/add override, etc are non-functional - FIX the override* stuff first to get table/naming consistency as that is half the problem
# NMO data -> there is an NMO object (just NMO names/types - |json), then there is per face level data - this should be a reference from Face and Schema/marshmallow # NMO data -> there is an NMO object (just NMO names/types - |json), then there is per face level data - this should be a reference from Face and Schema/marshmallow
# #
#2 should start with an empty DB and test
# definitely no dirs in storage_sp I now pass root_eid=0 for this
# BUT - need GUI to work - may even be good to put an alert up - its so odd to have not root dir ONLY happens when no data
#3 empty directories (2017/20171015-test/...) showing "No matches for: 'undefined'" <- should only comes up for search in URL???
#
#4 TEST everything (don't forget keybindings,e.g. delete) #4 TEST everything (don't forget keybindings,e.g. delete)
# -- go into viewer code from a files_rbp - had red bin, bot green on viewer. # -- go into viewer code from a files_rbp - had red bin, bot green on viewer.
# #

View File

@@ -209,6 +209,16 @@ class FaceRefimgLinkSchema(ma.SQLAlchemyAutoSchema):
class Meta: model = FaceRefimgLink class Meta: model = FaceRefimgLink
load_instance = True load_instance = True
class FaceNoMatchOverrideSchema(ma.SQLAlchemyAutoSchema):
class Meta: model = FaceOverrideType
load_instance = True
type = ma.Nested(FaceOverrideType)
class FaceForceMatchOverrideSchema(ma.SQLAlchemyAutoSchema):
class Meta: model = FaceOverrideType
load_instance = True
person = ma.Nested(Person)
class FaceSchema(ma.SQLAlchemyAutoSchema): class FaceSchema(ma.SQLAlchemyAutoSchema):
class Meta: class Meta:
model=Face model=Face
@@ -218,6 +228,8 @@ class FaceSchema(ma.SQLAlchemyAutoSchema):
# faces have to come with a file connection # faces have to come with a file connection
facefile_lnk = ma.Nested(FaceFileLinkSchema) facefile_lnk = ma.Nested(FaceFileLinkSchema)
refimg_lnk = ma.Nested(FaceRefimgLinkSchema,allow_none=True) refimg_lnk = ma.Nested(FaceRefimgLinkSchema,allow_none=True)
fnmo = ma.Nested( FaceNoMatchOverride, allow_none=True )
ffmo = ma.Nested( FaceForceMatchOverride, allow_none=True )
class FileSchema(ma.SQLAlchemyAutoSchema): class FileSchema(ma.SQLAlchemyAutoSchema):
class Meta: model = File class Meta: model = File
@@ -466,9 +478,8 @@ def file_list_ip():
@login_required @login_required
def files_ip(): def files_ip():
OPT=States( request ) OPT=States( request )
people = Person.query.all()
query_data = GetQueryData( OPT ) query_data = GetQueryData( OPT )
return render_template("files.html", page_title=f"View Files ({OPT.path_type} Path)", OPT=OPT, people=people, query_data=query_data ) return render_template("files.html", page_title=f"View Files ({OPT.path_type} Path)", OPT=OPT, query_data=query_data )
################################################################################ ################################################################################
# /files -> show thumbnail view of files from storage_path # /files -> show thumbnail view of files from storage_path
@@ -477,9 +488,8 @@ def files_ip():
@login_required @login_required
def files_sp(): def files_sp():
OPT=States( request ) OPT=States( request )
people = Person.query.all()
query_data = GetQueryData( OPT ) query_data = GetQueryData( OPT )
return render_template("files.html", page_title=f"View Files ({OPT.path_type} Path)", OPT=OPT, people=people, query_data=query_data ) return render_template("files.html", page_title=f"View Files ({OPT.path_type} Path)", OPT=OPT, query_data=query_data )
################################################################################ ################################################################################
@@ -489,9 +499,8 @@ def files_sp():
@login_required @login_required
def files_rbp(): def files_rbp():
OPT=States( request ) OPT=States( request )
people = Person.query.all()
query_data = GetQueryData( OPT ) query_data = GetQueryData( OPT )
return render_template("files.html", page_title=f"View Files ({OPT.path_type} Path)", OPT=OPT, people=people, query_data=query_data ) return render_template("files.html", page_title=f"View Files ({OPT.path_type} Path)", OPT=OPT, query_data=query_data )
################################################################################ ################################################################################
# search -> GET version -> has search_term in the URL and is therefore able to # search -> GET version -> has search_term in the URL and is therefore able to

View File

@@ -221,20 +221,6 @@ function DetailsDBox()
} }
// function to change the size of thumbnails (and resets button bar to newly
// selected size)
function ChangeSize(clicked_button,sz)
{
$('.sz-but.btn-info').removeClass('btn-info text-white').addClass('btn-outline-info')
$(clicked_button).addClass('btn-info text-white').removeClass('btn-outline-info')
$('.thumb').attr( {height: sz, style: 'font-size:'+sz+'px' } )
$('#size').val(sz)
sz=sz-22
$('.svg').height(sz);
$('.svg').width(sz);
$('.svg_cap').width(sz);
}
// DoSel is called when a click event occurs, and sets the selection via adding // DoSel is called when a click event occurs, and sets the selection via adding
// 'highlight' to the class of the appropriate thumbnails // 'highlight' to the class of the appropriate thumbnails
// e == event (can see if shift/ctrl held down while left-clicking // e == event (can see if shift/ctrl held down while left-clicking
@@ -504,7 +490,7 @@ function drawPageOfFigures()
if( OPT.folders ) if( OPT.folders )
{ {
if( document.entries.length && document.entries[0].in_dir.rel_path == '' ) if( (document.entries.length && document.entries[0].in_dir.rel_path == '' ) || OPT.root_eid == 0 )
{ {
gray="_gray" gray="_gray"
back="" back=""
@@ -526,17 +512,17 @@ function drawPageOfFigures()
</figure> </figure>
</div>` </div>`
ecnt++ ecnt++
/*
<script>f=$('#_back'); w=f.find('svg').width(); f.find('figcaption').width(w);</script>
*/
$('#figures').append(html) $('#figures').append(html)
} }
for (const obj of document.entries) { for (const obj of document.entries) {
addFigure( obj, last, ecnt ) addFigure( obj, last, ecnt )
ecnt++ ecnt++
} }
if( document.entries.length == 0 && OPT.search_term ) if( document.entries.length == 0 )
$('#figures').append( `<span class="alert alert-danger p-2 col-auto"> No matches for: '${OPT.search_term}'</span>` ) if( OPT.search_term )
$('#figures').append( `<span class="alert alert-danger p-2 col-auto"> No matches for: '${OPT.search_term}'</span>` )
else if( OPT.root_eid == 0 )
$('#figures').append( `<span class="alert alert-danger p-2 col-auto d-flex align-items-center">No files in Path!</span>` )
$('.figure').click( function(e) { DoSel(e, this ); SetButtonState(); return false; }); $('.figure').click( function(e) { DoSel(e, this ); SetButtonState(); return false; });
$('.figure').dblclick( function(e) { dblClickToViewEntry( $(this).attr('id') ); setDisabledForViewingNextPrevBttons(); addViewerKeyHandler() } ) $('.figure').dblclick( function(e) { dblClickToViewEntry( $(this).attr('id') ); setDisabledForViewingNextPrevBttons(); addViewerKeyHandler() } )
// for dir, getDirEntries 2nd param is back (or "up" a dir) // for dir, getDirEntries 2nd param is back (or "up" a dir)
@@ -547,6 +533,11 @@ function drawPageOfFigures()
function getPageFileList(res, viewingIdx) function getPageFileList(res, viewingIdx)
{ {
$('#file_list_div').empty() $('#file_list_div').empty()
if( OPT.root_eid == 0 )
{
$('#file_list_div').append( `<span class="alert alert-danger p-2">No files in Path!</span>` )
return
}
html='<table class="table table-striped table-sm col-12">' html='<table class="table table-striped table-sm col-12">'
html+='<thead><tr class="table-primary"><th>Name</th><th>Size (MB)</th><th>Path Prefix</th><th>Hash</th></tr></thead><tbody>' html+='<thead><tr class="table-primary"><th>Name</th><th>Size (MB)</th><th>Path Prefix</th><th>Hash</th></tr></thead><tbody>'
for (const obj of res) { for (const obj of res) {
@@ -594,6 +585,13 @@ function getPage(pageNumber, successCallback, viewingIdx=0)
// if search, disable folders // if search, disable folders
if( OPT.search_term ) if( OPT.search_term )
$('#folders').prop('disabled', 'disabled').removeClass('border-info').addClass('border-secondary').removeClass('text-info').addClass('text-secondary'); $('#folders').prop('disabled', 'disabled').removeClass('border-info').addClass('border-secondary').removeClass('text-info').addClass('text-secondary');
else if( res == [] )
{
html=`<span class="alert alert-danger p-2 col-auto">No files in Path!'</span>`
console.log(html)
$('#file_list_div').append(html)
$('#files_div').append(html)
}
}, },
error: function(xhr, status, error) { console.error("Error:", error); } }); error: function(xhr, status, error) { console.error("Error:", error); } });
return return
@@ -704,7 +702,7 @@ function changeOPT(successCallback) {
OPT.folders=new_f OPT.folders=new_f
OPT.folders=$('#folders').val() OPT.folders=$('#folders').val()
OPT.grouping=$('#grouping').val() OPT.grouping=$('#grouping').val()
OPT.size=$('#size').val() OPT.size=$('input[name="size"]:checked').val();
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: '/change_file_opts', url: '/change_file_opts',
@@ -715,6 +713,7 @@ function changeOPT(successCallback) {
// put data back into booleans, ints, etc // put data back into booleans, ints, etc
OPT.folders=( OPT.folders == 'True' ) OPT.folders=( OPT.folders == 'True' )
OPT.how_many=parseInt(OPT.how_many) OPT.how_many=parseInt(OPT.how_many)
console.log('OPT.size='+OPT.size)
$('.how_many_text').html( `&nbsp;${OPT.how_many} files&nbsp;` ) $('.how_many_text').html( `&nbsp;${OPT.how_many} files&nbsp;` )
OPT.root_eid=parseInt(OPT.root_eid) OPT.root_eid=parseInt(OPT.root_eid)
OPT.size=parseInt(OPT.size) OPT.size=parseInt(OPT.size)
@@ -727,7 +726,13 @@ function changeOPT(successCallback) {
function changeSize() function changeSize()
{ {
sz=$('input[name="size"]:checked').val(); sz=$('input[name="size"]:checked').val();
$('.thumb').prop('height',sz); OPT.size=sz
$('.thumb').attr( {height: sz, style: 'font-size:'+sz+'px' } )
$('#size').val(sz)
sz=sz-22
$('.svg').height(sz);
$('.svg').width(sz);
$('.svg_cap').width(sz);
} }

View File

@@ -19,7 +19,7 @@
</div class="input-group..."> </div class="input-group...">
</div class="col col-auto"> </div class="col col-auto">
</div class="container"> </div class="container">
<div id="file_list_div" class="container-fluid"> <div id="file_list_div" class="container-fluid pt-2">
</div class="container"> </div class="container">
<div class="container-fluid"> <div class="container-fluid">
<input type="hidden" name="cwd" id="cwd" value="{{OPT.cwd}}"> <input type="hidden" name="cwd" id="cwd" value="{{OPT.cwd}}">
@@ -40,6 +40,7 @@
// this is the list of entry ids for the images for ALL matches for this query // this is the list of entry ids for the images for ALL matches for this query
var entryList={{query_data.entry_list}} var entryList={{query_data.entry_list}}
var OPT = {{ OPT.to_dict()|tojson }}; var OPT = {{ OPT.to_dict()|tojson }};
OPT.root_eid = {{ query_data.root_eid }};
// pageList is just those entries shown on this page from the full entryList // pageList is just those entries shown on this page from the full entryList
var pageList=[] var pageList=[]