okay fix_dups page now has functioning pagination, highlights regex matching "good" files as green, and just a file as yellow if we cant find the right one, so easily shows where to really pat attention. Has DBox based help page, and overall just a better UI/UX
This commit is contained in:
@@ -11,6 +11,11 @@
|
||||
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.22/css/dataTables.bootstrap4.min.css">
|
||||
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
|
||||
<script src="https://kit.fontawesome.com/9b4c7cf470.js" crossorigin="anonymous"></script>
|
||||
<!-- code to get bootstrap & bootstrap datatable to work -->
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.10.22/js/dataTables.bootstrap4.min.js"></script>
|
||||
{% import "bootstrap/wtf.html" as wtf %}
|
||||
<style>
|
||||
.highlight { box-shadow: 0 0 7px 4px #5bc0de }
|
||||
@@ -21,7 +26,7 @@
|
||||
|
||||
<!-- Modal Dialog Box, jquery used to show / set content -->
|
||||
<div id="dbox" class="modal fade" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog mw-100 w-100">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 id="dbox-title" class="modal-title"></h5>
|
||||
@@ -135,11 +140,6 @@
|
||||
{% endblock main_content %}
|
||||
|
||||
{% if not InDBox %}
|
||||
<!-- code to get bootstrap & bootstrap datatable to work -->
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.10.22/js/dataTables.bootstrap4.min.js"></script>
|
||||
<script>
|
||||
function SetViewingOptionsForSearchForm()
|
||||
{
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
{% 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">
|
||||
<form id="psform" class="d-flex justify-content-center form-inline" method="POST" action="">
|
||||
<input type="hidden" name="fe_msg_id" value="{{fe_msg_id}}"></input>
|
||||
<h5>
|
||||
<div class="form-group">
|
||||
<label for="pagesize">{{overall_dup_sets}} sets/dirs of files
|
||||
containing {{overall_dup_cnt}} files -- Showing </label>
|
||||
<select class="form form-control" name="pagesize">
|
||||
{% for o in "5", "10", "20", "50" %}
|
||||
<select id="pagesize" class="form form-control" name="pagesize" onChange="ResetPageSize()">
|
||||
{% for o in "5", "10", "15", "20", "25", "50", "75", "100", "200" %}
|
||||
<option
|
||||
{% if o|int == pagesize %}
|
||||
selected
|
||||
@@ -22,25 +18,65 @@
|
||||
{% endfor %}
|
||||
</select>
|
||||
duplicates at a time
|
||||
<button class="button btn-info" onClick="$('#dbox').modal('show'); return false;"><i class="fas fa-info-circle"></i></button>
|
||||
</div>
|
||||
</h5>
|
||||
</form>
|
||||
<script>
|
||||
let D=[]
|
||||
let F=[]
|
||||
|
||||
function ResetPageSize()
|
||||
{
|
||||
console.log( $("#pagesize").val() )
|
||||
$("#psform").submit()
|
||||
return false;
|
||||
}
|
||||
|
||||
$('#dbox-title').html('Duplicate Files Processing (info)')
|
||||
div=`
|
||||
<p>The duplicates are shown below ({{pagesize}} at a time) in a per set of files or sets of directories</p>
|
||||
<p>The per file sets are shown with the title 'Choose between these fiels' and show a series of duplicate files in a row, that comprise one of:</p>
|
||||
<ul>
|
||||
<li>3 or more of the same file</li>
|
||||
<li>different file names in the same or different directories</li>
|
||||
</ul>
|
||||
<p>The per direcory sets are shown with the title 'Choose path to KEEP...' and show a series of directories in a row, that contain duplicate files. In this view duplicates have the same file name and any other files in these directories that are not duplicates will not be deleted</p>
|
||||
<p>TO BE CLEAR: after you click the "Delete Duplicates" button, the files in red and duplicate files in directories in red will be deleted from the file system</p>
|
||||
`
|
||||
$('#dbox-content').html(div)
|
||||
|
||||
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')
|
||||
$('#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')
|
||||
$('#kd'+row+'-d'+which).attr('class', 'alert alert-success py-1')
|
||||
$('#kdid-'+row).val( D[row.toString()+which.toString()] )
|
||||
}
|
||||
</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) %}
|
||||
{% set pref=namespace(have="") %}
|
||||
<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}})">{{dup.d}}/{{dup.f}}</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 %}
|
||||
@@ -52,6 +88,11 @@
|
||||
</script>
|
||||
{% endfor %}
|
||||
</div class="col-lg-12">
|
||||
{% 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 %}
|
||||
@@ -85,22 +126,6 @@
|
||||
{% 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>
|
||||
|
||||
Reference in New Issue
Block a user