Allow adding headings to the system list that are just strings
This commit is contained in:
parent
a235041277
commit
49cfb6fe57
2 changed files with 28 additions and 22 deletions
|
@ -17,6 +17,7 @@ def init_ui(
|
||||||
def systems_list():
|
def systems_list():
|
||||||
with ui.column(align_items="center").style("width: 40vw; max-width: 40rem; min-width: 25rem;"):
|
with ui.column(align_items="center").style("width: 40vw; max-width: 40rem; min-width: 25rem;"):
|
||||||
for t in systems:
|
for t in systems:
|
||||||
|
if isinstance(t, System):
|
||||||
card = ui.card().classes("w-full")
|
card = ui.card().classes("w-full")
|
||||||
if t.state == SystemState.OK:
|
if t.state == SystemState.OK:
|
||||||
card = card.style("border-left: 4px solid limegreen")
|
card = card.style("border-left: 4px solid limegreen")
|
||||||
|
@ -38,12 +39,15 @@ def init_ui(
|
||||||
with ui.card_actions():
|
with ui.card_actions():
|
||||||
for n, c in actions.items():
|
for n, c in actions.items():
|
||||||
ui.button(text=n, on_click=c)
|
ui.button(text=n, on_click=c)
|
||||||
|
elif isinstance(t, str):
|
||||||
|
ui.label(t).classes("text-2xl textmedium")
|
||||||
|
|
||||||
with ui.column(align_items="center").classes("w-full"):
|
with ui.column(align_items="center").classes("w-full"):
|
||||||
systems_list()
|
systems_list()
|
||||||
|
|
||||||
def update_states():
|
def update_states():
|
||||||
for t in systems:
|
for t in systems:
|
||||||
|
if isinstance(t, System):
|
||||||
t.update_state()
|
t.update_state()
|
||||||
|
|
||||||
ui.timer(system_state_update_interval, callback=update_states)
|
ui.timer(system_state_update_interval, callback=update_states)
|
||||||
|
|
|
@ -47,7 +47,9 @@ class ExampleSystem(System):
|
||||||
#
|
#
|
||||||
|
|
||||||
systems = [
|
systems = [
|
||||||
|
"Example Heading 1",
|
||||||
ExampleSystem("Example System 1", "Description text ..."),
|
ExampleSystem("Example System 1", "Description text ..."),
|
||||||
|
"Example Heading 2",
|
||||||
ExampleSystem("Example System 2", "Another description text ...")
|
ExampleSystem("Example System 2", "Another description text ...")
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue