Keep bulk-deleted cards in grid until next scan
Extend the keep-until-next-scan behaviour to the bulk delete modal: instead of removing matched cards on success, mark them _deleted and keep them greyed with a "🗑 Deleted" badge and hidden buttons. /api/delete_bulk now returns deleted_ids so the grid marks exactly the items the server actually deleted — partial failures stay active and re-deletable. Already-handled (_deleted / _redacted) items are excluded from the bulk-delete match set so they aren't re-counted or re-processed. 201 tests pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
ed3c3a80d6
commit
386831c423
@ -23,7 +23,7 @@ Version numbers follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html
|
||||
|
||||
### Changed
|
||||
|
||||
- **Redacted and deleted cards stay in the grid until the next scan** — previously redacting (✏) or deleting (🗑) a card removed it from the grid and from `S.flaggedData`/`S.filteredData` immediately. Now the item is kept and marked: the card is greyed (`card-resolved` styling), shows a `✏ Redacted` (green) or `🗑 Deleted` (red) badge, and its action buttons are hidden so it can't be re-processed. The operator can see what was handled during the session; the grid is rebuilt on the next scan run, which clears the markers. Implemented with `_redacted` / `_deleted` flags in `results.js` (`appendCard` + `redactItem` / `deleteItem`); no server change.
|
||||
- **Redacted and deleted cards stay in the grid until the next scan** — previously redacting (✏) or deleting (🗑) a card — or running a bulk delete — removed the affected cards from the grid and from `S.flaggedData`/`S.filteredData` immediately. Now each item is kept and marked: the card is greyed (`card-resolved` styling), shows a `✏ Redacted` (green) or `🗑 Deleted` (red) badge, and its action buttons are hidden so it can't be re-processed. The operator can see what was handled during the session; the grid is rebuilt on the next scan run, which clears the markers. Implemented with `_redacted` / `_deleted` flags in `results.js` (`appendCard`, `redactItem`, `deleteItem`, `executeBulkDelete`); handled items are also excluded from the bulk-delete match set. `POST /api/delete_bulk` now returns `deleted_ids` so the grid marks exactly the items the server actually deleted (partial failures stay active).
|
||||
|
||||
### Fixed
|
||||
|
||||
|
||||
@ -1760,6 +1760,7 @@ def delete_bulk():
|
||||
return jsonify({
|
||||
"ok": True,
|
||||
"deleted": len(deleted_ids),
|
||||
"deleted_ids": deleted_ids, # so the grid can mark exactly these
|
||||
"failed": len(failed_items),
|
||||
"errors": failed_items[:10], # cap error list
|
||||
})
|
||||
|
||||
@ -680,6 +680,7 @@ function _bdFilters() {
|
||||
function _bdMatches() {
|
||||
const f = _bdFilters();
|
||||
return S.flaggedData.filter(x => {
|
||||
if (x._deleted || x._redacted) return false; // already handled this session
|
||||
if (f.source_type && x.source_type !== f.source_type) return false;
|
||||
if (x.cpr_count < f.min_cpr) return false;
|
||||
if (f.older_than_date && x.modified > f.older_than_date) return false;
|
||||
@ -885,9 +886,12 @@ async function executeBulkDelete() {
|
||||
});
|
||||
const d = await r.json();
|
||||
if (d.ok) {
|
||||
const deletedSet = new Set(matches.map(x => x.id));
|
||||
S.flaggedData = S.flaggedData.filter(x => !deletedSet.has(x.id));
|
||||
S.filteredData = S.filteredData.filter(x => !deletedSet.has(x.id));
|
||||
// Keep the deleted items in the grid (marked, greyed, buttons hidden)
|
||||
// until the next scan run — only those the server actually deleted.
|
||||
const deletedSet = new Set(d.deleted_ids || matches.map(x => x.id));
|
||||
const _mark = (x) => { if (deletedSet.has(x.id)) x._deleted = true; };
|
||||
S.flaggedData.forEach(_mark);
|
||||
S.filteredData.forEach(_mark);
|
||||
renderGrid(S.filteredData.length ? S.filteredData : S.flaggedData);
|
||||
updateStats();
|
||||
prog.innerHTML = `<span style="color:var(--ok,#4c4)">✓ ${d.deleted} ${t('m365_bulk_deleted', 'deleted')}</span>` +
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user