diff --git a/backend/src/media_library_viewer_api/services/settings_store.py b/backend/src/media_library_viewer_api/services/settings_store.py index 0e6052e..e36cbb1 100644 --- a/backend/src/media_library_viewer_api/services/settings_store.py +++ b/backend/src/media_library_viewer_api/services/settings_store.py @@ -16,41 +16,11 @@ from pathlib import Path from typing import Any import paramiko -from media_library_viewer_api.config import get_settings - DEFAULT_SETTINGS_PATH = Path(".cache/media_library_viewer/settings.sqlite") LOCAL_MACHINE_ID = "local" DEFAULT_SERVICES = ["monitoring", "files", "jellyfin"] -def _default_local_machine() -> dict[str, Any]: - settings = get_settings() - return { - "id": LOCAL_MACHINE_ID, - "name": "This machine", - "mode": "local", - "enabled": True, - "services": list(DEFAULT_SERVICES), - "host": "", - "port": 22, - "username": "", - "key_directory": "", - "key_name": "", - "ssh_key_id": "", - "ssh_private_key_set": False, - "ssh_private_key_passphrase_set": False, - "password_set": False, - "media_root": settings.media_root, - "path_prefix": settings.path_prefix, - "jellyfin_url": settings.jellyfin_url, - "jellyfin_user_id": settings.jellyfin_user_id, - "jellyfin_api_key_set": bool(settings.jellyfin_api_key), - "jellyseerr_url": settings.jellyseerr_url, - "jellyseerr_api_key_set": bool(settings.jellyseerr_api_key), - "notes": "", - } - - class SettingsStore: """SQLite-backed settings store for machine definitions and history.""" @@ -286,47 +256,6 @@ class SettingsStore: def ensure_defaults(self) -> None: self.init_schema() - with self.connect() as conn: - row = conn.execute("SELECT COUNT(*) FROM monitoring_machines").fetchone() - if row and int(row[0]) > 0: - return - machine = _default_local_machine() - now = int(time.time()) - config = { - "services": machine["services"], - "host": machine["host"], - "port": machine["port"], - "username": machine["username"], - "key_directory": machine["key_directory"], - "key_name": machine["key_name"], - "ssh_key_id": machine.get("ssh_key_id", ""), - "ssh_private_key": "", - "ssh_private_key_passphrase": "", - "password": "", - "media_root": machine["media_root"], - "path_prefix": machine["path_prefix"], - "jellyfin_url": machine["jellyfin_url"], - "jellyfin_user_id": machine["jellyfin_user_id"], - "jellyfin_api_key": "", - "jellyseerr_url": machine["jellyseerr_url"], - "jellyseerr_api_key": "", - "notes": machine["notes"], - } - conn.execute( - """ - INSERT INTO monitoring_machines (id, name, mode, enabled, config_json, created_at, updated_at) - VALUES (?, ?, ?, ?, ?, ?, ?) - """, - ( - machine["id"], - machine["name"], - machine["mode"], - 1, - json.dumps(config), - now, - now, - ), - ) def list_machines(self) -> list[dict[str, Any]]: self.ensure_defaults() diff --git a/docs/REQUIREMENTS.md b/docs/REQUIREMENTS.md index b7ade0f..def6346 100644 --- a/docs/REQUIREMENTS.md +++ b/docs/REQUIREMENTS.md @@ -152,6 +152,7 @@ Phase 1: Jellyfin media index, SSH-based remote filesystem inspection, server mo - Expose backend poller status/configuration so the dashboard and Monitoring page can surface whether monitoring snapshots are being gathered automatically. - The Monitoring tab should present one section per configured machine, and local vs remote machines should be treated the same in the UI with different connection/configuration data. - Provide a Settings tab where monitoring machines can be added, edited, enabled/disabled, or deleted persistently. +- The app should start with no pre-seeded monitoring machines; users must explicitly add a local or SSH target before Monitoring shows anything. - The Monitoring tab should request all retained collector samples by default, while the dashboard overview can continue to use a shorter recent window. - Show CPU and RAM usage for the last hour. - Show IO wait percentage for the last hour. @@ -243,6 +244,7 @@ Phase 1: Jellyfin media index, SSH-based remote filesystem inspection, server mo - 2026-05-06: The dashboard, Monitoring overview, Applications, and File Browser layouts were normalized around shared titled containers, with Monitoring showing the fleet overview before machine tabs and File Browser using machine tabs with Browser/Media info/Jobs stacked in each machine view. - 2026-05-06: The Applications and Monitoring tab containers were refactored into a reusable bordered tab-card pattern so the active tab's content sits inside the same card as the tab rail. - 2026-05-06: The Settings Machines tab was changed from a repeated form layout to a left-hand machine list with a right-hand details panel and popup editing. +- 2026-05-06: The app no longer seeds a default local monitoring machine; a fresh database starts with an empty machine list until the user creates one. - 2026-05-06: The File Browser was reworked into Browser / Media info / Jobs subtabs. - 2026-05-06: The app shell received a small density pass that tightened container padding and tab widths to make the whole site feel more compact. - 2026-05-06: The tab rails across Actions, Monitoring, Settings, and Files were restyled to be more enterprise-console-like with compact pills, clearer active states, and reduced visual noise.