rewrote dups.html to now use newer model, where we will auto-delete those that match the regexp, and not show a per row view of these. Also removed extra / unneeded line when processing deleting files

This commit is contained in:
2021-03-17 20:04:25 +11:00
parent 08dc646371
commit 2cd55580a9
3 changed files with 42 additions and 37 deletions

View File

@@ -48,14 +48,14 @@
function KeepFile(row, which, al)
{
$('[id^=kf' + row + ']').attr('class', 'alert alert-danger sm-txt py-1')
$('[id^=kf' + row + ']').attr('class', 'alert alert-danger sm-txt py-1')
$('[id^=kf' + row + '-f]').attr('class', 'alert alert-danger sm-txt py-1')
$('[id^=kf' + row + '-f]').attr('class', 'alert alert-danger sm-txt py-1')
$('#kf'+row+'-f'+which).attr('class', 'alert alert-' + al + ' py-1')
$('#kfname-'+row).val( F[row.toString()+which.toString()] )
}
function KeepDir(row, which)
{
$('[id^=kd'+row+']').attr('class', 'alert alert-danger sm-txt py-1')
$('[id^=kd'+row+'-d]').attr('class', 'alert alert-danger sm-txt py-1')
$('#kd'+row+'-d'+which).attr('class', 'alert alert-success py-1')
$('#kdid-'+row).val( D[row.toString()+which.toString()] )
}
@@ -66,39 +66,56 @@
<input type="hidden" name="fe_msg_id" value={{fe_msg_id}}>
{% set page=namespace(cnt=0) %}
{% set pref=namespace(have="") %}
{% set count=namespace( del=0, keep=0 ) %}
<h5>Choose between these files:</h5>
{% for dups in per_file_dups %}
{% set outer_loop=loop.index %}
{% set pref.have="" %}
<div class="col-lg-12 py-2">
{% for dup in dups %}
<alert id="kf{{outer_loop}}-f{{loop.index}}" style="cursor: pointer;" class="alert"
onClick="KeepFile({{outer_loop}},{{loop.index}},'success')">{{dup.d}}/{{dup.f}}</alert>
{% for dup in dups %}
{% if preferred[dup.h] %}
{% set pref.have = "True" %}
{% if preferred[dup.h] == dup.id %}
{% set pref.have="kf{}-f{}".format(outer_loop,loop.index) %}
{% endif %}
{% if loop.index < dups|length %}
or
{% else %}
<input type="hidden" name="kfhash-{{outer_loop}}" value="{{dup.h}}">
<input type="hidden" id="kfname-{{outer_loop}}" name="kfname-{{outer_loop}}" value="">
{% set count.keep = count.keep + 1 %}
{% else %}
{% set count.del = count.del + (dups|length-1) %}
{% endif %}
<script>
F[{{outer_loop}}{{loop.index}}]="{{dup.id}}"
</script>
{% endfor %}
</div class="col-lg-12">
{% else %}
{% if page.cnt <= pagesize %}
{% if loop.index == 1 %}
<div class="col-lg-12 py-2">
{% endif %}
<alert id="kf{{outer_loop}}-f{{loop.index}}" style="cursor: pointer;" class="alert"
onClick="KeepFile({{outer_loop}},{{loop.index}},'success')">{{dup.d}}/{{dup.f}}</alert>
{% if preferred[dup.h] == dup.id %}
{% set pref.have="kf{}-f{}".format(outer_loop,loop.index) %}
{% endif %}
{% if loop.index < dups|length %}
or
{% else %}
<input type="hidden" name="kfhash-{{outer_loop}}" value="{{dup.h}}">
<input type="hidden" id="kfname-{{outer_loop}}" name="kfname-{{outer_loop}}" value="">
{% endif %}
<script>
F[{{outer_loop}}{{loop.index}}]="{{dup.id}}"
</script>
{% if loop.index == dups|length %}
</div class="col-lg-12">
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% if pref.have == "" %}
<script>KeepFile( {{outer_loop}}, 1,'warning' )</script>
{% else %}
<script>$("#{{pref.have}}").click()</script>
{% endif %}
{% set page.cnt = page.cnt + 1 %}
{% if page.cnt == pagesize %}
{% break %}
{% set page.cnt = page.cnt + 1 %}
{% endif %}
{% endfor %}
<div class="col-lg-12">
Matched preference regexp: Keep={{count.keep}}, Deleting={{count.del}}
</div>
{% if page.cnt < pagesize %}
<h5 class="mt-3">Choose path to KEEP (same file names in 2 different directories):</h5>
{% for dup in per_path_dups %}