generated from john/python-template
@@ -19,8 +19,8 @@ class PersonTableRow:
|
||||
"""Read model consumed by the people table component."""
|
||||
|
||||
id: UUID
|
||||
last_name: str
|
||||
given_names: str
|
||||
name: str
|
||||
tags: str
|
||||
family_search_id: str
|
||||
birth_date: str
|
||||
death_date: str
|
||||
@@ -31,8 +31,8 @@ def _serialize_rows(rows: Sequence[PersonTableRow]) -> list[dict[str, Any]]:
|
||||
return [
|
||||
{
|
||||
"id": str(row.id),
|
||||
"last_name": row.last_name,
|
||||
"given_names": row.given_names,
|
||||
"name": row.name,
|
||||
"tags": row.tags or "Not set",
|
||||
"family_search_id": row.family_search_id or "Not set",
|
||||
"birth_date": row.birth_date or "Unknown",
|
||||
"death_date": row.death_date or "Unknown",
|
||||
@@ -53,18 +53,18 @@ def render_people_table(rows: Sequence[PersonTableRow]) -> None:
|
||||
rows=_serialize_rows(rows),
|
||||
columns=[
|
||||
{
|
||||
"name": "last_name",
|
||||
"label": "Last Name",
|
||||
"field": "last_name",
|
||||
"name": "name",
|
||||
"label": "Last Name, First & Middle",
|
||||
"field": "name",
|
||||
"sortable": True,
|
||||
"classes": "font-serif font-semibold text-left ui-table-cell-wrap",
|
||||
},
|
||||
{
|
||||
"name": "given_names",
|
||||
"label": "First & Middle",
|
||||
"field": "given_names",
|
||||
"name": "tags",
|
||||
"label": "Tags",
|
||||
"field": "tags",
|
||||
"sortable": True,
|
||||
"classes": "font-serif font-semibold text-left ui-table-cell-wrap",
|
||||
"classes": "text-left ui-table-cell-wrap",
|
||||
},
|
||||
{"name": "family_search_id", "label": "FamilySearch ID", "field": "family_search_id", "sortable": True},
|
||||
{
|
||||
@@ -92,14 +92,14 @@ def render_people_table(rows: Sequence[PersonTableRow]) -> None:
|
||||
"classes": "font-mono",
|
||||
},
|
||||
],
|
||||
default_sort_by="last_name",
|
||||
search_placeholder="Search people by last name, given names, FamilySearch ID, or dates...",
|
||||
default_sort_by="name",
|
||||
search_placeholder="Search people by name, tags, FamilySearch ID, or dates...",
|
||||
on_row_click_id=lambda person_id: ui.navigate.to(f"/people/{person_id}"),
|
||||
)
|
||||
|
||||
# Custom column template adding an archival entity icon next to person's name
|
||||
table.add_slot(
|
||||
"body-cell-last_name",
|
||||
"body-cell-name",
|
||||
r"""
|
||||
<q-td :props="props">
|
||||
<div class="row items-center q-gutter-x-xs">
|
||||
|
||||
@@ -35,7 +35,7 @@ def _serialize_rows(rows: Sequence[SourceTableRow]) -> list[dict[str, Any]]:
|
||||
"upload_name": row.upload_name,
|
||||
"document_id": str(row.document_id),
|
||||
"document_name": row.document_name or "-",
|
||||
"job_source_status": row.job_source_status or "-",
|
||||
"job_source_status": (row.job_source_status or "-").upper(),
|
||||
"job_source_error_detail": row.job_source_error_detail or "-",
|
||||
}
|
||||
for row in rows
|
||||
@@ -109,7 +109,7 @@ def render_sources_table(rows: Sequence[SourceTableRow]) -> None:
|
||||
dense
|
||||
square
|
||||
size="sm"
|
||||
:class="`ui-status ui-status--${props.value}`"
|
||||
:class="`ui-status ui-status--${props.value.toLowerCase()}`"
|
||||
>
|
||||
{{ props.value }}
|
||||
</q-chip>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
from datetime import date
|
||||
from typing import Any
|
||||
from uuid import UUID
|
||||
|
||||
@@ -448,7 +449,7 @@ def _render_document_form_fields(
|
||||
with ui.row().classes("w-full gap-3 grid grid-cols-1 md:grid-cols-2"):
|
||||
date_input = (
|
||||
ui.input(
|
||||
label="Exact date (YYYY-MM-DD)",
|
||||
label="Document date",
|
||||
value=document.document_date.isoformat() if document and document.document_date else "",
|
||||
)
|
||||
.props('outlined type="date"')
|
||||
@@ -542,7 +543,7 @@ def _render_bento_metadata_zone(document: Document) -> None:
|
||||
key=str.casefold,
|
||||
)
|
||||
metadata_row("Tags:", ", ".join(tags) if tags else "Not set")
|
||||
metadata_row("Document Date:", compact_date(document.document_date, document.document_date_raw))
|
||||
metadata_row("Document Date:", _detail_document_date(document.document_date, document.document_date_raw))
|
||||
metadata_row("Location Created:", document.location_created or "Not set")
|
||||
metadata_row("Archive Identifier:", document.archive_identifier or "Not set")
|
||||
|
||||
@@ -555,6 +556,12 @@ def _render_bento_metadata_zone(document: Document) -> None:
|
||||
ui.label(f"Updated: {document.updated_at.isoformat()}").classes("text-[11px] ui-text-muted")
|
||||
|
||||
|
||||
def _detail_document_date(exact: date | None, approximate: str | None) -> str:
|
||||
if exact is not None:
|
||||
return exact.strftime("%m-%d-%Y")
|
||||
return (approximate or "").strip() or "Unknown"
|
||||
|
||||
|
||||
def _render_bento_relations_zone(document: Document) -> None:
|
||||
with ui.column().classes("col-span-12 lg:col-span-4 gap-4"):
|
||||
_render_related_people_card(document)
|
||||
|
||||
@@ -313,7 +313,7 @@ def register_page() -> None: # noqa: PLR0915
|
||||
|
||||
with archival_card(extra_classes="gap-2"):
|
||||
ui.label(f"Job ID: {job.id}").classes("text-sm font-semibold font-mono ui-text-primary")
|
||||
metadata_row("Current Status:", job.status.value)
|
||||
metadata_row("Current Status:", job.status.value.upper())
|
||||
ui.label(
|
||||
"Cancel stops processing and marks remaining non-transcribed sources as cancelled. "
|
||||
"Cancelled sources can be resubmitted."
|
||||
@@ -369,7 +369,7 @@ def register_page() -> None: # noqa: PLR0915
|
||||
|
||||
with archival_card(extra_classes="gap-2"):
|
||||
ui.label(f"Job ID: {job.id}").classes("text-sm font-semibold font-mono ui-text-primary")
|
||||
metadata_row("Current Status:", job.status.value)
|
||||
metadata_row("Current Status:", job.status.value.upper())
|
||||
metadata_row("Resubmittable Sources:", str(resubmittable_count))
|
||||
ui.label(
|
||||
"Resubmit queues failed and cancelled linked sources. "
|
||||
|
||||
@@ -98,8 +98,13 @@ def register_page() -> None: # noqa: PLR0915
|
||||
rows = [
|
||||
PersonTableRow(
|
||||
id=person.id,
|
||||
last_name=person.last_name,
|
||||
given_names=person.given_names,
|
||||
name=f"{person.last_name}, {person.given_names}",
|
||||
tags=", ".join(
|
||||
sorted(
|
||||
[link.tag_ref.label for link in person.person_tags if link.tag_ref is not None],
|
||||
key=str.casefold,
|
||||
)
|
||||
),
|
||||
family_search_id=person.family_search_id or "",
|
||||
birth_date=compact_date(person.birth_date, person.birth_date_raw),
|
||||
death_date=compact_date(person.death_date, person.death_date_raw),
|
||||
|
||||
@@ -456,7 +456,7 @@ def _render_source_job_metadata_zone(
|
||||
status = latest_job_source.status.value
|
||||
with ui.row().classes("w-full justify-between items-center mb-2"):
|
||||
ui.label("Latest Status").classes("text-xs ui-text-muted")
|
||||
archival_badge(status)
|
||||
archival_badge(status.upper())
|
||||
|
||||
metadata_row("Job ID:", str(latest_job_source.job_id))
|
||||
metadata_row(
|
||||
|
||||
Reference in New Issue
Block a user