From 39aeb7ec9753533a9b3a4db076c7ffd625823abb Mon Sep 17 00:00:00 2001 From: Chuck McCallum Date: Thu, 14 Nov 2024 10:51:26 -0500 Subject: [PATCH] add a feedback tab --- dp_creator_ii/app/__init__.py | 13 +++++++++++- dp_creator_ii/app/feedback_panel.py | 32 +++++++++++++++++++++++++++++ tests/test_app.py | 7 +++++++ 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 dp_creator_ii/app/feedback_panel.py diff --git a/dp_creator_ii/app/__init__.py b/dp_creator_ii/app/__init__.py index 8031cf4..55aae80 100644 --- a/dp_creator_ii/app/__init__.py +++ b/dp_creator_ii/app/__init__.py @@ -4,7 +4,12 @@ from shiny import App, ui, reactive from dp_creator_ii.utils.argparse_helpers import get_cli_info -from dp_creator_ii.app import analysis_panel, dataset_panel, results_panel +from dp_creator_ii.app import ( + analysis_panel, + dataset_panel, + results_panel, + feedback_panel, +) logging.basicConfig(level=logging.INFO) @@ -15,6 +20,7 @@ dataset_panel.dataset_ui(), analysis_panel.analysis_ui(), results_panel.results_ui(), + feedback_panel.feedback_ui(), id="top_level_nav", ), title="DP Creator II", @@ -69,6 +75,11 @@ def server(input, output, session): # pragma: no cover weights=weights, epsilon=epsilon, ) + feedback_panel.feedback_server( + input, + output, + session, + ) session.on_ended(ctrl_c_reminder) return server diff --git a/dp_creator_ii/app/feedback_panel.py b/dp_creator_ii/app/feedback_panel.py new file mode 100644 index 0000000..4084d44 --- /dev/null +++ b/dp_creator_ii/app/feedback_panel.py @@ -0,0 +1,32 @@ +from shiny import ui +from htmltools import HTML + + +def feedback_ui(): + return ui.nav_panel( + "Feedback", + ui.div( + HTML( + """ + + """ + ) + ), + value="feedback_panel", + ) + + +def feedback_server( + input, + output, + session, +): # pragma: no cover + pass diff --git a/tests/test_app.py b/tests/test_app.py index ae20b98..f3aba17 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -120,3 +120,10 @@ def expect_no_error(): download = download_info.value script = download.path().read_text() assert "privacy_unit = dp.unit_of(contributions=42)" in script + + # -- Feedback -- + page.get_by_text("Feedback").click() + iframe = page.locator("#feedback-iframe") + expect(iframe).to_be_visible() + expect(iframe.content_frame.get_by_text("DP Wizard Feedback")).to_be_visible() + # Text comes from iframe, so this does introduce a dependency on an outside service.