Skip to content

tables

process_manager.tables

Defines the ProcessTable for displaying process data in a structured table format.

Classes

ProcessTable

Bases: Table

Defines a Process Table for the data from the Process Manager.

Classes
Meta

Table meta options for rendering behavior and styling.

Functions
render_select(value)

Customize behavior of checkboxes in the select column.

Source code in process_manager/tables.py
def render_select(self, value: str) -> str:
    """Customize behavior of checkboxes in the select column."""
    return mark_safe(
        f'<input type="checkbox" name="select" value="{value}" '
        f'id="{value}-input" hx-preserve="true" '
        'class="form-check-input form-check-input-lg row-checkbox" '
        'style="transform: scale(1.5);" '
        f'_="{row_checkbox_hyperscript}">'
    )
render_status_code(value)

Render the status_code with Bootstrap badge classes.

Source code in process_manager/tables.py
def render_status_code(self, value: str) -> str:
    """Render the status_code with Bootstrap badge classes."""
    base_class = "badge text-white fs-5 opacity-75 px-3 py-2"

    if value == "DEAD":
        return mark_safe(f'<span class="{base_class} bg-danger">DEAD</span>')
    elif value == "RUNNING":
        return mark_safe(f'<span class="{base_class} bg-success">RUNNING</span>')

    return mark_safe(f'<span class="{base_class} bg-secondary">{value}</span>')