moved to storing DB ids rather than names of files/dirs for deletions

This commit is contained in:
2021-02-14 16:18:22 +11:00
parent d9a94ff5da
commit 0bfd3b58b3

View File

@@ -12,7 +12,9 @@
let F=[] let F=[]
</script> </script>
<div class="row"> <div class="row">
<form class="form form-inline col-lg-12" action="" method="POST"> <form class="form form-inline col-lg-12" action="{{url_for('rm_dups')}}" method="POST">
{# pass this through so that the back-end can delete this message when it rm_dups #}
<input type="hidden" name="fe_msg_id" value={{fe_msg_id}}>
{% for dups in per_file_dups %} {% for dups in per_file_dups %}
{% set outer_loop=loop.index %} {% set outer_loop=loop.index %}
<div class="col-lg-12 py-4"> <div class="col-lg-12 py-4">
@@ -22,9 +24,12 @@
onClick="KeepFile({{outer_loop}},{{loop.index}})">{{dup.d}}/{{dup.f}}</alert> onClick="KeepFile({{outer_loop}},{{loop.index}})">{{dup.d}}/{{dup.f}}</alert>
{% if loop.index < dups|length %} {% if loop.index < dups|length %}
or 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 %} {% endif %}
<script> <script>
F[{{outer_loop}}{{loop.index}}]="{{dup.f}}" F[{{outer_loop}}{{loop.index}}]="{{dup.id}}"
</script> </script>
{% endfor %} {% endfor %}
</div class="col-lg-12"> </div class="col-lg-12">
@@ -35,10 +40,11 @@
<h5>{{dup.count}} duplicate files (same file names in 2 different directories). Choose path to KEEP:</h5> <h5>{{dup.count}} duplicate files (same file names in 2 different directories). Choose path to KEEP:</h5>
<alert id="kd{{loop.index}}-d1" style="cursor: pointer;" onClick="KeepDir({{loop.index}}, 1)" class="alert">{{dup.d1}}</alert> or <alert id="kd{{loop.index}}-d1" style="cursor: pointer;" onClick="KeepDir({{loop.index}}, 1)" class="alert">{{dup.d1}}</alert> or
<alert id="kd{{loop.index}}-d2" style="cursor: pointer;" onClick="KeepDir({{loop.index}}, 2)" class="alert">{{dup.d2}}</alert> <alert id="kd{{loop.index}}-d2" style="cursor: pointer;" onClick="KeepDir({{loop.index}}, 2)" class="alert">{{dup.d2}}</alert>
<input id="kd{{loop.index}}" type="hidden" name="k1" value="{{dup.d2}}"> <input id="kdid-{{loop.index}}" type="hidden" name="kdid-1">
<input name="kdhash-{{loop.index}}" type="hidden" value="{{dup.hashes}}">
<script> <script>
D[{{loop.index}}1]="{{dup.d1}}" D[{{loop.index}}1]="{{dup.did1}}"
D[{{loop.index}}2]="{{dup.d2}}" D[{{loop.index}}2]="{{dup.did2}}"
</script> </script>
</div> </div>
{% endfor %} {% endfor %}
@@ -54,14 +60,14 @@
{ {
$('[id^=kf' + row + ']').attr('class', 'alert alert-danger sm-txt') $('[id^=kf' + row + ']').attr('class', 'alert alert-danger sm-txt')
$('#kf'+row+'-f'+which).attr('class', 'alert alert-success') $('#kf'+row+'-f'+which).attr('class', 'alert alert-success')
$('#kf'+row).val( F[row.toString()] ) $('#kfname-'+row).val( F[row.toString()+which.toString()] )
} }
function KeepDir(row, which) function KeepDir(row, which)
{ {
$('[id^=kd]').attr('class', 'alert alert-danger sm-txt') $('[id^=kd]').attr('class', 'alert alert-danger sm-txt')
$('#kd'+row+'-d'+which).attr('class', 'alert alert-success') $('#kd'+row+'-d'+which).attr('class', 'alert alert-success')
$('#kd'+row).val( D[row.toString()+which.toString()] ) $('#kdid-'+row).val( D[row.toString()+which.toString()] )
} }
// force choose last of each keep file set // force choose last of each keep file set