From 51b365226dd14260f64bdc11a1f802590f1324c8 Mon Sep 17 00:00:00 2001 From: Matt Aitken Date: Wed, 26 Jul 2023 13:37:48 +0100 Subject: [PATCH] In the Job list, show the latest run across all environments --- apps/webapp/app/presenters/JobListPresenter.server.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/webapp/app/presenters/JobListPresenter.server.ts b/apps/webapp/app/presenters/JobListPresenter.server.ts index f9b283d89..022c2e8c7 100644 --- a/apps/webapp/app/presenters/JobListPresenter.server.ts +++ b/apps/webapp/app/presenters/JobListPresenter.server.ts @@ -146,8 +146,14 @@ export class JobListPresenter { alias.version.eventSpecification ); - const lastRun = - alias.version.runs[0] != null ? alias.version.runs[0] : undefined; + const lastRuns = job.aliases + .map((alias) => alias.version.runs.at(0)) + .filter(Boolean) + .sort((a, b) => { + return b.createdAt.getTime() - a.createdAt.getTime(); + }); + + const lastRun = lastRuns.at(0); const integrations = alias.version.integrations.map((integration) => ({ key: integration.key,