Repository navigation
Add cancelable confirmations and message types to WebUI - #857
Merged
Merged
Conversation
Add MessageType and the non-abstract UiFactory methods show_message and ask_for_confirmation. They are not abstract because other front-ends implement UiFactory; their defaults fall back to info_box and keep the previous behaviour. The customtkinter factory asks for confirmation with the existing CtkInfoBox(show_cancel=True). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- ask_for_confirmation opens a modal ConfirmationDialog with OK/Cancel based on BaseDialog and returns whether the user confirmed. - show_message maps the message type to the notification type: errors stay negative, warnings and infos are no longer shown as errors. - minimal_info_box shows a persistent notification with a spinner; update_message changes its text and close dismisses it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Loading an otconfig, loading an otflow over existing sections or flows, and starting a new project now await ask_for_confirmation and stop if the user cancels. _load_otflow and start_new_project become async for that; load_configuration already awaits them and the customtkinter GUI calls it via asyncio.run. Messages are shown via show_message with an explicit type at each call site: failures as errors, missing selections or preconditions as warnings and a successful cut as info. show_cancel is no longer used by info_box and is removed from its signature. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Opening an otconfig in the WebUI now asks for confirmation before the current project is replaced, so the helper that opens a project clicks OK. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
schubsen
requested changes
Oct 15, 2026
…-dialogs # Conflicts: # tests/unit/OTAnalytics/plugin_ui/test_flow_form.py
briemla
enabled auto-merge
October 16, 2026 10:51
schubsen
approved these changes
Oct 16, 2026
randy-seng
added a commit
that referenced
this pull request
Oct 16, 2026
…mplement-create-new-project-use-case #857 added UiFactory.ask_for_confirmation and a NiceGUI ConfirmationDialog, as this branch did. Keep main's versions and drop this branch's duplicates, with two additions: - delete the NiceGUI dialog once answered, so answered dialogs do not pile up in the page - mark the confirmation message for Playwright; answer_confirmation replaces main's confirm_dialog helper and also answers with Cancel Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ELfr5L29V7e22eWrXiL3jh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OP#10514
Problem
In the WebUI, confirmations could not be canceled.
NiceGuiUiFactory.info_boxonly showed aui.notifyand returned an info box whosecanceledwas alwaysFalse. Loading an otconfig, loading an otflow over existing sections/flows and starting a new project therefore discarded the current sections, flows and videos without a way to cancel.In addition:
type="negative"), including plain hints,minimal_info_box("Create events...", "Apply offset...") showed nothing.UiFactory.info_boxis synchronous, but a NiceGUI dialog has to be awaited.Solution
UiFactorygets two new methods,async ask_for_confirmation(message, initial_position) -> boolandshow_message(message, initial_position, message_type), plus theMessageTypeenum (ERROR,WARNING,INFO). Both methods are deliberately not abstract: other front-ends (OTCloud) implementUiFactory, and the repo rule is that it must not gain abstract methods. Their defaults fall back toinfo_box, so such front-ends behave as before.ask_for_confirmationopens a modalConfirmationDialog(based onBaseDialog) with OK/Cancel.BaseDialoggets an overridableapply_label(), andGeneralKeys.LABEL_OKis new in theResourceManager.show_messagemaps the type to the notification type: error →negative, warning →warning, info →info.info_boxstill shows an error.minimal_info_boxshows a persistent notification with a spinner.update_messagechanges its text andclosedismisses it. Without a client (e.g. startup preload), it does nothing instead of raising.ask_for_confirmationuses the existingCtkInfoBox(show_cancel=True).show_messageuses the default, i.e. the sameCtkInfoBoxas before, so the customtkinter GUI does not change._load_otconfig,_load_otflowandstart_new_projectawaitask_for_confirmationand stop on cancel._load_otflowandstart_new_project(including theViewModelport) are now async.load_configurationalready awaited them, and the customtkinter GUI calls it viaasyncio.run.start_new_projectcurrently has no UI caller.show_cancelis no longer used byinfo_boxand was removed from its signature.CtkInfoBoxkeeps it.open_project_otconfigconfirms the new dialog.Tests
tests/unit/OTAnalytics/adapter_ui/test_dummy_viewmodel_confirmation.py, run against a mockedUiFactory:tests/unit/OTAnalytics/plugin_ui/nicegui_gui/test_ui_factory.py:User).minimal_info_boxis visible, updates its text, can be closed and works without a client.tests/unit/OTAnalytics/adapter_ui/test_ui_factory_defaults.pycovers the backward-compatible defaults of the newUiFactorymethods.info_box→show_message/ask_for_confirmationchange.Results:
pytest tests/unit: 1671 passed, 6 skipped.pre-commit run --all-files: flake8, black, isort and mypy pass. Three hooks fail locally for reasons unrelated to this PR, and they fail the same way onmain:.venvin the checkout.test_project_information.pyandtest_filters_navigation_buttons.pypass. They open a project through the new confirmation dialog.test_sections_and_flows.py::test_create_sections_two_timesandtest_export_track_statistics.pytime out locally after the project is opened. They fail the same way onmain.🤖 Generated with Claude Code