now passing single DD var (duplicate data) from files.py for simplicity, also added the beginnings of support for regex-d auto keeping / auto deleting of files, and paths - noting that path data from dups.py seems to not be working with my test data at present, so html showing it needs testing too

This commit is contained in:
2021-03-21 12:18:59 +11:00
parent 2292777b83
commit 86ff96fefb

View File

@@ -6,8 +6,8 @@
<input type="hidden" name="fe_msg_id" value="{{fe_msg_id}}"></input> <input type="hidden" name="fe_msg_id" value="{{fe_msg_id}}"></input>
<h5> <h5>
<div class="form-group"> <div class="form-group">
<label for="pagesize">{{overall_dup_sets}} sets/dirs of files <label for="pagesize">{{DD.overall_dup_sets}} sets/dirs of files
containing {{overall_dup_cnt}} files -- Showing&nbsp;</label> containing {{DD.overall_dup_cnt}} files -- Showing&nbsp;</label>
<select id="pagesize" class="form form-control" name="pagesize" onChange="ResetPageSize()"> <select id="pagesize" class="form form-control" name="pagesize" onChange="ResetPageSize()">
{% for o in "5", "10", "15", "20", "25", "50", "75", "100", "200" %} {% for o in "5", "10", "15", "20", "25", "50", "75", "100", "200" %}
<option <option
@@ -67,14 +67,29 @@
{% set page=namespace(cnt=0) %} {% set page=namespace(cnt=0) %}
{% set pref=namespace(have="") %} {% set pref=namespace(have="") %}
{% set count=namespace( del=0, keep=0 ) %} {% set count=namespace( del=0, keep=0 ) %}
{% for dups in DD.ip_to_sp_dups_keep %}
{% set count.keep = count.keep+1 %}
need to do some hidden inputs here to keep these files<br>
{% endfor %}
{% for dups in DD.ip_to_sp_dups_del %}
{% set count.del = count.del+1 %}
maybe need to do some hidden inputs here to del these files? (not sure it was needed in del code to triple-check)<br>
{% endfor %}
{% if count.keep or count.del %}
<div class="col-lg-12">
Keeping {{count.keep}} files in storage path and deleting {{count.del}} from import path
</div>
{% set count.keep=0 %}
{% set count.del=0 %}
{% endif %}
<h5>Choose between these files:</h5> <h5>Choose between these files:</h5>
{% for dups in per_file_dups %} {% for dups in DD.per_file_dups %}
{% set outer_loop=loop.index %} {% set outer_loop=loop.index %}
{% set pref.have="" %} {% set pref.have="" %}
{% for dup in dups %} {% for dup in dups %}
{% if preferred[dup.h] %} {% if DD.preferred_file[dup.h] %}
{% set pref.have = "True" %} {% set pref.have = "True" %}
{% if preferred[dup.h] == dup.id %} {% if DD.preferred_file[dup.h] == dup.id %}
<input type="hidden" name="kfhash-{{outer_loop}}" value="{{dup.h}}"> <input type="hidden" name="kfhash-{{outer_loop}}" value="{{dup.h}}">
<input type="hidden" id="kfname-{{outer_loop}}" name="kfname-{{outer_loop}}" value=""> <input type="hidden" id="kfname-{{outer_loop}}" name="kfname-{{outer_loop}}" value="">
{% set count.keep = count.keep + 1 %} {% set count.keep = count.keep + 1 %}
@@ -88,7 +103,7 @@
{% endif %} {% endif %}
<alert id="kf{{outer_loop}}-f{{loop.index}}" style="cursor: pointer;" class="alert" <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> onClick="KeepFile({{outer_loop}},{{loop.index}},'success')">{{dup.d}}/{{dup.f}}</alert>
{% if preferred[dup.h] == dup.id %} {% if DD.preferred_file[dup.h] == dup.id %}
{% set pref.have="kf{}-f{}".format(outer_loop,loop.index) %} {% set pref.have="kf{}-f{}".format(outer_loop,loop.index) %}
{% endif %} {% endif %}
{% if loop.index < dups|length %} {% if loop.index < dups|length %}
@@ -118,7 +133,7 @@
{% if page.cnt < pagesize %} {% if page.cnt < pagesize %}
<h5 class="mt-3">Choose path to KEEP (same file names in 2 different directories):</h5> <h5 class="mt-3">Choose path to KEEP (same file names in 2 different directories):</h5>
{% for dup in per_path_dups %} {% for dup in DD.per_path_dups %}
<div class="col-lg-12 py-2"> <div class="col-lg-12 py-2">
{{dup.count}} duplicates in: {{dup.count}} duplicates in:
<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
@@ -128,6 +143,12 @@
<script> <script>
D[{{loop.index}}1]="{{dup.did1}}" D[{{loop.index}}1]="{{dup.did1}}"
D[{{loop.index}}2]="{{dup.did2}}" D[{{loop.index}}2]="{{dup.did2}}"
{% if DD.preferred_path[dup.h] == dup.id1 %}
KeepDir( {{loop.inex}}, 1 )
{% endif %}
{% if DD.preferred_path[dup.h] == dup.id2 %}
KeepDir( {{loop.inex}}, 2 )
{% endif %}
</script> </script>
</div> </div>
{% set page.cnt = page.cnt + 1 %} {% set page.cnt = page.cnt + 1 %}