Fix: settings master/detail, widget kind filter, reorder, media worker
Four fixes: 1. Settings > Services tab: master/detail layout. Replaced the vertical stack of ServiceConfigEditor cards with a SelectionRailCard (list on left) + SectionCard (details on right) — same pattern as Machines and SSH Keys tabs. Click a service in the rail to edit it. 2. Service Overview widget restriction. When adding widgets on a service's Overview, the dialog now only shows built-in widgets + widgets for THAT service type (not all services). Dashboard/named dashboards (no serviceId) still see all. 3. Reorder buttons fixed. The swap-sort_order approach was a no-op when both items had sort_order=0 (the default). Now moveInstance renumbers ALL items by their new index position (i * 10) after the swap, guaranteeing values change. References use updateRef, owned widgets use saveWidget, both sequential. 4. Media index worker resolution. The subprocess worker called get_jellyfin_client/get_user_id (FastAPI request dependencies) which don't work outside request context. Now accepts a service_id parameter (passed from post_build_index) and resolves the Jellyfin instance directly from the settings store via _resolve_jellyfin. Raises RuntimeError (not HTTPException) on failure. 283 backend tests pass; 128 frontend tests pass; ruff/eslint clean.
This commit is contained in:
@@ -98,7 +98,7 @@ def _serialize_status(status: Any) -> dict[str, Any]:
|
||||
}
|
||||
|
||||
|
||||
def _worker_command(final_db_path: Path, staging_db_path: Path) -> list[str]:
|
||||
def _worker_command(final_db_path: Path, staging_db_path: Path, service_id: str = "") -> list[str]:
|
||||
return [
|
||||
sys.executable,
|
||||
"-m",
|
||||
@@ -107,14 +107,16 @@ def _worker_command(final_db_path: Path, staging_db_path: Path) -> list[str]:
|
||||
str(final_db_path),
|
||||
"--staging-path",
|
||||
str(staging_db_path),
|
||||
"--service-id",
|
||||
service_id,
|
||||
]
|
||||
|
||||
|
||||
def _start_worker(index: MediaIndex) -> subprocess.Popen[bytes]:
|
||||
def _start_worker(index: MediaIndex, service_id: str = "") -> subprocess.Popen[bytes]:
|
||||
staging_path = _staging_db_path(index)
|
||||
staging_path.unlink(missing_ok=True)
|
||||
return subprocess.Popen(
|
||||
_worker_command(index.db_path, staging_path),
|
||||
_worker_command(index.db_path, staging_path, service_id),
|
||||
start_new_session=True,
|
||||
env=os.environ.copy(),
|
||||
)
|
||||
@@ -133,6 +135,7 @@ def get_index_status(index: MediaIndex = Depends(get_media_index)) -> dict[str,
|
||||
def post_build_index(
|
||||
client: JellyfinClient = Depends(get_jellyfin_client),
|
||||
user_id: str = Depends(get_user_id),
|
||||
jellyfin_service_id: str | None = None,
|
||||
index: MediaIndex = Depends(get_media_index),
|
||||
) -> dict[str, Any]:
|
||||
"""Start a media index build in a subprocess worker."""
|
||||
@@ -144,7 +147,7 @@ def post_build_index(
|
||||
|
||||
libraries = client.libraries(user_id)
|
||||
logger.info("Starting media index build user_id=%s libraries=%s", user_id, len(libraries))
|
||||
process = _start_worker(index)
|
||||
process = _start_worker(index, jellyfin_service_id or "")
|
||||
_set_build_metadata(
|
||||
index,
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user