Skip to content

Commit

Permalink
add a feedback tab (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
mccalluc authored Nov 18, 2024
1 parent 3b89001 commit 57b8ff8
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dp_wizard/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from shiny import App, ui, reactive

from dp_wizard.utils.argparse_helpers import get_cli_info
from dp_wizard.app import analysis_panel, dataset_panel, results_panel
from dp_wizard.app import analysis_panel, dataset_panel, results_panel, feedback_panel


logging.basicConfig(level=logging.INFO)
Expand All @@ -15,6 +15,7 @@
dataset_panel.dataset_ui(),
analysis_panel.analysis_ui(),
results_panel.results_ui(),
feedback_panel.feedback_ui(),
id="top_level_nav",
),
title="DP Wizard",
Expand Down Expand Up @@ -69,6 +70,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
Expand Down
32 changes: 32 additions & 0 deletions dp_wizard/app/feedback_panel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from shiny import ui
from htmltools import HTML


def feedback_ui():
return ui.nav_panel(
"Feedback",
ui.div(
HTML(
"""
<iframe
src="https://docs.google.com/forms/d/e/1FAIpQLScaGdKS-vj-RrM7SCV_lAwZmxQ2bOqFrAkyDp4djxTqkTkinA/viewform?embedded=true"
id="feedback-iframe"
width="640"
height="1003"
frameborder="0"
marginheight="0"
marginwidth="0"
>Loading…</iframe>
"""
)
),
value="feedback_panel",
)


def feedback_server(
input,
output,
session,
): # pragma: no cover
pass
7 changes: 7 additions & 0 deletions tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 57b8ff8

Please sign in to comment.