yera.ui.rendering.views.sessions

Classify and render live, historical, and offline sessions.

Classification preserves the session store's ordering while separating active sessions, replayable history, and sessions whose app is no longer available. Renderers escape persisted titles, identifiers, statuses, and app names before returning trusted screen, sidebar, or mobile-detail fragments.

Symbols

def classify_sessions — Classify ordered session records without changing their order.
def render_live_sessions — Render active sessions for the canonical Live screen.
def render_mobile_session_detail — Render persisted session metadata as a pushed mobile screen.
def render_session_sidebar — Render persisted metadata and navigation for one selected session.
def render_sessions_home — Render persisted sessions as main-screen navigation.
class SessionGroups — Hold sessions grouped by lifecycle and app availability.
class SessionViewMode — Choose chronological or app-grouped history presentation.

classify_sessions

classify_sessions(
    records: list[SessionRecord],
    available_app_ids: Collection[str],
) → SessionGroups

Classify ordered session records without changing their order.

Parameters

records
type: list[SessionRecord]

Session records in their intended display order.

available_app_ids
type: Collection[str]

Apps currently available on this server.

Returns

type: SessionGroups

Session records grouped by availability and persisted lifecycle state.

render_live_sessions

render_live_sessions(
    apps: Mapping[str, AppReference],
    live_by_app: dict[str, list[SessionRecord]],
) → TrustedHTML

Render active sessions for the canonical Live screen.

Parameters

apps
type: Mapping[str, AppReference]

Available applications keyed by stable identifier.

live_by_app
type: dict[str, list[SessionRecord]]

Active session records grouped by application identifier.

Returns

type: TrustedHTML

Trusted HTML containing the live-session groups.

render_mobile_session_detail

render_mobile_session_detail(
    record: SessionRecord,
    app_name: str,
    app_available: bool,
) → TrustedHTML

Render persisted session metadata as a pushed mobile screen.

Parameters

record
type: SessionRecord

Persisted session being inspected.

app_name
type: str

Human-readable app name or its stored identifier.

app_available
type: bool

Whether the app is currently registered on this server.

Returns

type: TrustedHTML

Trusted HTML containing the mobile session detail.

Raises

ValueError

If a required detail template placeholder is missing.

render_session_sidebar

render_session_sidebar(
    record: SessionRecord,
    app_name: str,
    app_available: bool,
) → TrustedHTML

Render persisted metadata and navigation for one selected session.

Parameters

record
type: SessionRecord

Persisted session being inspected.

app_name
type: str

Human-readable app name or its stored identifier.

app_available
type: bool

Whether the app is currently registered on this server.

Returns

type: TrustedHTML

Contextual session-inspector HTML.

Raises

ValueError

If a required sidebar template placeholder is missing.

render_sessions_home

render_sessions_home(
    records: list[SessionRecord],
    apps: Mapping[str, AppReference],
    selected_session_id: str = '',
    mode: SessionViewMode = SessionViewMode.CHRONOLOGICAL,
) → TrustedHTML

Render persisted sessions as main-screen navigation.

Parameters

records
type: list[SessionRecord]

Sessions ordered for display.

apps
type: Mapping[str, AppReference]

Apps currently available on this server.

selected_session_id
type: str = ''

Session to mark as selected, if any.

mode
type: SessionViewMode = SessionViewMode.CHRONOLOGICAL

History ordering and grouping presentation.

Returns

type: TrustedHTML

Main-screen HTML for session exploration.

SessionGroups

Hold sessions grouped by lifecycle and app availability.

Fields

live_by_app
type: dict[str, list[yera.ui.sessions_store.base.SessionRecord]] (required)

Running and waiting sessions grouped by app ID.

historical_by_app
type: dict[str, list[yera.ui.sessions_store.base.SessionRecord]] (required)

Completed, failed, interrupted, and unstarted sessions whose app remains available.

offline_by_app
type: dict[str, list[yera.ui.sessions_store.base.SessionRecord]] (required)

Sessions whose recorded app is unavailable.

Methods


SessionGroups.__init__

__init__(
    live_by_app: dict[str, list[SessionRecord]],
    historical_by_app: dict[str, list[SessionRecord]],
    offline_by_app: dict[str, list[SessionRecord]],
) → None

SessionViewMode

Inherits: StrEnum

Choose chronological or app-grouped history presentation.