diff --git a/.github/workflows/build-push-docker.yml b/.github/workflows/build-push-docker.yml index 4e3625d..8f9515d 100644 --- a/.github/workflows/build-push-docker.yml +++ b/.github/workflows/build-push-docker.yml @@ -15,7 +15,7 @@ env: jobs: build-and-push-image: - if: contains(github.event.head_commit.message, 'build_image') + if: ${{ (github.event.pull_request.merged) || (contains(github.event.head_commit.message, 'build_image')) }} runs-on: ubuntu-latest permissions: contents: read diff --git a/components/analysis/AnalysesTable.vue b/components/analysis/AnalysesTable.vue index 7a1d250..d7defbf 100644 --- a/components/analysis/AnalysesTable.vue +++ b/components/analysis/AnalysesTable.vue @@ -12,9 +12,10 @@ import { getRunStatusSeverity, } from "~/utils/status-tag-severity"; import { + AnalysisBuildStatus, AnalysisNodeRunStatus, + AnalysisRunStatus, ApprovalStatus, - AnalysisBuildStatus, } from "~/services/Api"; const expandedRows = ref(); @@ -40,6 +41,35 @@ function parseData() { } parseData(); +// TODO: remove +function checkRunStatuses() { + const analysesData = response.value!.data; + for (const analysisNode of analysesData) { + if ( + analysisNode.analysis?.build_status === AnalysisBuildStatus.Finished && + !analysisNode.run_status + ) { + const analysisId = analysisNode.analysis_id; + + useLazyFetch(`/po/${analysisId}/pods`, { + $fetch: useNuxtApp().$hubApi, + }) + .then(({ data: prevLogResp, status: podCheckStatus }) => { + watch(prevLogResp, () => { + if ( + podCheckStatus.value === "success" && + prevLogResp.value.pods.length > 0 + ) { + updateRunStatus(analysisNode.id, AnalysisRunStatus.Running); + } + }); + }) + .catch((error) => console.error(error)); + } + } +} +checkRunStatuses(); + function onToggleRowExpansion(rowIds) { expandedRows.value = rowIds; } @@ -47,6 +77,7 @@ function onToggleRowExpansion(rowIds) { async function onTableRefresh() { await refresh(); parseData(); + checkRunStatuses(); // TODO: remove } // Table filters @@ -82,7 +113,7 @@ function updateRunStatus(analysisNodeId: string, newStatus: string) { for (let row of analyses.value) { if (row.id === analysisNodeId) { row.run_status = newStatus; - return; + break; } } } diff --git a/components/analysis/AnalysisControlButtons.vue b/components/analysis/AnalysisControlButtons.vue index 429f8a0..ec2dd20 100644 --- a/components/analysis/AnalysisControlButtons.vue +++ b/components/analysis/AnalysisControlButtons.vue @@ -29,6 +29,7 @@ const stopButtonActiveStates = [ AnalysisNodeRunStatus.Running, AnalysisNodeRunStatus.Starting, AnalysisNodeRunStatus.Started, + AnalysisNodeRunStatus.Stopping, ]; const deleteButtonActiveStates = [ AnalysisNodeRunStatus.Failed, @@ -40,7 +41,12 @@ const deleteButtonActiveStates = [ AnalysisNodeRunStatus.Started, ]; -const buttonStatuses = ref(setButtonStatuses(props.analysisRunStatus!)); +const buttonStatuses = ref(setButtonStatuses(props.analysisRunStatus)); + +// TODO: possibly remove when manual pod status checks are removed +watch(props, () => { + buttonStatuses.value = setButtonStatuses(props.analysisRunStatus); +}); function setButtonStatuses(podStatus: string) { emit("newRunStatus", props.analysisNodeId, podStatus); diff --git a/plugins/api.ts b/plugins/api.ts index 34b29d6..f7edf2d 100644 --- a/plugins/api.ts +++ b/plugins/api.ts @@ -23,7 +23,7 @@ export default defineNuxtPlugin(() => { }, async onResponseError({ request, response }) { // Handle the response errors - if (response.status === 401 || response.status === 403) { + if (response.status === 401) { console.warn("User not signed in, returning to login"); return login(); }