diff --git a/DATABASE.md b/DATABASE.md index 8768fbc..db72dbb 100644 --- a/DATABASE.md +++ b/DATABASE.md @@ -589,6 +589,8 @@ The hardware inventory. | `manufacturer`, `model`, `serial`, `location`, `rack_unit`, `notes` | text | | | `purchase_date`, `warranty_until` | text | `YYYY-MM-DD`. | | `purchase_price` | real | In the currency set under the `inventory` settings key. | +| `end_of_support` | text | `YYYY-MM-DD`: when the maker stops patching it, or you plan to retire it. What the lifecycle report goes by (the warranty's end stands in when this is empty). | +| `replacement_cost` | real | What replacing it is expected to cost, in the same currency. The lifecycle report falls back to `purchase_price`. | | `power_watts` | integer | Typical draw, for the running cost. | | `server_id` | integer | The server this is, if it is one. A plain reference, **not a foreign key**: one whose server is gone shows as unlinked. | | `created_at`, `updated_at` | text NOT NULL | ISO. | diff --git a/README.md b/README.md index b077f42..c75a97b 100644 --- a/README.md +++ b/README.md @@ -604,7 +604,17 @@ how much, when its warranty ends, its typical power draw, and which server it is Summary cards show how much is under warranty (and what ends within 90 days), the total draw, and — with a price per kWh set at the foot of the page — a rough yearly running cost. Everyone signed in can look; operators keep it up to date; the weekly digest -mentions a warranty ending within 60 days. +mentions a warranty ending within 60 days, or support ending within 90. + +**Lifecycle planning** (Inventory → Lifecycle). Give a piece of hardware an **end of support** (when the maker stops patching it, or when you plan to retire it) and a +**replacement cost**, and the Lifecycle page lists what ages out, year by year for the next 3, 5, 7 or 10 years, with what replacing each year's hardware is expected to +cost (the total says how many have no figure, so it is "at least" that). What is already past its date is listed first, and what is further off, or has no date, is kept +apart. Until a piece has an end of support, the end of its warranty stands in — and the page says so — and until it has a replacement cost, what it was bought for does. +CSV export; the weekly digest also mentions support ending within 90 days. + +**Empty and loading lists.** A list with nothing in it says what is missing, why that is, and — when you can — the one thing to do about it (a button that opens the right form, or +a link to the page that fills it). A list that has things but not the ones you searched for says so, with a button that clears the search and filters. While a list is on its way +it shows grey placeholder lines rather than looking empty. Entries that are a server also pick up what its agent says the machine is: when you link an entry to a server (or the agent reports later), a blank maker, model or serial number is filled in from the firmware — never over what a person wrote. diff --git a/server/drizzle/0040_petite_invaders.sql b/server/drizzle/0040_petite_invaders.sql new file mode 100644 index 0000000..78869bb --- /dev/null +++ b/server/drizzle/0040_petite_invaders.sql @@ -0,0 +1,2 @@ +ALTER TABLE `assets` ADD `end_of_support` text;--> statement-breakpoint +ALTER TABLE `assets` ADD `replacement_cost` real; \ No newline at end of file diff --git a/server/drizzle/meta/0040_snapshot.json b/server/drizzle/meta/0040_snapshot.json new file mode 100644 index 0000000..b2d9eae --- /dev/null +++ b/server/drizzle/meta/0040_snapshot.json @@ -0,0 +1,3721 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "5cefa6c3-fda8-4f42-a51f-a874daca7488", + "prevId": "f0b7d97a-9232-472a-9285-88c8ee5feef6", + "tables": { + "alert_acks": { + "name": "alert_acks", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "alert_key": { + "name": "alert_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "''" + }, + "assignee_user_id": { + "name": "assignee_user_id", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "assignee_name": { + "name": "assignee_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "acked_by": { + "name": "acked_by", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "acked_at": { + "name": "acked_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "until": { + "name": "until", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_seen_at": { + "name": "last_seen_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "alert_acks_key_idx": { + "name": "alert_acks_key_idx", + "columns": [ + "alert_key" + ], + "isUnique": true + } + }, + "foreignKeys": { + "alert_acks_assignee_user_id_users_id_fk": { + "name": "alert_acks_assignee_user_id_users_id_fk", + "tableFrom": "alert_acks", + "tableTo": "users", + "columnsFrom": [ + "assignee_user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "alert_incidents": { + "name": "alert_incidents", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "alert_key": { + "name": "alert_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "severity": { + "name": "severity", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "peak_severity": { + "name": "peak_severity", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "category": { + "name": "category", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "link": { + "name": "link", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "target_type": { + "name": "target_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "target_id": { + "name": "target_id", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "target_name": { + "name": "target_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "caused_by": { + "name": "caused_by", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "opened_at": { + "name": "opened_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "resolved_at": { + "name": "resolved_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_seen_at": { + "name": "last_seen_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "missing_since": { + "name": "missing_since", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "escalated_step": { + "name": "escalated_step", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "escalated_at": { + "name": "escalated_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "alert_incidents_key_idx": { + "name": "alert_incidents_key_idx", + "columns": [ + "alert_key" + ], + "isUnique": false + }, + "alert_incidents_opened_idx": { + "name": "alert_incidents_opened_idx", + "columns": [ + "opened_at" + ], + "isUnique": false + }, + "alert_incidents_target_idx": { + "name": "alert_incidents_target_idx", + "columns": [ + "target_type", + "target_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "alert_tickets": { + "name": "alert_tickets", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "alert_key": { + "name": "alert_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "seen_count": { + "name": "seen_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + }, + "integration_id": { + "name": "integration_id", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "ticket_number": { + "name": "ticket_number", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "grouped": { + "name": "grouped", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "severity": { + "name": "severity", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "first_seen_at": { + "name": "first_seen_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "last_seen_at": { + "name": "last_seen_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "ticketed_at": { + "name": "ticketed_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "cleared_at": { + "name": "cleared_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "alert_tickets_key_idx": { + "name": "alert_tickets_key_idx", + "columns": [ + "alert_key" + ], + "isUnique": false + } + }, + "foreignKeys": { + "alert_tickets_integration_id_integrations_id_fk": { + "name": "alert_tickets_integration_id_integrations_id_fk", + "tableFrom": "alert_tickets", + "tableTo": "integrations", + "columnsFrom": [ + "integration_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "assets": { + "name": "assets", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'other'" + }, + "manufacturer": { + "name": "manufacturer", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "serial": { + "name": "serial", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "purchase_date": { + "name": "purchase_date", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "purchase_price": { + "name": "purchase_price", + "type": "real", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "warranty_until": { + "name": "warranty_until", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "end_of_support": { + "name": "end_of_support", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "replacement_cost": { + "name": "replacement_cost", + "type": "real", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "rack_unit": { + "name": "rack_unit", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "power_watts": { + "name": "power_watts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "server_id": { + "name": "server_id", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "audit_log": { + "name": "audit_log", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "actor_user_id": { + "name": "actor_user_id", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "actor_label": { + "name": "actor_label", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "category": { + "name": "category", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_type": { + "name": "target_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "target_id": { + "name": "target_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "detail": { + "name": "detail", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + } + }, + "indexes": {}, + "foreignKeys": { + "audit_log_actor_user_id_users_id_fk": { + "name": "audit_log_actor_user_id_users_id_fk", + "tableFrom": "audit_log", + "tableTo": "users", + "columnsFrom": [ + "actor_user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "consistency_ignores": { + "name": "consistency_ignores", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reason": { + "name": "reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + } + }, + "indexes": { + "consistency_ignores_key_unique": { + "name": "consistency_ignores_key_unique", + "columns": [ + "key" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "dependencies": { + "name": "dependencies", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "from_type": { + "name": "from_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "from_id": { + "name": "from_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "to_type": { + "name": "to_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "to_id": { + "name": "to_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + } + }, + "indexes": { + "dependencies_edge_idx": { + "name": "dependencies_edge_idx", + "columns": [ + "from_type", + "from_id", + "to_type", + "to_id" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "diag_log": { + "name": "diag_log", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "operation": { + "name": "operation", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "ok": { + "name": "ok", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "latency_ms": { + "name": "latency_ms", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "dns_providers": { + "name": "dns_providers", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "provider_type": { + "name": "provider_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "credential_id": { + "name": "credential_id", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "config": { + "name": "config", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "enabled": { + "name": "enabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + } + }, + "indexes": {}, + "foreignKeys": { + "dns_providers_credential_id_integration_credentials_id_fk": { + "name": "dns_providers_credential_id_integration_credentials_id_fk", + "tableFrom": "dns_providers", + "tableTo": "integration_credentials", + "columnsFrom": [ + "credential_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "dns_records_cache": { + "name": "dns_records_cache", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "provider_id": { + "name": "provider_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "zone_id": { + "name": "zone_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "record_id": { + "name": "record_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "ttl": { + "name": "ttl", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "priority": { + "name": "priority", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "proxied": { + "name": "proxied", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": { + "dns_records_cache_provider_id_dns_providers_id_fk": { + "name": "dns_records_cache_provider_id_dns_providers_id_fk", + "tableFrom": "dns_records_cache", + "tableTo": "dns_providers", + "columnsFrom": [ + "provider_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "dns_zones_cache": { + "name": "dns_zones_cache", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "provider_id": { + "name": "provider_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "zone_id": { + "name": "zone_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "zone_name": { + "name": "zone_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "synced_at": { + "name": "synced_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "dns_zones_cache_provider_zone_idx": { + "name": "dns_zones_cache_provider_zone_idx", + "columns": [ + "provider_id", + "zone_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "dns_zones_cache_provider_id_dns_providers_id_fk": { + "name": "dns_zones_cache_provider_id_dns_providers_id_fk", + "tableFrom": "dns_zones_cache", + "tableTo": "dns_providers", + "columnsFrom": [ + "provider_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "domains": { + "name": "domains", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "origin": { + "name": "origin", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'manual'" + }, + "expires_at": { + "name": "expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "registrar": { + "name": "registrar", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "lookup_source": { + "name": "lookup_source", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_checked_at": { + "name": "last_checked_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_checked_ok_at": { + "name": "last_checked_ok_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_check_error": { + "name": "last_check_error", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + } + }, + "indexes": { + "domains_name_unique": { + "name": "domains_name_unique", + "columns": [ + "name" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "endpoint_checks": { + "name": "endpoint_checks", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target": { + "name": "target", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "port": { + "name": "port", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "expect_status": { + "name": "expect_status", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "keyword": { + "name": "keyword", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "insecure": { + "name": "insecure", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "interval_minutes": { + "name": "interval_minutes", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 5 + }, + "timeout_seconds": { + "name": "timeout_seconds", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 10 + }, + "failures_before_alert": { + "name": "failures_before_alert", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 2 + }, + "warn_days": { + "name": "warn_days", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 14 + }, + "server_id": { + "name": "server_id", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "enabled": { + "name": "enabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "last_checked_at": { + "name": "last_checked_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_ok": { + "name": "last_ok", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_message": { + "name": "last_message", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_response_ms": { + "name": "last_response_ms", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "cert_expires_at": { + "name": "cert_expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "consecutive_failures": { + "name": "consecutive_failures", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "last_change_at": { + "name": "last_change_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "endpoint_results": { + "name": "endpoint_results", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "check_id": { + "name": "check_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "at": { + "name": "at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "ok": { + "name": "ok", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "ms": { + "name": "ms", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "endpoint_results_check_idx": { + "name": "endpoint_results_check_idx", + "columns": [ + "check_id", + "at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "endpoint_results_check_id_endpoint_checks_id_fk": { + "name": "endpoint_results_check_id_endpoint_checks_id_fk", + "tableFrom": "endpoint_results", + "tableTo": "endpoint_checks", + "columnsFrom": [ + "check_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "event_webhooks": { + "name": "event_webhooks", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "secret": { + "name": "secret", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "events": { + "name": "events", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "enabled": { + "name": "enabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + }, + "last_attempt_at": { + "name": "last_attempt_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_result": { + "name": "last_result", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "incident_notes": { + "name": "incident_notes", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "incident_id": { + "name": "incident_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "author": { + "name": "author", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "body": { + "name": "body", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "incident_notes_incident_idx": { + "name": "incident_notes_incident_idx", + "columns": [ + "incident_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "incident_notes_incident_id_alert_incidents_id_fk": { + "name": "incident_notes_incident_id_alert_incidents_id_fk", + "tableFrom": "incident_notes", + "tableTo": "alert_incidents", + "columnsFrom": [ + "incident_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "integration_credentials": { + "name": "integration_credentials", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "encrypted_secret": { + "name": "encrypted_secret", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "integrations": { + "name": "integrations", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "base_url": { + "name": "base_url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "credential_id": { + "name": "credential_id", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "config": { + "name": "config", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "enabled": { + "name": "enabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + } + }, + "indexes": {}, + "foreignKeys": { + "integrations_credential_id_integration_credentials_id_fk": { + "name": "integrations_credential_id_integration_credentials_id_fk", + "tableFrom": "integrations", + "tableTo": "integration_credentials", + "columnsFrom": [ + "credential_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "ipam_entries": { + "name": "ipam_entries", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "vendor": { + "name": "vendor", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + } + }, + "indexes": { + "ipam_entries_ip_address_unique": { + "name": "ipam_entries_ip_address_unique", + "columns": [ + "ip_address" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "maintenance_aliases": { + "name": "maintenance_aliases", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "address": { + "name": "address", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_type": { + "name": "target_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_id": { + "name": "target_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + } + }, + "indexes": { + "maintenance_aliases_unique_idx": { + "name": "maintenance_aliases_unique_idx", + "columns": [ + "address", + "target_type", + "target_id" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "maintenance_schedules": { + "name": "maintenance_schedules", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reason": { + "name": "reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "targets": { + "name": "targets", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "days": { + "name": "days", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "start_time": { + "name": "start_time", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "duration_minutes": { + "name": "duration_minutes", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "timezone": { + "name": "timezone", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "enabled": { + "name": "enabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "maintenance_windows": { + "name": "maintenance_windows", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "target_type": { + "name": "target_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_id": { + "name": "target_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reason": { + "name": "reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "started_at": { + "name": "started_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "ends_at": { + "name": "ends_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "metrics_tokens": { + "name": "metrics_tokens", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "token_hash": { + "name": "token_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "token_prefix": { + "name": "token_prefix", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + }, + "last_used_at": { + "name": "last_used_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "metrics_tokens_token_hash_unique": { + "name": "metrics_tokens_token_hash_unique", + "columns": [ + "token_hash" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "notification_queue": { + "name": "notification_queue", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "audience": { + "name": "audience", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "port_forwards": { + "name": "port_forwards", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "external_port": { + "name": "external_port", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "protocol": { + "name": "protocol", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'tcp'" + }, + "server_id": { + "name": "server_id", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "destination": { + "name": "destination", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "internal_port": { + "name": "internal_port", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + } + }, + "indexes": {}, + "foreignKeys": { + "port_forwards_server_id_servers_id_fk": { + "name": "port_forwards_server_id_servers_id_fk", + "tableFrom": "port_forwards", + "tableTo": "servers", + "columnsFrom": [ + "server_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "push_subscriptions": { + "name": "push_subscriptions", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "user_id": { + "name": "user_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "endpoint": { + "name": "endpoint", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "p256dh": { + "name": "p256dh", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "auth": { + "name": "auth", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + }, + "last_success_at": { + "name": "last_success_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "min_severity": { + "name": "min_severity", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "categories": { + "name": "categories", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "push_subscriptions_endpoint_unique": { + "name": "push_subscriptions_endpoint_unique", + "columns": [ + "endpoint" + ], + "isUnique": true + } + }, + "foreignKeys": { + "push_subscriptions_user_id_users_id_fk": { + "name": "push_subscriptions_user_id_users_id_fk", + "tableFrom": "push_subscriptions", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "restore_tests": { + "name": "restore_tests", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "subject_key": { + "name": "subject_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "tested_at": { + "name": "tested_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "result": { + "name": "result", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "tested_by": { + "name": "tested_by", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + } + }, + "indexes": { + "restore_tests_subject_idx": { + "name": "restore_tests_subject_idx", + "columns": [ + "subject_key", + "tested_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "runbooks": { + "name": "runbooks", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "target_type": { + "name": "target_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_id": { + "name": "target_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "body": { + "name": "body", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "category": { + "name": "category", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updated_by": { + "name": "updated_by", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "runbooks_target_idx": { + "name": "runbooks_target_idx", + "columns": [ + "target_type", + "target_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "scheduled_tasks": { + "name": "scheduled_tasks", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "server_id": { + "name": "server_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "schedule_type": { + "name": "schedule_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "origin": { + "name": "origin", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'agent'" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "command": { + "name": "command", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "schedule_expression": { + "name": "schedule_expression", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "enabled": { + "name": "enabled", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "next_run_at": { + "name": "next_run_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "raw_metadata": { + "name": "raw_metadata", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_stale": { + "name": "is_stale", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "first_seen_at": { + "name": "first_seen_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + }, + "last_seen_at": { + "name": "last_seen_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + } + }, + "indexes": {}, + "foreignKeys": { + "scheduled_tasks_server_id_servers_id_fk": { + "name": "scheduled_tasks_server_id_servers_id_fk", + "tableFrom": "scheduled_tasks", + "tableTo": "servers", + "columnsFrom": [ + "server_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "secrets": { + "name": "secrets", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'generic'" + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "expiry_date": { + "name": "expiry_date", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "warn_days": { + "name": "warn_days", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 30 + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "check_host": { + "name": "check_host", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "check_port": { + "name": "check_port", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_checked_at": { + "name": "last_checked_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_check_error": { + "name": "last_check_error", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "server_links": { + "name": "server_links", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "server_id": { + "name": "server_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + } + }, + "indexes": {}, + "foreignKeys": { + "server_links_server_id_servers_id_fk": { + "name": "server_links_server_id_servers_id_fk", + "tableFrom": "server_links", + "tableTo": "servers", + "columnsFrom": [ + "server_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "server_metrics": { + "name": "server_metrics", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "server_id": { + "name": "server_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "metric": { + "name": "metric", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "real", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "recorded_at": { + "name": "recorded_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "server_metrics_lookup_idx": { + "name": "server_metrics_lookup_idx", + "columns": [ + "server_id", + "metric", + "recorded_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "server_metrics_server_id_servers_id_fk": { + "name": "server_metrics_server_id_servers_id_fk", + "tableFrom": "server_metrics", + "tableTo": "servers", + "columnsFrom": [ + "server_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "server_ports": { + "name": "server_ports", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "server_id": { + "name": "server_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "port": { + "name": "port", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "protocol": { + "name": "protocol", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'tcp'" + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "comment": { + "name": "comment", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "open": { + "name": "open", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "last_seen_open_at": { + "name": "last_seen_open_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + } + }, + "indexes": { + "server_ports_unique": { + "name": "server_ports_unique", + "columns": [ + "server_id", + "port", + "protocol" + ], + "isUnique": true + } + }, + "foreignKeys": { + "server_ports_server_id_servers_id_fk": { + "name": "server_ports_server_id_servers_id_fk", + "tableFrom": "server_ports", + "tableTo": "servers", + "columnsFrom": [ + "server_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "servers": { + "name": "servers", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "hostname": { + "name": "hostname", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "os_type": { + "name": "os_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'linux'" + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "api_token_hash": { + "name": "api_token_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "api_token_prefix": { + "name": "api_token_prefix", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + }, + "last_seen_at": { + "name": "last_seen_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "ip_addresses": { + "name": "ip_addresses", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "cpu_model": { + "name": "cpu_model", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "cpu_cores": { + "name": "cpu_cores", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "cpu_load_percent": { + "name": "cpu_load_percent", + "type": "real", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "mem_total_bytes": { + "name": "mem_total_bytes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "mem_used_bytes": { + "name": "mem_used_bytes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "disks": { + "name": "disks", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "listening_ports": { + "name": "listening_ports", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_port_scan": { + "name": "last_port_scan", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "tags": { + "name": "tags", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "proxmox_integration_id": { + "name": "proxmox_integration_id", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "proxmox_node": { + "name": "proxmox_node", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "proxmox_guest_type": { + "name": "proxmox_guest_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "proxmox_vmid": { + "name": "proxmox_vmid", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "hide_proxmox_link": { + "name": "hide_proxmox_link", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "parent_server_id": { + "name": "parent_server_id", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "no_parent": { + "name": "no_parent", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "pending_updates": { + "name": "pending_updates", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updates_pending_since": { + "name": "updates_pending_since", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "host_health": { + "name": "host_health", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "agent_diagnostics": { + "name": "agent_diagnostics", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "hw_manufacturer": { + "name": "hw_manufacturer", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "hw_model": { + "name": "hw_model", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "hw_serial": { + "name": "hw_serial", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "thresholds": { + "name": "thresholds", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "agent_version": { + "name": "agent_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": { + "servers_proxmox_integration_id_integrations_id_fk": { + "name": "servers_proxmox_integration_id_integrations_id_fk", + "tableFrom": "servers", + "tableTo": "integrations", + "columnsFrom": [ + "proxmox_integration_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "settings": { + "name": "settings", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "share_links": { + "name": "share_links", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "token_hash": { + "name": "token_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "token_prefix": { + "name": "token_prefix", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "detail": { + "name": "detail", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'summary'" + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'wall'" + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + }, + "expires_at": { + "name": "expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_used_at": { + "name": "last_used_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "share_links_token_hash_unique": { + "name": "share_links_token_hash_unique", + "columns": [ + "token_hash" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "status_items": { + "name": "status_items", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "link_id": { + "name": "link_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "position": { + "name": "position", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_id": { + "name": "target_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "monitor_id": { + "name": "monitor_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "status_items_link_idx": { + "name": "status_items_link_idx", + "columns": [ + "link_id", + "position" + ], + "isUnique": false + } + }, + "foreignKeys": { + "status_items_link_id_share_links_id_fk": { + "name": "status_items_link_id_share_links_id_fk", + "tableFrom": "status_items", + "tableTo": "share_links", + "columnsFrom": [ + "link_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "tag_definitions": { + "name": "tag_definitions", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "color": { + "name": "color", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + } + }, + "indexes": { + "tag_definitions_name_unique": { + "name": "tag_definitions_name_unique", + "columns": [ + "name" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "update_runs": { + "name": "update_runs", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "server_id": { + "name": "server_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "integration_id": { + "name": "integration_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "project_id": { + "name": "project_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "template_id": { + "name": "template_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "template_name": { + "name": "template_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "host_limit": { + "name": "host_limit", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "task_id": { + "name": "task_id", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "task_status": { + "name": "task_status", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "window_id": { + "name": "window_id", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "window_created": { + "name": "window_created", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "started_by": { + "name": "started_by", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "started_at": { + "name": "started_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "task_ended_at": { + "name": "task_ended_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "host_reported_at": { + "name": "host_reported_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "finished_at": { + "name": "finished_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updates_before": { + "name": "updates_before", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "updates_after": { + "name": "updates_after", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "reboot_required": { + "name": "reboot_required", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "poll_errors": { + "name": "poll_errors", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + } + }, + "indexes": { + "update_runs_server_idx": { + "name": "update_runs_server_idx", + "columns": [ + "server_id", + "started_at" + ], + "isUnique": false + }, + "update_runs_status_idx": { + "name": "update_runs_status_idx", + "columns": [ + "status" + ], + "isUnique": false + } + }, + "foreignKeys": { + "update_runs_server_id_servers_id_fk": { + "name": "update_runs_server_id_servers_id_fk", + "tableFrom": "update_runs", + "tableTo": "servers", + "columnsFrom": [ + "server_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "users": { + "name": "users", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "oidc_sub": { + "name": "oidc_sub", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'viewer'" + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(current_timestamp)" + }, + "last_login_at": { + "name": "last_login_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "favorites": { + "name": "favorites", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_looked_at": { + "name": "last_looked_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "groups": { + "name": "groups", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "dashboard_layout": { + "name": "dashboard_layout", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "users_oidc_sub_unique": { + "name": "users_oidc_sub_unique", + "columns": [ + "oidc_sub" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/server/drizzle/meta/_journal.json b/server/drizzle/meta/_journal.json index 32fcc40..64f4902 100644 --- a/server/drizzle/meta/_journal.json +++ b/server/drizzle/meta/_journal.json @@ -281,6 +281,13 @@ "when": 1792356659440, "tag": "0039_old_blur", "breakpoints": true + }, + { + "idx": 40, + "version": "6", + "when": 1792357895858, + "tag": "0040_petite_invaders", + "breakpoints": true } ] } \ No newline at end of file diff --git a/server/src/db/schema.ts b/server/src/db/schema.ts index 4b04863..f4b923a 100644 --- a/server/src/db/schema.ts +++ b/server/src/db/schema.ts @@ -820,6 +820,8 @@ export const assets = sqliteTable("assets", { purchaseDate: text("purchase_date"), // YYYY-MM-DD purchasePrice: real("purchase_price"), // in the currency set under Settings → Inventory warrantyUntil: text("warranty_until"), // YYYY-MM-DD + endOfSupport: text("end_of_support"), // YYYY-MM-DD — when the maker stops patching it, or you plan to retire it; what the lifecycle report goes by + replacementCost: real("replacement_cost"), // what replacing it is expected to cost, in the same currency; the lifecycle report falls back to the purchase price location: text("location"), // room, rack, shelf rackUnit: text("rack_unit"), // e.g. "U12" or "U12-13" powerWatts: integer("power_watts"), // typical draw, for the running cost diff --git a/server/src/routes/inventory.ts b/server/src/routes/inventory.ts index 499472e..3510605 100644 --- a/server/src/routes/inventory.ts +++ b/server/src/routes/inventory.ts @@ -5,7 +5,7 @@ import { db } from "../db/client.js"; import { assetKinds, assets, servers } from "../db/schema.js"; import { requireAuth, requireRole } from "../auth/middleware.js"; import { recordAudit } from "../services/audit.js"; -import { isRealDate } from "../services/inventory.js"; +import { isRealDate, lifecycleReport } from "../services/inventory.js"; import { blanksToFill, differences, hardwareOf } from "../services/inventoryAutofill.js"; import { getSettings, updateSettings } from "../services/settingsStore.js"; import { asyncHandler } from "../utils/asyncHandler.js"; @@ -26,6 +26,8 @@ const assetSchema = z.object({ purchaseDate: date, purchasePrice: z.number().min(0).max(1_000_000_000).nullable().optional(), warrantyUntil: date, + endOfSupport: date, + replacementCost: z.number().min(0).max(1_000_000_000).nullable().optional(), location: text(120), rackUnit: text(30), powerWatts: z.number().int().min(0).max(100_000).nullable().optional(), @@ -46,6 +48,8 @@ function values(d: z.infer) { purchaseDate: clean(d.purchaseDate), purchasePrice: d.purchasePrice ?? null, warrantyUntil: clean(d.warrantyUntil), + endOfSupport: clean(d.endOfSupport), + replacementCost: d.replacementCost ?? null, location: clean(d.location), rackUnit: clean(d.rackUnit), powerWatts: d.powerWatts ?? null, @@ -83,6 +87,14 @@ inventoryRouter.get("/", asyncHandler(async (_req, res) => { }); })); +// What ages out when, for planning what to replace: this year, the next few, later, and what has no date. +inventoryRouter.get("/lifecycle", asyncHandler(async (req, res) => { + const asked = Number(req.query.years); + const years = Number.isInteger(asked) && asked >= 1 && asked <= 10 ? asked : 5; + const [rows, settings] = await Promise.all([db.select().from(assets), getSettings()]); + res.json({ ...lifecycleReport(rows, new Date(), years), currency: settings.inventory.currency }); +})); + const configSchema = z.object({ currency: z.string().trim().max(8), pricePerKwh: z.number().min(0).max(1000).nullable(), diff --git a/server/src/services/inventory.ts b/server/src/services/inventory.ts index d21fcb9..81fd1b3 100644 --- a/server/src/services/inventory.ts +++ b/server/src/services/inventory.ts @@ -30,6 +30,84 @@ export function warrantyStatus(warrantyUntil: string | null, now: Date = new Dat return days <= warnDays ? "expiring" : "ok"; } +// ─── Lifecycle planning ───────────────────────────────────────────────────── + +export interface LifecycleItem { + id: number; + name: string; + kind: string; + /** YYYY-MM-DD — when it ages out. */ + endsOn: string; + /** What that date is: the end of support the maker gives (or you set), or, with none set, the end of the warranty. */ + basis: "support" | "warranty"; + daysLeft: number; + /** What replacing it is expected to cost, and where that figure comes from; null when there is none. */ + cost: number | null; + costBasis: "replacement" | "purchase" | null; +} + +export interface LifecycleYear { + year: number; + items: LifecycleItem[]; + /** The sum of the figures that exist. */ + totalCost: number; + /** How many have no figure, so the total is understood to be at least that. */ + unpriced: number; +} + +export interface LifecycleReport { + /** Already past their date. */ + past: LifecycleItem[]; + /** The years from this one on. */ + years: LifecycleYear[]; + /** Further off than the years shown. */ + later: LifecycleItem[]; + /** With no date at all: no end of support and no warranty. */ + undated: { id: number; name: string; kind: string }[]; +} + +type LifecycleSource = { id: number; name: string; kind: string; endOfSupport: string | null; warrantyUntil: string | null; replacementCost: number | null; purchasePrice: number | null }; + +/** + * What ages out when, for planning what to replace. The date is the end of support where there is one, otherwise the end of the warranty (said + * so, since that is only a stand-in); the cost is the replacement cost where there is one, otherwise what it was bought for. Things already past + * their date, those in each of the next `yearsAhead` calendar years, those later, and those with no date at all are kept apart. + */ +export function lifecycleReport(assets: LifecycleSource[], now: Date = new Date(), yearsAhead = 5): LifecycleReport { + const thisYear = now.getUTCFullYear(); + const years: LifecycleYear[] = Array.from({ length: yearsAhead }, (_, i) => ({ year: thisYear + i, items: [], totalCost: 0, unpriced: 0 })); + const past: LifecycleItem[] = []; + const later: LifecycleItem[] = []; + const undated: LifecycleReport["undated"] = []; + for (const a of assets) { + const support = a.endOfSupport && isRealDate(a.endOfSupport) ? a.endOfSupport : null; + const warranty = a.warrantyUntil && isRealDate(a.warrantyUntil) ? a.warrantyUntil : null; + const endsOn = support ?? warranty; + if (!endsOn) { + undated.push({ id: a.id, name: a.name, kind: a.kind }); + continue; + } + const cost = a.replacementCost ?? a.purchasePrice ?? null; + const item: LifecycleItem = { id: a.id, name: a.name, kind: a.kind, endsOn, basis: support ? "support" : "warranty", daysLeft: warrantyDaysLeft(endsOn, now) ?? 0, cost, costBasis: a.replacementCost !== null ? "replacement" : a.purchasePrice !== null ? "purchase" : null }; + if (item.daysLeft < 0) past.push(item); + else { + const bucket = years.find((y) => y.year === Number(endsOn.slice(0, 4))); + if (bucket) bucket.items.push(item); + else later.push(item); + } + } + const byDate = (x: LifecycleItem, y: LifecycleItem) => x.endsOn.localeCompare(y.endsOn) || x.name.localeCompare(y.name); + past.sort(byDate); + later.sort(byDate); + for (const y of years) { + y.items.sort(byDate); + y.totalCost = Math.round(y.items.reduce((n, i) => n + (i.cost ?? 0), 0)); + y.unpriced = y.items.filter((i) => i.cost === null).length; + } + undated.sort((a, b) => a.name.localeCompare(b.name)); + return { past, years, later, undated }; +} + /** Kilowatt-hours a steady draw uses in a year. */ export function yearlyKwh(watts: number): number { return Math.round((watts / 1000) * 24 * 365 * 100) / 100; diff --git a/server/src/services/weeklyDigest.ts b/server/src/services/weeklyDigest.ts index 5c4b48d..8f55424 100644 --- a/server/src/services/weeklyDigest.ts +++ b/server/src/services/weeklyDigest.ts @@ -185,11 +185,16 @@ export async function buildDigest(now: Date = new Date()): Promise { expiring.push({ daysLeft: d.daysLeft, text: d.daysLeft < 0 ? `Domain ${d.name} expired ${plural(Math.abs(d.daysLeft), "day")} ago` : `Domain ${d.name} expires in ${plural(d.daysLeft, "day")} (${d.expiresAt})` }); } // A warranty about to end is worth knowing while there is still time to claim on it; one that ended long ago is not news. - for (const a of await db.select({ name: assets.name, warrantyUntil: assets.warrantyUntil }).from(assets)) { + for (const a of await db.select({ name: assets.name, warrantyUntil: assets.warrantyUntil, endOfSupport: assets.endOfSupport }).from(assets)) { const days = warrantyDaysLeft(a.warrantyUntil, now); if (days !== null && days >= -30 && days <= 60) { expiring.push({ daysLeft: days, text: days < 0 ? `Warranty on ${a.name} ended ${plural(Math.abs(days), "day")} ago` : `Warranty on ${a.name} ends in ${plural(days, "day")} (${a.warrantyUntil})` }); } + // The end of support gives more notice: it is when something has to be replaced, not claimed on. + const supportDays = warrantyDaysLeft(a.endOfSupport, now); + if (supportDays !== null && supportDays >= -30 && supportDays <= 90) { + expiring.push({ daysLeft: supportDays, text: supportDays < 0 ? `Support for ${a.name} ended ${plural(Math.abs(supportDays), "day")} ago` : `Support for ${a.name} ends in ${plural(supportDays, "day")} (${a.endOfSupport})` }); + } } if (expiring.length > 0) { expiring.sort((a, b) => a.daysLeft - b.daysLeft); diff --git a/server/test/inventoryLifecycle.test.ts b/server/test/inventoryLifecycle.test.ts new file mode 100644 index 0000000..27882eb --- /dev/null +++ b/server/test/inventoryLifecycle.test.ts @@ -0,0 +1,145 @@ +/** + * Lifecycle planning: what ages out when, what replacing it is expected to cost, the route, and the weekly digest's word about support ending. + * + * Run with: npm test --workspace server + */ +import { test, describe, before, after } from "node:test"; +import assert from "node:assert/strict"; +import { mkdtempSync, rmSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import type { AddressInfo } from "node:net"; +import type { Server } from "node:http"; + +const dir = mkdtempSync(join(tmpdir(), "hm-lifecycle-")); +process.env.DATABASE_PATH = join(dir, "test.sqlite"); +process.env.SESSION_DIR = join(dir, "sessions"); +process.env.CREDENTIALS_ENCRYPTION_KEY = "ab".repeat(32); +process.env.HEALTH_STARTUP_GRACE_MS = "0"; + +const express = (await import("express")).default; +const { db } = await import("../src/db/client.js"); +const { users, servers } = await import("../src/db/schema.js"); +const { runMigrations } = await import("../src/db/migrate.js"); +const { inventoryRouter } = await import("../src/routes/inventory.js"); +const { lifecycleReport } = await import("../src/services/inventory.js"); +const { buildDigest } = await import("../src/services/weeklyDigest.js"); +const { updateSettings } = await import("../src/services/settingsStore.js"); + +await runMigrations(); + +const NOW = new Date("2026-10-18T12:00:00Z"); +const asset = (id: number, name: string, extra: Partial<{ endOfSupport: string | null; warrantyUntil: string | null; replacementCost: number | null; purchasePrice: number | null }> = {}) => ({ + id, name, kind: "server", endOfSupport: null, warrantyUntil: null, replacementCost: null, purchasePrice: null, ...extra, +}); + +describe("what ages out when", () => { + const report = lifecycleReport( + [ + asset(1, "NAS", { endOfSupport: "2026-12-31", replacementCost: 6000, purchasePrice: 5200 }), + asset(2, "Switch", { warrantyUntil: "2027-03-01", purchasePrice: 300 }), + asset(3, "Old router", { endOfSupport: "2025-01-01", purchasePrice: 100 }), + asset(4, "Shelf"), + asset(5, "New UPS", { endOfSupport: "2035-06-01", replacementCost: 900 }), + asset(6, "Mini PC", { endOfSupport: "2027-06-01" }), + asset(7, "Today's", { endOfSupport: "2026-10-18", replacementCost: 10 }), + asset(8, "Garbage date", { endOfSupport: "2027-02-30" }), + ], + NOW, + 3, + ); + + test("each thing goes where its date puts it: already past, one of the next years, later, or no date", () => { + assert.deepEqual(report.past.map((i) => i.name), ["Old router"]); + assert.deepEqual(report.years.map((y) => [y.year, y.items.map((i) => i.name)]), [[2026, ["Today's", "NAS"]], [2027, ["Switch", "Mini PC"]], [2028, []]]); + assert.deepEqual(report.later.map((i) => i.name), ["New UPS"]); + assert.deepEqual(report.undated.map((u) => u.name), ["Garbage date", "Shelf"], "an impossible date is no date"); + }); + + test("the date is the end of support, or the warranty's end when none is set, and the report says which", () => { + const nas = report.years[0].items.find((i) => i.name === "NAS")!; + const sw = report.years[1].items.find((i) => i.name === "Switch")!; + assert.deepEqual([nas.basis, nas.endsOn], ["support", "2026-12-31"]); + assert.deepEqual([sw.basis, sw.endsOn], ["warranty", "2027-03-01"]); + assert.equal(report.years[0].items.find((i) => i.name === "Today's")!.daysLeft, 0, "today is not yet past"); + }); + + test("the cost is the replacement cost, or what it was bought for, and a year's total says how many have no figure", () => { + const [y2026, y2027] = report.years; + assert.deepEqual(y2026.items.map((i) => [i.name, i.cost, i.costBasis]), [["Today's", 10, "replacement"], ["NAS", 6000, "replacement"]], "6000 and not the 5200 it was bought for"); + assert.equal(y2026.totalCost, 6010); + assert.deepEqual(y2027.items.map((i) => [i.name, i.cost, i.costBasis]), [["Switch", 300, "purchase"], ["Mini PC", null, null]]); + assert.deepEqual([y2027.totalCost, y2027.unpriced], [300, 1], "the total is at least this much"); + }); +}); + +describe("through the route and the digest", () => { + let app: Server; + let base = ""; + let who = "operator"; + + before(async () => { + await db.insert(users).values([ + { oidcSub: "operator", name: "Olga", role: "operator" }, + { oidcSub: "viewer", name: "Vic", role: "viewer" }, + ]); + await db.insert(servers).values({ name: "elsa", apiTokenHash: "e", apiTokenPrefix: "e", lastSeenAt: new Date().toISOString() }); + const a = express(); + a.use(express.json()); + a.use((req, _res, next) => { + (req as unknown as { session: unknown }).session = { user: { sub: who } }; + next(); + }); + a.use("/api/inventory", inventoryRouter); + app = await new Promise((resolve) => { + const s = a.listen(0, "127.0.0.1", () => resolve(s)); + }); + base = `http://127.0.0.1:${(app.address() as AddressInfo).port}/api/inventory`; + }); + + after(() => { + app.close(); + try { + rmSync(dir, { recursive: true, force: true }); + } catch { + // Windows keeps the database file locked until the process exits. + } + }); + + const send = (method: string, path: string, body?: unknown) => fetch(`${base}${path}`, { method, headers: { "content-type": "application/json" }, body: body === undefined ? undefined : JSON.stringify(body) }); + const inDays = (n: number) => new Date(Date.now() + n * 86_400_000).toISOString().slice(0, 10); + + test("an end of support and a replacement cost are kept; a wrong one is refused", async () => { + const res = await send("POST", "/", { name: "Synology DS920+", kind: "storage", endOfSupport: inDays(45), replacementCost: 6500, purchasePrice: 5200 }); + assert.equal(res.status, 201); + const row = (await res.json()).asset; + assert.equal(row.endOfSupport, inDays(45)); + assert.equal(row.replacementCost, 6500); + assert.equal((await send("POST", "/", { name: "x", kind: "other", endOfSupport: "next year" })).status, 400); + assert.equal((await send("POST", "/", { name: "x", kind: "other", replacementCost: -5 })).status, 400); + const blank = (await (await send("POST", "/", { name: "Blank", kind: "other", endOfSupport: null, replacementCost: null })).json()).asset; + assert.deepEqual([blank.endOfSupport, blank.replacementCost], [null, null]); + }); + + test("the report is for everyone signed in, with the currency, and the number of years can be asked for", async () => { + await updateSettings({ inventory: { currency: "SEK" } }); + who = "viewer"; + const res = await send("GET", "/lifecycle?years=2"); + assert.equal(res.status, 200); + const body = await res.json(); + assert.equal(body.currency, "SEK"); + assert.equal(body.years.length, 2); + assert.equal(body.undated.some((u: { name: string }) => u.name === "Blank"), true); + assert.equal((await (await send("GET", "/lifecycle?years=nonsense")).json()).years.length, 5, "five by default"); + assert.equal((await (await send("GET", "/lifecycle?years=99")).json()).years.length, 5, "and never absurd"); + const all = [...body.past, ...body.years.flatMap((y: { items: unknown[] }) => y.items), ...body.later] as { name: string; basis: string; cost: number }[]; + const nas = all.find((i) => i.name === "Synology DS920+")!; + assert.deepEqual([nas.basis, nas.cost], ["support", 6500]); + who = "operator"; + }); + + test("support about to end is in the weekly digest, with its date", async () => { + const digest = await buildDigest(new Date()); + assert.match(digest.message, /EXPIRING\n- Support for Synology DS920\+ ends in (44|45|46) days \(\d{4}-\d{2}-\d{2}\)/); + }); +}); diff --git a/web/src/App.tsx b/web/src/App.tsx index 59bd815..6f196e0 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -33,6 +33,7 @@ import Incidents from "./pages/Incidents"; import IncidentDetail from "./pages/IncidentDetail"; import Inventory from "./pages/Inventory"; import InventoryLabels from "./pages/InventoryLabels"; +import InventoryLifecycle from "./pages/InventoryLifecycle"; import Dependencies from "./pages/Dependencies"; import Endpoints from "./pages/Endpoints"; import ChangeLog from "./pages/ChangeLog"; @@ -152,6 +153,7 @@ function Shelled({ user }: { user: CurrentUser }) { } /> } /> } /> + } /> } /> } /> : } /> diff --git a/web/src/api/client.ts b/web/src/api/client.ts index b3fee33..c77302f 100644 --- a/web/src/api/client.ts +++ b/web/src/api/client.ts @@ -909,6 +909,24 @@ export interface ChangeEntry { serverId: number | null; } +export interface LifecycleItem { + id: number; + name: string; + kind: string; + endsOn: string; + basis: "support" | "warranty"; + daysLeft: number; + cost: number | null; + costBasis: "replacement" | "purchase" | null; +} +export interface LifecycleReport { + past: LifecycleItem[]; + years: { year: number; items: LifecycleItem[]; totalCost: number; unpriced: number }[]; + later: LifecycleItem[]; + undated: { id: number; name: string; kind: string }[]; + currency: string; +} + export type AssetKind = "server" | "storage" | "network" | "power" | "client" | "other"; export type DependencyNodeType = "server" | "integration"; @@ -965,6 +983,10 @@ export interface Asset { purchaseDate: string | null; purchasePrice: number | null; warrantyUntil: string | null; + /** When the maker stops patching it, or you plan to retire it; the lifecycle report goes by this. */ + endOfSupport: string | null; + /** What replacing it is expected to cost. */ + replacementCost: number | null; location: string | null; rackUnit: string | null; powerWatts: number | null; @@ -988,6 +1010,8 @@ export interface AssetInput { purchaseDate?: string | null; purchasePrice?: number | null; warrantyUntil?: string | null; + endOfSupport?: string | null; + replacementCost?: number | null; location?: string | null; rackUnit?: string | null; powerWatts?: number | null; @@ -1885,6 +1909,7 @@ export const api = { create: (data: AssetInput) => request<{ asset: Asset }>("/api/inventory", { method: "POST", body: JSON.stringify(data) }), update: (id: number, data: AssetInput) => request<{ asset: Asset }>(`/api/inventory/${id}`, { method: "PUT", body: JSON.stringify(data) }), remove: (id: number) => request(`/api/inventory/${id}`, { method: "DELETE" }), + lifecycle: (years = 5) => request(`/api/inventory/lifecycle?years=${years}`), refreshFromAgent: (id: number) => request<{ asset: Asset; changed: string[] }>(`/api/inventory/${id}/refresh-from-agent`, { method: "POST" }), setConfig: (data: InventoryConfig) => request<{ config: InventoryConfig }>("/api/inventory/config", { method: "PUT", body: JSON.stringify(data) }), }, diff --git a/web/src/components/EmptyState.tsx b/web/src/components/EmptyState.tsx new file mode 100644 index 0000000..0966684 --- /dev/null +++ b/web/src/components/EmptyState.tsx @@ -0,0 +1,63 @@ +import type { ReactNode } from "react"; +import { Link } from "react-router-dom"; +import { IconInbox, IconSearch } from "@tabler/icons-react"; +import { BlockSkeleton } from "./Skeleton"; + +export interface EmptyAction { + label: string; + /** Go to a page… */ + to?: string; + /** …or do something here. */ + onClick?: () => void; +} + +/** + * What a list says when it has nothing in it: what is missing, why that is (or what puts something there), and the one thing to do about it + * when the person can. "Nothing matches" is the same thing for a list that has things but not these, with a way to clear what narrowed it. + */ +export default function EmptyState({ title, hint, action, filtered }: { title: string; hint?: ReactNode; action?: EmptyAction; filtered?: boolean }) { + const Icon = filtered ? IconSearch : IconInbox; + return ( +
+
+ ); +} + +/** The same, as a row spanning a table. With \`filtered\`, it says nothing matches and offers to clear what narrowed the list. */ +export function EmptyRow({ colSpan, title, hint, action, filtered }: { colSpan: number; title?: string; hint?: ReactNode; action?: EmptyAction; filtered?: () => void }) { + return ( + + + {filtered ? ( + + ) : ( + + )} + + + ); +} + +/** A table's one row while its list is still on the way, so a list that is loading doesn't look like one that is empty. */ +export function LoadingRow({ colSpan, lines = 3 }: { colSpan: number; lines?: number }) { + return ( + + + + + + ); +} diff --git a/web/src/components/RecurringMaintenance.tsx b/web/src/components/RecurringMaintenance.tsx index 9aade46..cefe346 100644 --- a/web/src/components/RecurringMaintenance.tsx +++ b/web/src/components/RecurringMaintenance.tsx @@ -7,6 +7,7 @@ import { toast } from "../utils/toast"; import TimeAgo from "./TimeAgo"; import { ErrorNotice } from "./Notice"; import ExportTableButton from "./ExportTableButton"; +import { EmptyRow, LoadingRow } from "./EmptyState"; // Monday first, as a week reads; the numbers are what the server keeps (0 = Sunday). const DAYS: { value: number; short: string }[] = [ @@ -339,12 +340,9 @@ export default function RecurringMaintenance({ canEdit, targets, onChanged }: { )} ))} + {schedules === null && } {schedules?.length === 0 && ( - - - Nothing repeats yet. Add one for the night you patch, and its windows appear a week ahead. - - + { setError(null); setAdding(true); } } : undefined} /> )} diff --git a/web/src/pages/AdminLinks.tsx b/web/src/pages/AdminLinks.tsx index d7bf957..5ffa564 100644 --- a/web/src/pages/AdminLinks.tsx +++ b/web/src/pages/AdminLinks.tsx @@ -8,6 +8,7 @@ import { guessAdminUrl, portOptionLabel } from "../utils/adminLinkUrl"; import { confirmDialog } from "../utils/dialogs"; import { ErrorNotice } from "../components/Notice"; import TableToolbar from "../components/TableToolbar"; +import { EmptyRow, LoadingRow } from "../components/EmptyState"; interface LinkForm { serverId: number | ""; @@ -304,19 +305,12 @@ export default function AdminLinks({ user }: { user: CurrentUser }) { )} ))} + {links === null && } {links !== null && links.length === 0 && ( - - - No admin links added yet. - - + )} {links !== null && links.length > 0 && (sorted ?? []).length === 0 && ( - - - Nothing matches "{search}". - - + setSearch("")} /> )} diff --git a/web/src/pages/Alerts.tsx b/web/src/pages/Alerts.tsx index 86c0986..f2faeae 100644 --- a/web/src/pages/Alerts.tsx +++ b/web/src/pages/Alerts.tsx @@ -17,6 +17,7 @@ import RunbookEntry from "../components/RunbookEntry"; import AckDrawer, { ackWords } from "../components/AckDrawer"; import { useAlertsReport } from "../hooks/useAlertsReport"; import { summariseAlerts } from "../utils/alertSummary"; +import { EmptyRow } from "../components/EmptyState"; const SEVERITY: Record = { critical: { label: "Critical", badge: "bg-red-lt text-red", rank: 0 }, @@ -431,11 +432,7 @@ export default function Alerts({ user }: { user: CurrentUser }) { ))} {(sorted ?? []).length === 0 && ( - - - Nothing matches these filters. - - + { setSeverity("all"); setCategory("all"); setSearch(""); setAttention("all"); setShowSilenced(true); }} /> )} diff --git a/web/src/pages/AuditLog.tsx b/web/src/pages/AuditLog.tsx index 88853c6..84e40ad 100644 --- a/web/src/pages/AuditLog.tsx +++ b/web/src/pages/AuditLog.tsx @@ -9,6 +9,7 @@ import { downloadCsv } from "../utils/csv"; import { ErrorNotice } from "../components/Notice"; import { SearchBox } from "../components/TableToolbar"; import { useTableSearch } from "../hooks/useTableSearch"; +import { EmptyRow, LoadingRow } from "../components/EmptyState"; function targetLabel(e: AuditLogEntry): string { if (!e.targetType) return "—"; @@ -106,12 +107,9 @@ export default function AuditLog() { ))} + {entries === null && } {sorted?.length === 0 && ( - - - No activity recorded yet. - - + tableSearch.setQuery("") : undefined} /> )} diff --git a/web/src/pages/Backups.tsx b/web/src/pages/Backups.tsx index d842399..f2a8919 100644 --- a/web/src/pages/Backups.tsx +++ b/web/src/pages/Backups.tsx @@ -14,6 +14,7 @@ import { useSortable } from "../hooks/useSortable"; import { useTableSearch } from "../hooks/useTableSearch"; import { downloadCsv } from "../utils/csv"; import { readableError } from "../utils/errors"; +import { EmptyRow } from "../components/EmptyState"; interface Row extends CoverageGuest { /** Worst first, so a default sort puts what needs attention at the top. */ @@ -300,17 +301,7 @@ export default function Backups({ user }: { user?: CurrentUser }) { ))} {report !== null && sorted?.length === 0 && ( - - - {rows.length === 0 ? ( - <> - No Proxmox guests to show. Connect a Proxmox integration under Integrations. - - ) : ( - "Nothing matches that." - )} - - + { tableSearch.setQuery(""); setParam("status", null); } })} /> )} @@ -439,11 +430,7 @@ export default function Backups({ user }: { user?: CurrentUser }) { ))} {tests !== null && tests.length === 0 && ( - - - No restore has been recorded yet.{canRecord ? " After you next try one, record it here." : ""} - - + setDraft({ key: null, label: "", testedAt: todayIso(), result: "ok", note: "" }) } : undefined} /> )} diff --git a/web/src/pages/ChangeLog.tsx b/web/src/pages/ChangeLog.tsx index b2a7474..15d8ae5 100644 --- a/web/src/pages/ChangeLog.tsx +++ b/web/src/pages/ChangeLog.tsx @@ -3,6 +3,7 @@ import { Link, useSearchParams } from "react-router-dom"; import { api, type ChangeEntry, type ChangeKind } from "../api/client"; import { ErrorNotice } from "../components/Notice"; import { BlockSkeleton } from "../components/Skeleton"; +import EmptyState from "../components/EmptyState"; import { downloadCsv } from "../utils/csv"; import { formatDate, formatTime } from "../utils/date"; import { readableError } from "../utils/errors"; @@ -157,10 +158,16 @@ export default function ChangeLog() { {entries === null && !error && } {entries !== null && entries.length === 0 && (
-
- Nothing {q || kind || serverId ? "matches that" : "has changed"} in {RANGES.find((r) => r.days === days)?.label.toLowerCase()}. - {(q || kind || serverId || days < 400) && " Try a wider range or fewer filters."} -
+ {q || kind || serverId ? ( + r.days === days)?.label.toLowerCase()} fits what is searched for. Try a wider range, or fewer filters.`} + action={{ label: "Clear the search and filters", onClick: () => { setText(""); setParams(new URLSearchParams(), { replace: true }); } }} + /> + ) : ( + r.days === days)?.label.toLowerCase()}. Try a wider range.`} action={days < 400 ? { label: "Show everything kept", onClick: () => setParam("days", "400") } : undefined} /> + )}
)} {days_.map((group) => ( diff --git a/web/src/pages/Dependencies.tsx b/web/src/pages/Dependencies.tsx index 816c382..e4c4432 100644 --- a/web/src/pages/Dependencies.tsx +++ b/web/src/pages/Dependencies.tsx @@ -6,6 +6,7 @@ import { BlockSkeleton } from "../components/Skeleton"; import { confirmDialog } from "../utils/dialogs"; import { readableError } from "../utils/errors"; import { toast } from "../utils/toast"; +import { EmptyRow } from "../components/EmptyState"; const TYPE_LABELS = { server: "Server", integration: "Integration" } as const; @@ -162,11 +163,7 @@ export default function Dependencies({ user }: { user: CurrentUser }) { ))} {data && data.dependencies.length === 0 && ( - - - Nothing written yet.{canEdit ? " Add the first above." : ""} - - + )} diff --git a/web/src/pages/DiagLog.tsx b/web/src/pages/DiagLog.tsx index 394799d..4259e20 100644 --- a/web/src/pages/DiagLog.tsx +++ b/web/src/pages/DiagLog.tsx @@ -6,6 +6,7 @@ import SortableTh from "../components/SortableTh"; import { downloadCsv } from "../utils/csv"; import { confirmDialog } from "../utils/dialogs"; import { ErrorNotice } from "../components/Notice"; +import { EmptyRow, LoadingRow } from "../components/EmptyState"; const SOURCE_LABELS: Record = { cloudflare: "Cloudflare", @@ -186,12 +187,9 @@ export default function DiagLog() { ))} + {entries === null && } {sorted?.length === 0 && ( - - - No diagnostic entries{filterSource || filterOk ? " match these filters" : " yet"}. - - + { setFilterSource(""); setFilterOk(""); } } : { title: "No diagnostic entries yet", hint: "Every call the app makes to an integration or a DNS provider is logged here, with how long it took and whether it worked." })} /> )} diff --git a/web/src/pages/Dns.tsx b/web/src/pages/Dns.tsx index b791dad..b857f60 100644 --- a/web/src/pages/Dns.tsx +++ b/web/src/pages/Dns.tsx @@ -20,6 +20,7 @@ import { downloadCsv } from "../utils/csv"; import { confirmDialog } from "../utils/dialogs"; import { ErrorNotice } from "../components/Notice"; import { toast } from "../utils/toast"; +import { EmptyRow, LoadingRow } from "../components/EmptyState"; const PROVIDER_LABELS: Record = { cloudflare: "Cloudflare", @@ -348,12 +349,9 @@ export default function Dns({ user }: { user: CurrentUser }) { ))} + {providers === null && } {sortedProviders?.length === 0 && ( - - - No DNS providers configured yet. - - + )} @@ -446,11 +444,7 @@ export default function Dns({ user }: { user: CurrentUser }) { ))} {sortedZones && sortedZones.length === 0 && ( - - - No zones found for this provider. - - + )} @@ -607,12 +601,7 @@ export default function Dns({ user }: { user: CurrentUser }) { ))} {sortedRecords?.length === 0 && ( - - - No cached records.{" "} - {syncedAt === null ? "Sync this zone to fetch them." : ""} - - + )} diff --git a/web/src/pages/Docker.tsx b/web/src/pages/Docker.tsx index 2e26568..92f8e00 100644 --- a/web/src/pages/Docker.tsx +++ b/web/src/pages/Docker.tsx @@ -20,6 +20,7 @@ import { SearchBox } from "../components/TableToolbar"; import { useTableSearch } from "../hooks/useTableSearch"; import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer"; import { useRowDetail } from "../hooks/useRowDetail"; +import { EmptyRow } from "../components/EmptyState"; function updateBadge(c: DockhandContainer) { if (c.updateAvailable === null) return —; @@ -308,11 +309,7 @@ export default function Docker({ user }: { user: CurrentUser }) { ))} {data && sorted?.length === 0 && ( - - - {hostFilter ? `No containers found on "${hostFilter}".` : "No containers found across any environment."} - - + setHostFilter("") } : { title: "No containers found", hint: "Dockhand answered with no containers in any environment. Check the integration and its environments.", action: { label: "Check the integration", to: "/integrations" } })} /> )} diff --git a/web/src/pages/Domains.tsx b/web/src/pages/Domains.tsx index 0dc9574..c11489c 100644 --- a/web/src/pages/Domains.tsx +++ b/web/src/pages/Domains.tsx @@ -12,6 +12,7 @@ import { confirmDialog } from "../utils/dialogs"; import { ErrorNotice } from "../components/Notice"; import { SearchBox } from "../components/TableToolbar"; import { useTableSearch } from "../hooks/useTableSearch"; +import { EmptyRow } from "../components/EmptyState"; function statusBadge(d: DomainRecord) { switch (d.status) { @@ -227,12 +228,7 @@ export default function Domains({ user }: { user: CurrentUser }) { ))} {data && data.domains.length === 0 && ( - - - No domains tracked yet. Ones for your DNS zones appear after the next daily check - {canEdit ? " — or use “Check all now”" : ""}. - - + )} diff --git a/web/src/pages/Endpoints.tsx b/web/src/pages/Endpoints.tsx index 1a58f9e..41ba33a 100644 --- a/web/src/pages/Endpoints.tsx +++ b/web/src/pages/Endpoints.tsx @@ -14,6 +14,7 @@ import { downloadCsv } from "../utils/csv"; import { confirmDialog } from "../utils/dialogs"; import { readableError } from "../utils/errors"; import { toast } from "../utils/toast"; +import { EmptyRow } from "../components/EmptyState"; const KIND_LABELS: Record = { http: "Web address", tcp: "Port", tls: "Certificate" }; const KIND_HINTS: Record = { @@ -477,11 +478,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) { ))} {checks !== null && sorted?.length === 0 && ( - - - {tableSearch.active ? "Nothing matches that." : `Nothing is being checked yet.${isAdmin ? " Add the first check: a web address, a port, or a certificate." : ""}`} - - + tableSearch.setQuery("") } : { title: "Nothing is being checked yet", hint: "Ask a web address, a port or a certificate every few minutes, and hear about it when it stops answering or a certificate is about to run out.", action: isAdmin ? { label: "Add a check", onClick: () => setDraft({ ...EMPTY }) } : undefined })} /> )} diff --git a/web/src/pages/Gitea.tsx b/web/src/pages/Gitea.tsx index 02eb16f..02b4202 100644 --- a/web/src/pages/Gitea.tsx +++ b/web/src/pages/Gitea.tsx @@ -14,6 +14,7 @@ import { SearchBox } from "../components/TableToolbar"; import { useTableSearch } from "../hooks/useTableSearch"; import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer"; import { useRowDetail } from "../hooks/useRowDetail"; +import { EmptyRow } from "../components/EmptyState"; function runStatusBadge(repo: GiteaRepo) { const run = repo.latestRun; @@ -234,11 +235,7 @@ export default function Gitea({ user }: { user: CurrentUser }) { ))} {sorted?.length === 0 && ( - - - No repositories visible to this token. - - + tableSearch.setQuery("") : undefined} /> )} diff --git a/web/src/pages/Incidents.tsx b/web/src/pages/Incidents.tsx index 2e786b7..eefc0b1 100644 --- a/web/src/pages/Incidents.tsx +++ b/web/src/pages/Incidents.tsx @@ -12,6 +12,7 @@ import { BlockSkeleton } from "../components/Skeleton"; import { ErrorNotice } from "../components/Notice"; import { downloadCsv } from "../utils/csv"; import { readableError } from "../utils/errors"; +import { EmptyRow } from "../components/EmptyState"; export const CATEGORY_NAMES: Record = { offline: "Server down", @@ -177,11 +178,7 @@ export default function Incidents() { ))} {incidents !== null && (sorted ?? []).length === 0 && ( - - - {tableSearch.active || status !== "all" ? "Nothing matches that." : "No incidents yet. They are recorded from the Alerts, so the first one appears when something is raised."} - - + { tableSearch.setQuery(""); setStatus("all"); } } : { title: "No incidents yet", hint: "An incident is recorded each time an alert is raised and later goes away, so the first one appears when something goes wrong." })} /> )} diff --git a/web/src/pages/Inventory.tsx b/web/src/pages/Inventory.tsx index ed064a1..4b557b1 100644 --- a/web/src/pages/Inventory.tsx +++ b/web/src/pages/Inventory.tsx @@ -15,6 +15,7 @@ import { confirmDialog } from "../utils/dialogs"; import { readableError } from "../utils/errors"; import { KIND_HINTS, KIND_LABELS, money, warrantyDays, warrantyState, yearlyCost, yearlyKwh } from "../utils/inventory"; import { toast } from "../utils/toast"; +import { EmptyRow } from "../components/EmptyState"; const KINDS = Object.keys(KIND_LABELS) as AssetKind[]; @@ -28,6 +29,8 @@ interface Draft { purchaseDate: string; purchasePrice: string; warrantyUntil: string; + endOfSupport: string; + replacementCost: string; location: string; rackUnit: string; powerWatts: string; @@ -35,7 +38,7 @@ interface Draft { notes: string; } -const EMPTY: Draft = { id: null, name: "", kind: "server", manufacturer: "", model: "", serial: "", purchaseDate: "", purchasePrice: "", warrantyUntil: "", location: "", rackUnit: "", powerWatts: "", serverId: "", notes: "" }; +const EMPTY: Draft = { id: null, name: "", kind: "server", manufacturer: "", model: "", serial: "", purchaseDate: "", purchasePrice: "", warrantyUntil: "", endOfSupport: "", replacementCost: "", location: "", rackUnit: "", powerWatts: "", serverId: "", notes: "" }; function toDraft(a: Asset): Draft { return { @@ -48,6 +51,8 @@ function toDraft(a: Asset): Draft { purchaseDate: a.purchaseDate ?? "", purchasePrice: a.purchasePrice === null ? "" : String(a.purchasePrice), warrantyUntil: a.warrantyUntil ?? "", + endOfSupport: a.endOfSupport ?? "", + replacementCost: a.replacementCost === null ? "" : String(a.replacementCost), location: a.location ?? "", rackUnit: a.rackUnit ?? "", powerWatts: a.powerWatts === null ? "" : String(a.powerWatts), @@ -67,6 +72,8 @@ function toInput(d: Draft): AssetInput { purchaseDate: d.purchaseDate || null, purchasePrice: num(d.purchasePrice), warrantyUntil: d.warrantyUntil || null, + endOfSupport: d.endOfSupport || null, + replacementCost: num(d.replacementCost), location: d.location, rackUnit: d.rackUnit, powerWatts: num(d.powerWatts), @@ -75,6 +82,14 @@ function toInput(d: Draft): AssetInput { }; } +/** Under the warranty: when support ends, in words that say how soon. */ +function SupportLine({ until }: { until: string }) { + const days = warrantyDays(until); + if (days === null) return null; + const cls = days < 0 ? "text-red" : days <= 180 ? "text-yellow" : "text-secondary"; + return
{days < 0 ? `support ended ${until}` : days === 0 ? "support ends today" : `support ends ${until}`}
; +} + function WarrantyBadge({ until }: { until: string | null }) { const state = warrantyState(until); const days = warrantyDays(until); @@ -191,8 +206,8 @@ export default function Inventory({ user }: { user: CurrentUser }) { if (!sorted) return; downloadCsv( "inventory.csv", - ["Name", "Kind", "Manufacturer", "Model", "Serial", "Location", "Rack unit", "Purchased", "Price", "Warranty until", "Power (W)", "Server", "Notes"], - sorted.map((a) => [a.name, KIND_LABELS[a.kind], a.manufacturer ?? "", a.model ?? "", a.serial ?? "", a.location ?? "", a.rackUnit ?? "", a.purchaseDate ?? "", a.purchasePrice ?? "", a.warrantyUntil ?? "", a.powerWatts ?? "", a.server?.name ?? "", a.notes ?? ""]), + ["Name", "Kind", "Manufacturer", "Model", "Serial", "Location", "Rack unit", "Purchased", "Price", "Warranty until", "End of support", "Replacement cost", "Power (W)", "Server", "Notes"], + sorted.map((a) => [a.name, KIND_LABELS[a.kind], a.manufacturer ?? "", a.model ?? "", a.serial ?? "", a.location ?? "", a.rackUnit ?? "", a.purchaseDate ?? "", a.purchasePrice ?? "", a.warrantyUntil ?? "", a.endOfSupport ?? "", a.replacementCost ?? "", a.powerWatts ?? "", a.server?.name ?? "", a.notes ?? ""]), ); } @@ -228,6 +243,9 @@ export default function Inventory({ user }: { user: CurrentUser }) {

Inventory

+ + Lifecycle + Print labels @@ -382,6 +400,20 @@ export default function Inventory({ user }: { user: CurrentUser }) { set("warrantyUntil", e.target.value)} />
+
+ + set("endOfSupport", e.target.value)} /> +
When the maker stops patching it, or you plan to retire it.
+
+
+ + set("replacementCost", e.target.value)} /> +
What replacing it should cost. Left empty, the purchase price stands in.
+
) : servers.length === 0 ? (
-
- No servers registered yet. - {isAdmin && ( - <> - {" "} - - . - - )} -
+ setManagingServers(true) } : undefined} + />
) : ( <> diff --git a/web/src/pages/Sessions.tsx b/web/src/pages/Sessions.tsx index a077748..3dba27c 100644 --- a/web/src/pages/Sessions.tsx +++ b/web/src/pages/Sessions.tsx @@ -9,6 +9,7 @@ import { confirmDialog } from "../utils/dialogs"; import { ErrorNotice } from "../components/Notice"; import { SearchBox } from "../components/TableToolbar"; import { useTableSearch } from "../hooks/useTableSearch"; +import { EmptyRow, LoadingRow } from "../components/EmptyState"; function friendlyUserAgent(ua: string | null): string { if (!ua) return "—"; @@ -162,12 +163,9 @@ export default function Sessions() { ))} + {sessions === null && } {sorted?.length === 0 && ( - - - No active sessions. - - + tableSearch.setQuery("") : undefined} /> )} diff --git a/web/src/pages/Synology.tsx b/web/src/pages/Synology.tsx index 2111635..90858d0 100644 --- a/web/src/pages/Synology.tsx +++ b/web/src/pages/Synology.tsx @@ -14,6 +14,7 @@ import SortableTh from "../components/SortableTh"; import { downloadCsv } from "../utils/csv"; import IntegrationPageTitle from "../components/IntegrationPageTitle"; import { ErrorNotice } from "../components/Notice"; +import { EmptyRow } from "../components/EmptyState"; function healthBadge(status: string) { return status === "normal" ? ( @@ -302,11 +303,7 @@ export default function Synology({ user: _user }: { user: CurrentUser }) { ))} {sortedVolumes?.length === 0 && ( - - - No volumes found. - - + )} @@ -377,11 +374,7 @@ export default function Synology({ user: _user }: { user: CurrentUser }) { ))} {sortedDisks?.length === 0 && ( - - - No disks found. - - + )} diff --git a/web/src/pages/Tailscale.tsx b/web/src/pages/Tailscale.tsx index f78dc4f..9bec138 100644 --- a/web/src/pages/Tailscale.tsx +++ b/web/src/pages/Tailscale.tsx @@ -22,6 +22,7 @@ import { SearchBox } from "../components/TableToolbar"; import { useTableSearch } from "../hooks/useTableSearch"; import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer"; import { useRowDetail } from "../hooks/useRowDetail"; +import { EmptyRow } from "../components/EmptyState"; const KEY_EXPIRY_WARN_DAYS = 30; @@ -338,11 +339,7 @@ export default function Tailscale({ user }: { user: CurrentUser }) { ))} {sorted?.length === 0 && ( - - - No devices in this tailnet. - - + tableSearch.setQuery("") : undefined} /> )} diff --git a/web/src/pages/Updates.tsx b/web/src/pages/Updates.tsx index 697f9e1..de1e36a 100644 --- a/web/src/pages/Updates.tsx +++ b/web/src/pages/Updates.tsx @@ -15,6 +15,7 @@ import { readableError } from "../utils/errors"; import ExportTableButton from "../components/ExportTableButton"; import UpdateRunDrawer from "../components/UpdateRunDrawer"; import UpdateRunsCard from "../components/UpdateRunsCard"; +import { EmptyRow } from "../components/EmptyState"; interface Row { id: number; @@ -243,11 +244,7 @@ export default function Updates({ user }: { user: CurrentUser }) { ))} {servers !== null && sorted?.length === 0 && ( - - - {tableSearch.active || onlyWaiting ? "Nothing matches that." : "No server has reported yet."} - - + { tableSearch.setQuery(""); setOnlyWaiting(false); } } : { title: "No server has reported yet", hint: "Waiting updates are read by each server's agent. Install or update the agent and its figures appear here.", action: { label: "Go to Servers", to: "/servers" } })} /> )} diff --git a/web/src/pages/UptimeKuma.tsx b/web/src/pages/UptimeKuma.tsx index cbfaf6a..4b9bdd6 100644 --- a/web/src/pages/UptimeKuma.tsx +++ b/web/src/pages/UptimeKuma.tsx @@ -13,6 +13,7 @@ import { SearchBox } from "../components/TableToolbar"; import { useTableSearch } from "../hooks/useTableSearch"; import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer"; import { useRowDetail } from "../hooks/useRowDetail"; +import { EmptyRow } from "../components/EmptyState"; function statusBadge(monitor: UptimeKumaMonitor) { switch (monitor.status) { @@ -203,11 +204,7 @@ export default function UptimeKuma({ user: _user }: { user: CurrentUser }) { ))} {sorted?.length === 0 && ( - - - No monitors reported by this Uptime Kuma instance. - - + tableSearch.setQuery("") : undefined} /> )} diff --git a/web/src/pages/Users.tsx b/web/src/pages/Users.tsx index 15d094b..1ebefeb 100644 --- a/web/src/pages/Users.tsx +++ b/web/src/pages/Users.tsx @@ -8,6 +8,7 @@ import { downloadCsv } from "../utils/csv"; import { ErrorNotice } from "../components/Notice"; import { SearchBox } from "../components/TableToolbar"; import { useTableSearch } from "../hooks/useTableSearch"; +import { EmptyRow, LoadingRow } from "../components/EmptyState"; const ROLES: UserRole[] = ["viewer", "operator", "admin"]; @@ -117,12 +118,9 @@ export default function Users() { {u.lastLoginAt ? formatDateTime(new Date(u.lastLoginAt)) : "never"} ))} + {users === null && } {sorted?.length === 0 && ( - - - No users yet. - - + tableSearch.setQuery("") : undefined} /> )} diff --git a/web/src/pages/settings/AlertTicketSettings.tsx b/web/src/pages/settings/AlertTicketSettings.tsx index 2fac0ed..8e38145 100644 --- a/web/src/pages/settings/AlertTicketSettings.tsx +++ b/web/src/pages/settings/AlertTicketSettings.tsx @@ -5,6 +5,7 @@ import { formatDateTime } from "../../utils/date"; import { formatAgo } from "../../utils/duration"; import { readableError } from "../../utils/errors"; import { ErrorNotice, SuccessNotice } from "../../components/Notice"; +import { PageSkeleton } from "../../components/Skeleton"; const SEVERITIES: { value: AlertTicketSeverity; label: string; hint: string }[] = [ { value: "critical", label: "Critical", hint: "A server down, a disk nearly full, a failed backup, something expired" }, @@ -51,7 +52,7 @@ export default function AlertTicketSettings() { const dirty = useMemo(() => overview !== null && draft !== null && JSON.stringify(overview.settings) !== JSON.stringify(draft), [overview, draft]); if (!overview || !draft) { - return error ?
{error}
:
Loading…
; + return error ?
{error}
: ; } const set = (patch: Partial) => { diff --git a/web/src/pages/settings/ApiSettings.tsx b/web/src/pages/settings/ApiSettings.tsx index 73c8ef7..390f06b 100644 --- a/web/src/pages/settings/ApiSettings.tsx +++ b/web/src/pages/settings/ApiSettings.tsx @@ -7,6 +7,7 @@ import { confirmDialog } from "../../utils/dialogs"; import { readableError } from "../../utils/errors"; import { toast } from "../../utils/toast"; import ExportTableButton from "../../components/ExportTableButton"; +import { EmptyRow, LoadingRow } from "../../components/EmptyState"; const EVENT_WORDS: Record = { "alert.opened": "A problem begins", @@ -213,12 +214,9 @@ export default function ApiSettings() { ))} + {tokens === null && } {tokens?.length === 0 && ( - - - No tokens yet, so /metrics refuses everyone. - - + )} @@ -348,12 +346,9 @@ export default function ApiSettings() { ))} + {hooks === null && } {hooks?.length === 0 && ( - - - No webhooks yet. - - + setAdding(true) }} /> )} diff --git a/web/src/pages/settings/NameSettings.tsx b/web/src/pages/settings/NameSettings.tsx index 5c493fd..ccc7639 100644 --- a/web/src/pages/settings/NameSettings.tsx +++ b/web/src/pages/settings/NameSettings.tsx @@ -5,6 +5,7 @@ import { formatDateTime } from "../../utils/date"; import { readableError } from "../../utils/errors"; import { parseNames } from "../../utils/nameLists"; import { ErrorNotice, SuccessNotice } from "../../components/Notice"; +import { PageSkeleton } from "../../components/Skeleton"; /** One list as it's being edited. The names are kept as the text in the box, so typing stays natural. */ interface Draft { @@ -217,7 +218,7 @@ export default function NameSettings() { } if (!saved) { - return error ?
{error}
:
Loading…
; + return error ?
{error}
: ; } return ( diff --git a/web/src/pages/settings/ShareSettings.tsx b/web/src/pages/settings/ShareSettings.tsx index ef532e6..8ec362a 100644 --- a/web/src/pages/settings/ShareSettings.tsx +++ b/web/src/pages/settings/ShareSettings.tsx @@ -4,11 +4,13 @@ import StatusPageEditor from "../../components/StatusPageEditor"; import CopyButton from "../../components/CopyButton"; import TimeAgo from "../../components/TimeAgo"; import { ErrorNotice } from "../../components/Notice"; +import { BlockSkeleton } from "../../components/Skeleton"; import { confirmDialog } from "../../utils/dialogs"; import { formatDateTime } from "../../utils/date"; import { readableError } from "../../utils/errors"; import { toast } from "../../utils/toast"; import ExportTableButton from "../../components/ExportTableButton"; +import { EmptyRow } from "../../components/EmptyState"; const LASTS: { days: number | null; label: string }[] = [ { days: null, label: "Until I remove it" }, @@ -227,16 +229,12 @@ export default function ShareSettings() { ))} {links?.length === 0 && ( - - - No share links yet. - - + )} {links === null && !error && ( - - Loading… + + )} diff --git a/web/src/pages/settings/TagSettings.tsx b/web/src/pages/settings/TagSettings.tsx index e3a34b5..2ca582a 100644 --- a/web/src/pages/settings/TagSettings.tsx +++ b/web/src/pages/settings/TagSettings.tsx @@ -5,6 +5,7 @@ import { normalizeTagInput, refreshTagColors, tagBadge } from "../../utils/tags" import { confirmDialog, promptDialog } from "../../utils/dialogs"; import { ErrorNotice, SuccessNotice } from "../../components/Notice"; import ExportTableButton from "../../components/ExportTableButton"; +import { EmptyRow, LoadingRow } from "../../components/EmptyState"; const DEFAULT_PICK = "#3b82f6"; @@ -221,12 +222,9 @@ export default function TagSettings() { ); })} + {tags === null && } {tags && tags.length === 0 && ( - - - No tags yet. Add one above, or tag a server from its page. - - + )} diff --git a/web/src/styles.css b/web/src/styles.css index 027d649..2a64ca3 100644 --- a/web/src/styles.css +++ b/web/src/styles.css @@ -1716,3 +1716,25 @@ tr.alert-row-child > td:first-child { height: 1.25rem; } } + +/* ── What a list says when it has nothing in it (see EmptyState). ── */ +.empty-state { + padding: 1.6rem 1rem; + text-align: center; +} + +.empty-state-icon { + margin-bottom: 0.35rem; + color: var(--tblr-secondary); +} + +.empty-state-title { + font-weight: 600; +} + +.empty-state-hint { + max-width: 34rem; + margin: 0.2rem auto 0; + font-size: 0.875rem; + color: var(--tblr-secondary); +}