108 lines
5.3 KiB
HTML
108 lines
5.3 KiB
HTML
{% extends "base.html" %} {% block main_content %}
|
|
<div class="container-fluid">
|
|
<h3 class="offset-lg-2">{{page_title}}</h3>
|
|
<div class="alert alert-info">Duplicate files have been detected. They have the same binary content,
|
|
but either have a different name, there are 3 or more copies or are stored in two different
|
|
directories. Choose between the options below. NOTE: after you click
|
|
'Delete Duplicates', the files / directories in red will be deleted from the file
|
|
system, those in green will remain
|
|
</div>
|
|
<form class="d-flex justify-content-center form-inline">
|
|
<h5>
|
|
<div class="form-group">
|
|
<label for="page_size">{{overall_dup_sets}} sets/dirs of files
|
|
containing {{overall_dup_cnt}} files -- Showing </label>
|
|
<select class="form form-control" name="page_size">
|
|
{% for o in "5", "10", "20", "50" %}
|
|
<option
|
|
{% if o|int == page_size %}
|
|
selected
|
|
{% endif %}
|
|
>{{o}}</option>
|
|
{% endfor %}
|
|
</select>
|
|
duplicates at a time
|
|
</div>
|
|
</h5>
|
|
</form>
|
|
<script>
|
|
let D=[]
|
|
let F=[]
|
|
</script>
|
|
<div class="row">
|
|
<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}}>
|
|
{% set page=namespace(cnt=0) %}
|
|
<h5>Choose between these files:</h5>
|
|
{% for dups in per_file_dups %}
|
|
{% set outer_loop=loop.index %}
|
|
<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}})">{{dup.d}}/{{dup.f}}</alert>
|
|
{% 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>
|
|
{% endfor %}
|
|
</div class="col-lg-12">
|
|
{% set page.cnt = page.cnt + 1 %}
|
|
{% if page.cnt == page_size %}
|
|
{% break %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
{% if page.cnt < page_size %}
|
|
<h5 class="mt-3">Choose path to KEEP (same file names in 2 different directories):</h5>
|
|
{% for dup in per_path_dups %}
|
|
<div class="col-lg-12 py-2">
|
|
{{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}}-d2" style="cursor: pointer;" onClick="KeepDir({{loop.index}}, 2)" class="alert">{{dup.d2}}</alert>
|
|
<input id="kdid-{{loop.index}}" type="hidden" name="kdid-1">
|
|
<input name="kdhash-{{loop.index}}" type="hidden" value="{{dup.hashes}}">
|
|
<script>
|
|
D[{{loop.index}}1]="{{dup.did1}}"
|
|
D[{{loop.index}}2]="{{dup.did2}}"
|
|
</script>
|
|
</div>
|
|
{% set page.cnt = page.cnt + 1 %}
|
|
{% if page.cnt == page_size %}
|
|
{% break %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
<input class="btn btn-danger mt-2" type="submit" value="Delete Duplicates">
|
|
</form>
|
|
</div class="row">
|
|
</div class="container">
|
|
{% endblock main_content %}
|
|
{% block script_content %}
|
|
<script>
|
|
function KeepFile(row, which)
|
|
{
|
|
$('[id^=kf' + row + ']').attr('class', 'alert alert-danger sm-txt py-1')
|
|
$('#kf'+row+'-f'+which).attr('class', 'alert alert-success 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')
|
|
$('#kd'+row+'-d'+which).attr('class', 'alert alert-success py-1')
|
|
$('#kdid-'+row).val( D[row.toString()+which.toString()] )
|
|
}
|
|
|
|
// force choose last of each keep file set
|
|
$('[id$=f1]').each( function () { $(this).siblings( '.alert' ).last().click() } )
|
|
// force choose last of each dir set
|
|
$('[id$=d2]').each( function() { $(this).click() } )
|
|
</script>
|
|
{% endblock script_content %}
|