Files
mc-webui/app/templates/contacts-manage.html
T
MarekWo 4345456db7 refactor(contacts): Remove path_len filter from cleanup tool
Remove impractical path length filter from contact cleanup feature.
The out_path_len parameter is rarely useful as most contacts have
value -1 (no route), making this filter unpractical for real-world use.

Changes:
- Remove path_len parameter from backend API endpoints
- Remove path length input field from HTML template
- Remove path_len collection from JavaScript code
- Update documentation (CLAUDE.md, README.md)
- Simplify cleanup filter to: name, types, date field, and days

Backend changes:
- Update _filter_contacts_by_criteria() to remove path_len logic
- Remove path_len validation from both endpoints
- Update API documentation in docstrings

Frontend changes:
- Remove Path Length input section from contacts-manage.html
- Remove path_len from collectCleanupCriteria() function

Documentation changes:
- Update API endpoint descriptions in CLAUDE.md
- Update cleanup instructions in README.md
- Remove path_len from example use cases

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-01 15:18:40 +01:00

176 lines
8.2 KiB
HTML

{% extends "contacts_base.html" %}
{% block title %}Contact Management Settings - mc-webui{% endblock %}
{% block navbar_content %}
<span class="navbar-brand mb-0 h1">
<i class="bi bi-person-check"></i> Contact Management
</span>
<div class="d-flex align-items-center gap-2">
<button class="btn btn-outline-light btn-sm" onclick="window.location.href='/';" title="Home">
<i class="bi bi-house"></i>
</button>
</div>
{% endblock %}
{% block page_content %}
<div id="managePageContent">
<!-- Page Header -->
<div class="mb-4">
<h2 class="mb-1">
<i class="bi bi-gear"></i> Settings
</h2>
<p class="text-muted small mb-0">Configure contact management preferences</p>
</div>
<!-- Manual Approval Settings Section -->
<div class="compact-setting">
<div class="form-check form-switch mb-0 d-flex align-items-center gap-2">
<input class="form-check-input" type="checkbox" role="switch" id="manualApprovalSwitch" style="cursor: pointer; min-width: 3rem; min-height: 1.5rem;">
<label class="form-check-label mb-0" for="manualApprovalSwitch" style="cursor: pointer; font-weight: 500;">
<span id="switchLabel">Loading...</span>
</label>
</div>
<i class="bi bi-info-circle info-icon"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="When enabled, new contacts must be manually approved before they can communicate with your node"></i>
</div>
<!-- Navigation Section -->
<div class="mb-4">
<h5 class="mb-3">
<i class="bi bi-list-ul"></i> Manage Contacts
</h5>
<!-- Pending Contacts Card -->
<div class="nav-card" onclick="window.location.href='/contacts/pending';">
<div>
<h6><i class="bi bi-hourglass-split"></i> Pending Contacts</h6>
<small class="text-muted">Contacts awaiting manual approval</small>
</div>
<span class="badge bg-primary rounded-pill" id="pendingBadge" style="font-size: 1.1rem;">
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
</span>
</div>
<!-- Existing Contacts Card -->
<div class="nav-card" onclick="window.location.href='/contacts/existing';">
<div>
<h6><i class="bi bi-person-lines-fill"></i> Existing Contacts</h6>
<small class="text-muted">View and manage your approved contacts</small>
</div>
<span class="badge counter-badge counter-ok rounded-pill" id="existingBadge" style="font-size: 1.1rem;">
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
</span>
</div>
</div>
<!-- Cleanup Contacts Section -->
<div class="cleanup-section">
<h6>
<i class="bi bi-trash"></i>
<span>Cleanup Contacts</span>
<i class="bi bi-info-circle info-icon"
data-bs-toggle="tooltip"
data-bs-placement="top"
title="Remove contacts based on various filter criteria"></i>
</h6>
<!-- Basic Filters (Always visible) -->
<div class="mb-3">
<label for="cleanupNameFilter" class="form-label">Name Filter (optional):</label>
<input type="text" class="form-control" id="cleanupNameFilter" placeholder="Enter partial name to search...">
</div>
<!-- Advanced Filters (Collapsible) -->
<div class="mb-3">
<button class="btn btn-sm btn-outline-secondary w-100" type="button" data-bs-toggle="collapse" data-bs-target="#advancedFilters" aria-expanded="false" aria-controls="advancedFilters">
<i class="bi bi-sliders"></i> Advanced Filters
</button>
</div>
<div class="collapse" id="advancedFilters">
<!-- Contact Types -->
<div class="mb-3">
<label class="form-label">Contact Types:</label>
<div class="d-flex flex-wrap gap-2">
<div class="form-check">
<input class="form-check-input cleanup-type-filter" type="checkbox" value="1" id="cleanupTypeCLI" checked>
<label class="form-check-label" for="cleanupTypeCLI">CLI</label>
</div>
<div class="form-check">
<input class="form-check-input cleanup-type-filter" type="checkbox" value="2" id="cleanupTypeREP" checked>
<label class="form-check-label" for="cleanupTypeREP">REP</label>
</div>
<div class="form-check">
<input class="form-check-input cleanup-type-filter" type="checkbox" value="3" id="cleanupTypeROOM" checked>
<label class="form-check-label" for="cleanupTypeROOM">ROOM</label>
</div>
<div class="form-check">
<input class="form-check-input cleanup-type-filter" type="checkbox" value="4" id="cleanupTypeSENS" checked>
<label class="form-check-label" for="cleanupTypeSENS">SENS</label>
</div>
</div>
</div>
<!-- Date Field -->
<div class="mb-3">
<label class="form-label">Date Field:</label>
<div class="d-flex gap-3">
<div class="form-check">
<input class="form-check-input" type="radio" name="cleanupDateField" id="cleanupDateLastAdvert" value="last_advert" checked>
<label class="form-check-label" for="cleanupDateLastAdvert">Last Advert</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="cleanupDateField" id="cleanupDateLastMod" value="lastmod">
<label class="form-check-label" for="cleanupDateLastMod">Last Modified</label>
</div>
</div>
</div>
<!-- Days of Inactivity -->
<div class="mb-3">
<label for="cleanupDays" class="form-label">Days of Inactivity (0 = ignore):</label>
<input type="number" class="form-control" id="cleanupDays" value="2" min="0">
<small class="form-text text-muted">Contacts inactive for more than this many days will be selected</small>
</div>
</div>
<button class="btn btn-warning" id="cleanupPreviewBtn">
<i class="bi bi-eye"></i> Preview Cleanup
</button>
</div>
</div>
<!-- Cleanup Confirmation Modal -->
<div class="modal fade" id="cleanupConfirmModal" tabindex="-1" aria-labelledby="cleanupConfirmModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header bg-warning">
<h5 class="modal-title" id="cleanupConfirmModalLabel">
<i class="bi bi-exclamation-triangle"></i> Confirm Contact Cleanup
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p class="fw-bold">The following <span id="cleanupContactCount">0</span> contact(s) will be permanently deleted:</p>
<div id="cleanupContactList" class="list-group mb-3" style="max-height: 300px; overflow-y: auto;">
<!-- Contact list will be populated here -->
</div>
<div class="alert alert-warning mb-0">
<i class="bi bi-exclamation-circle"></i>
<strong>Warning:</strong> This action cannot be undone!
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-danger" id="confirmCleanupBtn">
<i class="bi bi-trash"></i> Delete Contacts
</button>
</div>
</div>
</div>
</div>
{% endblock %}