Skip to content

Commit

Permalink
add a feedback tab
Browse files Browse the repository at this point in the history
  • Loading branch information
mccalluc committed Nov 14, 2024
1 parent 40e0b9c commit 39aeb7e
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
13 changes: 12 additions & 1 deletion dp_creator_ii/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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",
Expand Down Expand Up @@ -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
Expand Down
32 changes: 32 additions & 0 deletions dp_creator_ii/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 39aeb7e

Please sign in to comment.