Skip to content

Feature/long running dialog actions - #134

Merged
markusressel merged 13 commits into
mainfrom
feature/long-running-dialog-actions
Jun 26, 2026
Merged

Feature/long running dialog actions#134
markusressel merged 13 commits into
mainfrom
feature/long-running-dialog-actions

Conversation

@markusressel

@markusressel markusressel commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Refactor UI for Asynchronous Operations and Improved UX

This PR introduces a major refactoring of the UI to handle background tasks asynchronously, preventing the UI from blocking during long-running operations like creating or deleting snapshots. It also improves the user experience by adding loading spinners, standardized success/error dialogs, and fixing a bug in the external diff viewer.

Key Changes

  • Asynchronous Dialogs: The SelectionDialog now manages background tasks with a handler function and updates the UI with an onComplete callback. This prevents the UI from freezing during operations.
  • Loading Spinners: A loading spinner animation is now displayed within dialogs to provide clear visual feedback while an action is in progress.
  • Simplified Dialogs: The SelectionDialog API is simplified by removing the SetHandler method and moving callbacks to the constructor, making the dialog's behavior more predictable.
  • Bug Fix: The external diff viewer is no longer stuck and now correctly suspends the TUI application.
  • Standardized Feedback: Added NewSuccessDialog and NewErrorDialog for consistent user feedback across the application.

This commit refactors the dialog system to handle actions asynchronously, preventing the UI from blocking during long-running operations.

Key Changes:
- The `SelectionDialog` now manages background tasks with a `handler` function and updates the UI with an `onComplete` callback.
- A loading spinner animation is now displayed within dialogs to provide clear visual feedback while an action is in progress.
- Added standardized `NewSuccessDialog` and `NewErrorDialog` for consistent user feedback across the application.
- Updated the `FileBrowser` and `SnapshotBrowser` to use the new asynchronous dialogs for all actions (e.g., create, delete, restore, diff), significantly improving UI responsiveness.
Removes the `SetHandler` method from `SelectionDialog` and moves the `handler` and `onComplete` callbacks to the constructor. This makes the dialog's behavior more predictable by setting its actions at creation time.

This change simplifies the calling code by removing the need for a separate `SetHandler` call and encourages a more functional style of creating dialogs.

The handler and onComplete callbacks now also receive the dialog instance, allowing them to interact with it directly (e.g., to close it).
@markusressel markusressel added the enhancement New feature or request label Jun 25, 2026
@markusressel markusressel added the bug Something isn't working label Jun 26, 2026
@markusressel
markusressel marked this pull request as ready for review June 26, 2026 21:06
@markusressel
markusressel merged commit d191842 into main Jun 26, 2026
8 checks passed
@markusressel
markusressel deleted the feature/long-running-dialog-actions branch June 26, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant