Skip to content

Commit 9bf73f1

Browse files
committed
feat(web):
- apply step spec schema to editor - add help pages to step spec editor
1 parent f2ead99 commit 9bf73f1

File tree

2 files changed

+46
-25
lines changed

2 files changed

+46
-25
lines changed

packages/cm-web/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
**/.nicegui/
22
**/cm-canvas-bundle.*
3+
**/static/docs/

packages/cm-web/src/lsst/cmservice/web/pages/campaign_edit.py

Lines changed: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from nicegui.events import ClickEventArguments, GenericEventArguments, ValueChangeEventArguments
1414

1515
from lsst.cmservice.common.yaml import str_representer
16+
from lsst.cmservice.models.manifests.steps import StepSpec
1617

1718
from .. import api
1819
from ..components.button import ToggleButton
@@ -156,31 +157,50 @@ def drawer_contents(self) -> None:
156157

157158
def create_step_editor(self) -> None:
158159
"""Creates a Dialog for editing a step or node in the graph canvas."""
159-
with ui.dialog().classes("h-dvh w-full") as self.edit_dialog, ui.card().classes("w-full"):
160-
ui.label("Editing Step Configuration").classes("text-subtitle1")
161-
162-
with ui.row().classes("w-full items-baseline"):
163-
with ui.dropdown_button("Grouping", auto_close=True) as self.group_option:
164-
self.group_option.tooltip("Apply a grouping template spec to the Step")
165-
ui.item("No Grouping", on_click=self.set_group_config).props("id=grouping_none")
166-
ui.item("Fixed-Value Grouping", on_click=self.set_group_config).props("id=grouping_fixed")
167-
ui.item("Query Grouping", on_click=self.set_group_config).props("id=grouping_query")
168-
169-
ui.input_chips(
170-
"Manifest Selectors",
171-
# TODO
172-
# . on_change=self.register_step_label_selectors,
173-
# . validation=self.validate_manifest_label,
174-
).tooltip("A collection of kind:name manifest selectors for the Step.")
175-
176-
# Create an empty editor for reference and reuse
177-
self.editor = ui.json_editor(
178-
{
179-
"content": {"json": {}},
180-
"mode": "text",
181-
"modes": ["text", "tree"],
182-
}
183-
).classes("h-full w-full")
160+
with (
161+
ui.dialog().props("maximized") as self.edit_dialog,
162+
ui.card().style("width: 96vw; height: 85vh;"),
163+
):
164+
with ui.tabs().classes("w-full") as tabs:
165+
editor_tab = ui.tab("Step Configuration", icon="edit")
166+
docs_tab = ui.tab("Help", icon="help")
167+
168+
with ui.tab_panels(tabs, value=editor_tab).classes("w-full"):
169+
with ui.tab_panel(editor_tab):
170+
with ui.row().classes("w-full items-baseline"):
171+
with ui.dropdown_button("Grouping", auto_close=True) as self.group_option:
172+
self.group_option.tooltip("Apply a grouping template spec to the Step")
173+
ui.item("No Grouping", on_click=self.set_group_config).props("id=grouping_none")
174+
ui.item("Fixed-Value Grouping", on_click=self.set_group_config).props(
175+
"id=grouping_fixed"
176+
)
177+
ui.item("Query Grouping", on_click=self.set_group_config).props(
178+
"id=grouping_query"
179+
)
180+
181+
ui.input_chips(
182+
"Manifest Selectors",
183+
# TODO
184+
# . on_change=self.register_step_label_selectors,
185+
# . validation=self.validate_manifest_label,
186+
).tooltip("A collection of kind:name manifest selectors for the Step.")
187+
188+
# Create an empty editor for reference and reuse
189+
self.editor = ui.json_editor(
190+
{
191+
"content": {"json": {}},
192+
"mode": "text",
193+
"modes": ["text", "tree"],
194+
},
195+
schema=StepSpec.model_json_schema(),
196+
).classes("h-full w-full")
197+
198+
with ui.tab_panel(docs_tab):
199+
ui.html(
200+
"""<iframe src="/static/docs/step_spec.html" """
201+
"""style="width: 100%; height: 70vh; border: none;"></iframe>""",
202+
sanitize=False,
203+
).classes("w-full")
184204

185205
with ui.card_actions():
186206
ui.button("Done", color="positive", on_click=self.save_node_edit).props("flat")

0 commit comments

Comments
 (0)