diff --git a/src/stores/platform.ts b/src/stores/platform.ts index f3b06da..3df99d1 100644 --- a/src/stores/platform.ts +++ b/src/stores/platform.ts @@ -33,6 +33,7 @@ export const usePlatformStore = defineStore('platform', () => { const settings = ref([]) const auditLogs = ref([]) const notificationOutbox = ref([]) + const projectJenkinsDiagnostics = ref(null) const integrationConfig = ref({ checkedAt: '', integrations: [], @@ -73,6 +74,7 @@ export const usePlatformStore = defineStore('platform', () => { releaseProcessXml.value = processXml auditLogs.value = recentAuditLogs notificationOutbox.value = recentNotificationOutbox + applyProjectJenkinsDiagnostics() dataSource.value = devopsApi.getLastDataSource() } finally { loading.value = false @@ -126,6 +128,19 @@ export const usePlatformStore = defineStore('platform', () => { async function loadProjectJenkinsDiagnostics(): Promise { const diagnostics = await devopsApi.getProjectJenkinsDiagnostics() + projectJenkinsDiagnostics.value = diagnostics + applyProjectJenkinsDiagnostics() + dataSource.value = devopsApi.getLastDataSource() + return diagnostics + } + + function applyProjectJenkinsDiagnostics() { + const diagnostics = projectJenkinsDiagnostics.value + + if (!diagnostics) { + return + } + const jobByEnvironment = new Map( diagnostics.jobs.map((job) => [`${job.projectKey}:${job.environment}`, job]), ) @@ -159,8 +174,6 @@ export const usePlatformStore = defineStore('platform', () => { }, } }) - dataSource.value = devopsApi.getLastDataSource() - return diagnostics } async function loadAuditLogs() { @@ -199,6 +212,7 @@ export const usePlatformStore = defineStore('platform', () => { settings, auditLogs, notificationOutbox, + projectJenkinsDiagnostics, integrationConfig, releaseProcessXml, projectRefs,