Exclude restart operations from activity log

This commit is contained in:
2026-10-07 23:23:11 -04:00
parent 58375e6db0
commit c0c34d8735
4 changed files with 9 additions and 4 deletions
+2 -2
View File
@@ -101,7 +101,7 @@ items AS (
'Beta test #' || b.id,NULL,bs.server,bs.server_deleted_at,NULL,NULL,'beta',CAST(b.id AS TEXT)
FROM betas b JOIN beta_servers bs ON bs.beta_id=b.id
UNION ALL
SELECT 'host:' || o.id,o.created_at,'host','|host|',
SELECT 'host:' || o.id,o.created_at,CASE WHEN o.kind='instance.restart' THEN 'restart' ELSE 'host' END,'|host|',
CASE WHEN o.state='completed' AND o.routine=1 AND o.observation_success=0 THEN 'observation-failed'
WHEN o.state='completed' AND COALESCE(o.error,'')<>'' THEN 'warning' ELSE o.state END,
${labelCase('o.kind', hostOperationTitles, 'Host operation')},
@@ -153,7 +153,7 @@ export function activityHistory(input: ActivityQuery = {}, now = Date.now()): Ac
const conditions: string[] = [];
// Keep lifecycle jobs in Provisioning, including jobs triggered by automation.
// Apply this before totals and pagination; resource histories can still include them.
if (query.excludeProvisioning) conditions.push("route <> 'provisioning'");
if (query.excludeProvisioning) conditions.push("route <> 'provisioning' AND type <> 'restart'");
const bindings: Record<string, string | number> = {};
for (const key of ['server', 'type', 'state'] as const) if (query[key]) { conditions.push(`${key}=@${key}`); bindings[key] = query[key]; }
if (query.host) { conditions.push('(hostId=@host OR secondaryHostId=@host)'); bindings.host = query.host; }