feat: NUT (Network UPS Tools) service provider + provider-agnostic UI
Add full NUT support as a polling-based service provider: - Async TCP client for upsd protocol (port 3493, configurable) - 8 event types: online, on_battery, low_battery, battery_restored, comms_lost, comms_restored, replace_battery, overload - 3 bot commands: /status, /devices, /battery - 38 Jinja2 templates (EN+RU notification + command templates) - Database: tracking config fields, migration, seeds - Frontend: provider form with host/port/credentials, grid items, i18n Provider-agnostic UI improvements: - Remove hardcoded 'immich' defaults from all config forms - Dynamic collection labels per provider type (Albums/Repos/Boards/UPS Devices) - Capability-driven test types instead of provider type checks - Template variable helpers for all providers (was Immich-only) - Guard Immich-only shared link check to Immich providers - Auto-clear stale global provider filter from localStorage - EntitySelect search placeholder shows current selection - Fix noneLabel in linked target config selectors New CLAUDE.md rule #8: no provider-specific hardcoding
This commit is contained in:
@@ -185,6 +185,41 @@ async def migrate_schema(engine: AsyncEngine) -> None:
|
||||
)
|
||||
logger.info("Added %s column to tracking_config table", col_name)
|
||||
|
||||
# Add NUT (UPS) tracking flags to tracking_config if missing
|
||||
if await _has_table(conn, "tracking_config"):
|
||||
nut_flags = [
|
||||
("track_ups_online", "INTEGER DEFAULT 1"),
|
||||
("track_ups_on_battery", "INTEGER DEFAULT 1"),
|
||||
("track_ups_low_battery", "INTEGER DEFAULT 1"),
|
||||
("track_ups_battery_restored", "INTEGER DEFAULT 1"),
|
||||
("track_ups_comms_lost", "INTEGER DEFAULT 1"),
|
||||
("track_ups_comms_restored", "INTEGER DEFAULT 1"),
|
||||
("track_ups_replace_battery", "INTEGER DEFAULT 1"),
|
||||
("track_ups_overload", "INTEGER DEFAULT 1"),
|
||||
]
|
||||
for col_name, col_type in nut_flags:
|
||||
if not await _has_column(conn, "tracking_config", col_name):
|
||||
await conn.execute(
|
||||
text(f"ALTER TABLE tracking_config ADD COLUMN {col_name} {col_type}")
|
||||
)
|
||||
logger.info("Added %s column to tracking_config table", col_name)
|
||||
|
||||
# Drop legacy template content columns from template_config
|
||||
# (template content moved to template_slot child rows)
|
||||
if await _has_table(conn, "template_config"):
|
||||
legacy_cols = [
|
||||
"message_assets_added", "message_assets_removed",
|
||||
"message_collection_renamed", "message_collection_deleted",
|
||||
"message_sharing_changed", "periodic_summary_message",
|
||||
"scheduled_assets_message", "memory_mode_message",
|
||||
]
|
||||
for col_name in legacy_cols:
|
||||
if await _has_column(conn, "template_config", col_name):
|
||||
await conn.execute(
|
||||
text(f"ALTER TABLE template_config DROP COLUMN {col_name}")
|
||||
)
|
||||
logger.info("Dropped legacy column %s from template_config", col_name)
|
||||
|
||||
# Add collection_name and shared to tracker_state if missing
|
||||
state_table = "notification_tracker_state" if await _has_table(conn, "notification_tracker_state") else "tracker_state"
|
||||
if await _has_table(conn, state_table):
|
||||
|
||||
Reference in New Issue
Block a user