Add settings and live sidebar counts

This commit is contained in:
Abel Luck 2026-03-30 18:26:02 +02:00
parent 2a99edeec3
commit a809bde16c
16 changed files with 696 additions and 51 deletions

View file

@ -128,13 +128,18 @@ def sources_table(
def sources_page(
*, sources: tuple[Mapping[str, object], ...] | None = None
*,
sources: tuple[Mapping[str, object], ...] | None = None,
running_count: int = 0,
) -> Renderable:
source_items = sources or ()
return page_shell(
current_path="/sources",
eyebrow="Source management",
title="Sources",
content=sources_table(sources=sources),
source_count=len(source_items),
running_count=running_count,
content=sources_table(sources=source_items),
)
@ -398,6 +403,18 @@ def source_form(
signal_name="jobEnabled",
checked=_checked(source, "enabled", True),
),
toggle_field(
label="Convert images",
description="Normalize mirrored images through the image conversion pipeline for this source.",
signal_name="convertImages",
checked=_checked(source, "convert_images", True),
),
toggle_field(
label="Convert video",
description="Run mirrored videos through the video conversion pipeline for this source.",
signal_name="convertVideo",
checked=_checked(source, "convert_video", True),
),
],
],
],
@ -415,7 +432,12 @@ def source_form(
)
def create_source_page(*, action_path: str = "/actions/sources/create") -> Renderable:
def create_source_page(
*,
action_path: str = "/actions/sources/create",
source_count: int = 0,
running_count: int = 0,
) -> Renderable:
actions = (
muted_action_link(href="/sources", label="Back to sources"),
header_action_link(href="/runs", label="View runs"),
@ -425,6 +447,8 @@ def create_source_page(*, action_path: str = "/actions/sources/create") -> Rende
eyebrow="Source creation",
title="Create source",
actions=actions,
source_count=source_count,
running_count=running_count,
content=source_form(mode="create", action_path=action_path),
)
@ -434,6 +458,8 @@ def edit_source_page(
slug: str,
source: Mapping[str, object],
action_path: str,
source_count: int = 0,
running_count: int = 0,
) -> Renderable:
actions = (
muted_action_link(href="/sources", label="Back to sources"),
@ -444,5 +470,7 @@ def edit_source_page(
eyebrow="Source editing",
title="Edit source",
actions=actions,
source_count=source_count,
running_count=running_count,
content=source_form(mode="edit", action_path=action_path, source=source),
)