Skip to content

Commit

Permalink
download button
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-cnivera committed Aug 1, 2024
1 parent 584654a commit 1f57464
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions admin_apps/journeys/iteration.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,12 @@ def yaml_editor(yaml_str: str) -> None:
status_container = st.empty()

with button_container:
left, right, _ = st.columns((1, 1, 2))
if left.button("Save", use_container_width=True, help=SAVE_HELP):
(
left,
middle,
right,
) = st.columns(3)
if left.button("Validate", use_container_width=True, help=VALIDATE_HELP):
# Validate new content
try:
validate(
Expand All @@ -473,6 +477,16 @@ def yaml_editor(yaml_str: str) -> None:
)
exception_as_dialog(e)

if content:
middle.download_button(
label="Download",
data=content,
file_name="semantic_model.yaml",
mime="text/yaml",
use_container_width=True,
help=DOWNLOAD_HELP,
)

if right.button(
"Upload",
use_container_width=True,
Expand Down Expand Up @@ -610,9 +624,13 @@ def set_up_requirements() -> None:
st.rerun()


SAVE_HELP = """Save changes to the active semantic model in this app. This is
VALIDATE_HELP = """Save and validate changes to the active semantic model in this app. This is
useful so you can then play with it in the chat panel on the right side."""

DOWNLOAD_HELP = (
"""Download the currently loaded semantic model to your local machine."""
)

UPLOAD_HELP = """Upload the YAML to the Snowflake stage. You want to do that whenever
you think your semantic model is doing great and should be pushed to prod! Note that
the semantic model must be validated to be uploaded."""
Expand Down

0 comments on commit 1f57464

Please sign in to comment.