Improving error management
This commit is contained in:
@@ -198,12 +198,18 @@ class WorkflowDesigner(BaseComponent):
|
||||
self._error_message = self._player.global_error
|
||||
|
||||
else:
|
||||
|
||||
|
||||
# change the tab and display the results
|
||||
self._player.set_boundaries(boundaries)
|
||||
self.tabs_manager.add_tab(f"Workflow {self._designer_settings.workflow_name}", self._player, self._player.key)
|
||||
|
||||
return self.tabs_manager.refresh()
|
||||
|
||||
def stop_workflow(self, boundaries):
|
||||
self._error_message = None
|
||||
self._player.run()
|
||||
return self.tabs_manager.refresh()
|
||||
|
||||
def on_processor_details_event(self, component_id: str, event_name: str, details: dict):
|
||||
if component_id in self._state.components:
|
||||
component = self._state.components[component_id]
|
||||
@@ -271,6 +277,12 @@ class WorkflowDesigner(BaseComponent):
|
||||
state_class = 'not-run' # To be styled as greyed-out
|
||||
else:
|
||||
state_class = ''
|
||||
if runtime_state.state == ComponentState.FAILURE:
|
||||
tooltip_content = runtime_state.error_message
|
||||
tooltip_class = "mmt-tooltip"
|
||||
else:
|
||||
tooltip_content = None
|
||||
tooltip_class = ""
|
||||
|
||||
return Div(
|
||||
# Input connection point
|
||||
@@ -290,9 +302,10 @@ class WorkflowDesigner(BaseComponent):
|
||||
data_component_id=component.id,
|
||||
data_point_type="output"),
|
||||
|
||||
cls=f"wkf-workflow-component w-32 {'selected' if is_selected else ''}",
|
||||
cls=f"wkf-workflow-component w-32 {'selected' if is_selected else ''} {tooltip_class}",
|
||||
style=f"left: {component.x}px; top: {component.y}px;",
|
||||
data_component_id=component.id,
|
||||
data_tooltip=tooltip_content,
|
||||
draggable="true"
|
||||
)
|
||||
|
||||
@@ -303,7 +316,7 @@ class WorkflowDesigner(BaseComponent):
|
||||
|
||||
# Render components
|
||||
*[self._mk_component(comp, state) for comp, state in zip(self._state.components.values(),
|
||||
self._player.runtime_states)],
|
||||
self._player.runtime_states.values())],
|
||||
)
|
||||
|
||||
def _mk_canvas(self, oob=False):
|
||||
@@ -337,8 +350,8 @@ class WorkflowDesigner(BaseComponent):
|
||||
def _mk_media(self):
|
||||
return Div(
|
||||
mk_icon(icon_play, cls="mr-1", **self.commands.play_workflow()),
|
||||
mk_icon(icon_pause, cls="mr-1", **self.commands.play_workflow()),
|
||||
mk_icon(icon_stop, cls="mr-1", **self.commands.play_workflow()),
|
||||
mk_icon(icon_pause, cls="mr-1", **self.commands.pause_workflow()),
|
||||
mk_icon(icon_stop, cls="mr-1", **self.commands.stop_workflow()),
|
||||
cls=f"media-controls flex m-2"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user