Feature visual timer 15122#15151
Conversation
Review Summary by QodoAdd visual progress indicator for cleanup operations
WalkthroughsDescription• Add progress indicator for cleanup operations showing real-time progress • Implement cancellable background task for cleanup with entry count tracking • Display progress message format "%0 of %1 entries cleaned up." in status bar • Add localization entries for cleanup progress messages Diagramflowchart LR
A["User clicks<br/>Clean up"] --> B["BackgroundTask<br/>created"]
B --> C["cleanupWithProgress<br/>called"]
C --> D["Progress shown<br/>in status bar"]
D --> E["User can<br/>cancel"]
E --> F["Cleanup<br/>completes"]
File Changes1. jabgui/src/main/java/org/jabref/gui/cleanup/CleanupDialogViewModel.java
|
Code Review by Qodo
✅ 1.
|
| new BackgroundTask<Void>() { | ||
| @Override | ||
| public Void call() { | ||
| cleanupWithProgress(cleanupPreset, entriesToProcess, this); | ||
| return null; | ||
| } | ||
| } | ||
| .onSuccess(result -> { | ||
| if (showFeedback) { | ||
| showResults(); | ||
| } | ||
| }) |
There was a problem hiding this comment.
2. Onsuccess fires after cancellation 🐞 Bug ✓ Correctness
Because cleanupWithProgress() returns normally (no exception thrown) on cancellation, call() returns null and the task executor treats the task as successfully completed. The onSuccess handler fires, invoking showResults(), which notifies the user 'X entry(s) needed a clean up' and calls markBaseChanged() — even though the user explicitly cancelled the operation, giving misleading feedback about a partial, non-undoable cleanup.
Agent Prompt
## Issue description
`cleanupWithProgress()` returns normally on cancellation, causing the `onSuccess` callback to fire and `showResults()` to notify the user of a successful cleanup even though the operation was cancelled mid-way.
## Issue Context
The `call()` method in the anonymous `BackgroundTask` always returns `null`, regardless of whether `cleanupWithProgress()` exited due to cancellation or normal completion. The `onSuccess` lambda cannot distinguish the two cases.
## Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/cleanup/CleanupDialogViewModel.java[133-146]
- jabgui/src/main/java/org/jabref/gui/cleanup/CleanupDialogViewModel.java[212-252]
Change `cleanupWithProgress()` to return a `boolean` (`true` = completed, `false` = cancelled), then in `call()` return that boolean and check it in `onSuccess`:
```java
new BackgroundTask<Boolean>() {
@Override
public Boolean call() {
return cleanupWithProgress(cleanupPreset, entriesToProcess, this);
}
}
.onSuccess(completed -> {
if (showFeedback && completed) {
showResults();
}
})
```
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
…bref into feature-visual-timer-15122
✅ All tests passed ✅🏷️ Commit: 6c1c092 Learn more about TestLens at testlens.app. |
| Website=Website | ||
|
|
||
| Cleaning\ up\ entries=Cleaning up entries | ||
| %0\ of\ %1\ entries\ cleaned\ up.=%0 of %1 entries cleaned up. |
There was a problem hiding this comment.
Next time, please sort this in at related translation keys.
* upstream/main: (26 commits) Fix matrix Feature visual timer 15122 (JabRef#15151) Chore(deps): Bump com.googlecode.plist:dd-plist from 1.28 to 1.29 in /versions (JabRef#15166) Chore(deps): Bump jablib/src/main/resources/csl-styles from `a0eb8d7` to `e306b56` (JabRef#15162) Chore(deps): Bump io.zonky.test.postgres:embedded-postgres-binaries-bom (JabRef#15165) Chore(deps): Bump jablib/src/main/resources/csl-locales (JabRef#15163) Chore(deps): Bump jablib/src/main/abbrv.jabref.org (JabRef#15164) Change Dependabot schedule from weekly to daily macos-15-intel should run on main only (JabRef#15161) Chore(deps): Bump jablib/src/main/resources/csl-styles (JabRef#15152) Chore(deps): Bump org.jetbrains:annotations in /versions (JabRef#15154) Chore(deps): Bump jablib/src/main/abbrv.jabref.org (JabRef#15153) Chore(deps): Bump org.itsallcode.openfasttrace from 3.1.0 to 3.1.1 (JabRef#15141) Chore(deps): Bump org.junit:junit-bom from 6.0.2 to 6.0.3 in /versions (JabRef#15148) Chore(deps): Bump org.eclipse.lsp4j:org.eclipse.lsp4j from 0.24.0 to 1.0.0 in /versions (JabRef#15149) Chore(deps): Bump org.postgresql:postgresql in /versions (JabRef#15146) Chore(deps): Bump net.bytebuddy:byte-buddy in /versions (JabRef#15147) Refine code (JabRef#15132) Chore(deps): Bump com.dlsc.gemsfx:gemsfx in /versions (JabRef#15143) Update dependency de.undercouch:citeproc-java to v3.5.0 (JabRef#15145) ...
* update to include new progress indicator for cleanup. * refactor cleanup process to include progress tracking * add new localization entries for cleanup process * add break instead of return tp fix irreversible
Related issues and pull requests
Closes #15122
PR Description
cleanups now run as a visible background task, when the user clicks "Clean up", a progress
indicator appears in the status bar showing real time progress "3 of 50 entries
cleaned up.", so the user knows the process hasn't stalled. The cleanup can also be
cancelled mid-operation.
Steps to test
1- Select at least one entry (the more the better to see progress).


2- Go to "Quality" then "Clean up entries".
3- In the cleanup dialog, select any tab, ex: "Single field"
4- Add "Filed name" and "Formatter name" then click a "Clean up" button
Checklist
CHANGELOG.mdin a way that can be understood by the average user (if change is visible to the user)