diff --git a/web/src/compositions/useRepos.ts b/web/src/compositions/useRepos.ts index f921bfb4a..4f3d505f8 100644 --- a/web/src/compositions/useRepos.ts +++ b/web/src/compositions/useRepos.ts @@ -16,8 +16,8 @@ export default function useRepos() { function sortReposByLastActivity(repos: Repo[]): Repo[] { return repos.sort((a, b) => { - const aLastActivity = a.last_pipeline || 0; - const bLastActivity = b.last_pipeline || 0; + const aLastActivity = a.last_pipeline?.created || 0; + const bLastActivity = b.last_pipeline?.created || 0; return bLastActivity - aLastActivity; }); diff --git a/web/src/lib/api/types/repo.ts b/web/src/lib/api/types/repo.ts index 12f5c5f59..dc3bd8e3d 100644 --- a/web/src/lib/api/types/repo.ts +++ b/web/src/lib/api/types/repo.ts @@ -1,3 +1,5 @@ +import type { Pipeline } from "./pipeline"; + // A version control repository. export interface Repo { // Is the repo currently active or not @@ -65,7 +67,7 @@ export interface Repo { visibility: RepoVisibility; - last_pipeline: number; + last_pipeline: Pipeline; require_approval: RepoRequireApproval; diff --git a/web/src/router.ts b/web/src/router.ts index ad807561b..8b4858adc 100644 --- a/web/src/router.ts +++ b/web/src/router.ts @@ -19,7 +19,7 @@ const routes: RouteRecordRaw[] = [ { path: '', name: 'repos', - component: (): Component => import('~/views/Repos.vue'), + component: (): Component => import('~/views/RepoList.vue'), meta: { authentication: 'required' }, }, { diff --git a/web/src/store/repos.ts b/web/src/store/repos.ts index a60afc5fa..467a9105d 100644 --- a/web/src/store/repos.ts +++ b/web/src/store/repos.ts @@ -32,9 +32,13 @@ export const useRepoStore = defineStore('repos', () => { async function loadRepos() { const _ownedRepos = await apiClient.getRepoList(); - _ownedRepos.forEach((repo) => { - repos.set(repo.id, repo); - }); + await Promise.all( + _ownedRepos.map(async (repo) => { + const latestPipeline = await apiClient.getPipelineList(repo.id, { page: 1, perPage: 1 }); + repo.last_pipeline = latestPipeline[0]; + repos.set(repo.id, repo); + }), + ); ownedRepoIds.value = _ownedRepos.map((repo) => repo.id); }