Skip to content

Commit

Permalink
move UI to three separate files
Browse files Browse the repository at this point in the history
  • Loading branch information
mccalluc committed Sep 26, 2024
1 parent 6874656 commit d1c2456
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 38 deletions.
42 changes: 4 additions & 38 deletions dp_creator_ii/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,14 @@
from dp_creator_ii.template import make_notebook_py, make_script_py
from dp_creator_ii.converters import convert_py_to_nb


def dataset_panel():
return ui.nav_panel(
"Select Dataset",
"TODO: Pick dataset",
ui.output_text("csv_path_text"),
ui.output_text("unit_of_privacy_text"),
ui.input_action_button("go_to_analysis", "Perform analysis"),
value="dataset_panel",
)


def analysis_panel():
return ui.nav_panel(
"Perform Analysis",
"TODO: Define analysis",
ui.input_action_button("go_to_results", "Download results"),
value="analysis_panel",
)


def results_panel():
return ui.nav_panel(
"Download Results",
"TODO: Download Results",
ui.download_button("download_script", "Download script"),
# TODO: Notebook code is badly formatted
# ui.download_button(
# "download_notebook_unexecuted", "Download notebook (unexecuted)"
# ),
# ui.download_button(
# "download_notebook_executed", "Download notebook (executed)"
# )
value="results_panel",
)
from dp_creator_ii.app import analysis_panel, dataset_panel, results_panel


app_ui = ui.page_bootstrap(
ui.navset_tab(
dataset_panel(),
analysis_panel(),
results_panel(),
dataset_panel.dataset_ui(),
analysis_panel.analysis_ui(),
results_panel.results_ui(),
id="top_level_nav",
),
title="DP Creator II",
Expand Down
10 changes: 10 additions & 0 deletions dp_creator_ii/app/analysis_panel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from shiny import App, ui, reactive, render


def analysis_ui():
return ui.nav_panel(
"Perform Analysis",
"TODO: Define analysis",
ui.input_action_button("go_to_results", "Download results"),
value="analysis_panel",
)
12 changes: 12 additions & 0 deletions dp_creator_ii/app/dataset_panel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from shiny import App, ui, module, reactive, render


def dataset_ui():
return ui.nav_panel(
"Select Dataset",
"TODO: Pick dataset",
ui.output_text("csv_path_text"),
ui.output_text("unit_of_privacy_text"),
ui.input_action_button("go_to_analysis", "Perform analysis"),
value="dataset_panel",
)
17 changes: 17 additions & 0 deletions dp_creator_ii/app/results_panel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from shiny import App, ui, reactive, render


def results_ui():
return ui.nav_panel(
"Download Results",
"TODO: Download Results",
ui.download_button("download_script", "Download script"),
# TODO: Notebook code is badly formatted
# ui.download_button(
# "download_notebook_unexecuted", "Download notebook (unexecuted)"
# ),
# ui.download_button(
# "download_notebook_executed", "Download notebook (executed)"
# )
value="results_panel",
)

0 comments on commit d1c2456

Please sign in to comment.