Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

Improve scenario template #40

Merged
merged 2 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def build_dn_partial(dn, dn_label):
# #
# Example: #
if dn_label == "initial_dataset":
partial_content += "Select your CSV file: <|{selected_data_node.path}|file_selector|extensions=.csv|>\n\n"
partial_content += "Select your CSV file: <|{selected_data_node.path}|file_selector|extensions=.csv|on_action={lambda s: s.refresh('selected_scenario')}|>\n\n"
# Comment, remove or replace the previous lines with your own use case #
# ##################################################################################################################

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<|part|render={selected_scenario}|

<|{selected_scenario}|scenario|not expandable|expanded|>
<|{selected_scenario}|scenario|not expandable|expanded|on_submission_change=notify_on_submission|>

<|{selected_scenario}|scenario_dag|>
|>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
from taipy.gui import Markdown
from taipy.gui import Markdown, notify

from .data_node_management import manage_partial


def notify_on_submission(state, submitable, details):
if details['submission_status'] == 'COMPLETED':
state.refresh('selected_scenario')
notify(state, "success", "Submision completed!")
FlorianJacta marked this conversation as resolved.
Show resolved Hide resolved
elif details['submission_status'] == 'FAILED':
notify(state, "error", "Submission failed!")
else:
notify(state, "info", "In progress...")

def manage_data_node_partial(state):
manage_partial(state)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ def on_init(state):


def on_change(state, var, val):
if var == "selected_scenario" and val:
state.selected_scenario = val # BUG
state.selected_data_node = None
if var == "selected_data_node" and val:
state.selected_data_node = val # BUG
state["scenario"].manage_data_node_partial(state)


Expand Down
Loading