Skip to content

Commit

Permalink
feat: prevent workflows tree to be sent during run mode
Browse files Browse the repository at this point in the history
* feat: send workflow in edit mode
  • Loading branch information
FabienArcellier committed Oct 8, 2024
1 parent afbaf73 commit 3d76257
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/writer/app_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@
from watchdog.observers.polling import PollingObserver

from writer import VERSION, audit_and_fix, core_ui, wf_project
from writer.core import Config, EventHandlerRegistry, MiddlewareRegistry, WriterSession, use_request_context
from writer.core import (
Config,
EventHandlerRegistry,
MiddlewareRegistry,
WriterSession,
use_request_context,
)
from writer.core_ui import ingest_bmc_component_tree
from writer.ss_types import (
AppProcessServerRequest,
Expand Down
12 changes: 11 additions & 1 deletion src/writer/core_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,17 @@ def export_component_tree(component_tree: ComponentTree, mode: ServeMode, only_u
if only_update is True and component_tree.updated is False:
return None

return component_tree.to_dict()
roots = ['root']
if mode == "edit":
roots.append('workflows_root')

_components: List[Component] = []
for root in roots:
_root_component = cast(Component, component_tree.get_component(root))
_components.append(_root_component)
_components += component_tree.get_descendents(root)

return {c.id: c.to_dict() for c in _components}

class UIError(Exception):
...
Expand Down

0 comments on commit 3d76257

Please sign in to comment.