Skip to content

Commit

Permalink
fix submission refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
devincowan committed Dec 8, 2023
1 parent 4d7160b commit 373b64f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
13 changes: 12 additions & 1 deletion app/frontend/src/stores/submissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,16 @@ export const useSubmissionsStore = defineStore('submissions', () => {
return fetchWrapper.get(`${ENDPOINTS.refresh}`)
}

return { submissions, getSubmissions, refreshWorkflows}
async function refreshSubmission (submission) {
const refreshEndpoint = ENDPOINTS.refresh
const refreshUrl = `${refreshEndpoint}/${submission.workflow_id}`
const response = await fetchWrapper.get(refreshUrl)
const objIndex = this.submissions.findIndex(s => s.workflow_id === submission.workflow_id);
if (objIndex > -1) {
this.submissions[objIndex]=response;
}
console.log(response)
}

return { submissions, getSubmissions, refreshWorkflows, refreshSubmission}
})
11 changes: 7 additions & 4 deletions app/frontend/src/views/SubmissionsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div>estimatedDuration: {{submission.estimatedDuration }}</div>
<div>phase: {{ submission.phase }}</div>
<v-btn v-if="submission.phase == 'Succeeded'"><a @click="downloadArtifact(submission)" target="_blank">Download</a></v-btn>
<v-btn><a :href="`${refreshEndpoint}/${submission.workflow_id}`" target="_blank">Refresh</a></v-btn>
<v-btn><a @click="refreshSubmission(submission)">Refresh</a></v-btn>
</v-card>
<v-container>
<a href="https://workflows.argo.cuahsi.io/workflows">argo.cuahsi.io</a>
Expand All @@ -19,20 +19,23 @@ import { useSubmissionsStore } from '@/stores/submissions'
import { ENDPOINTS } from '@/constants'
import { fetchWrapper } from '@/_helpers/fetchWrapper';
const downloadEndpoint = ENDPOINTS.download
const refreshEndpoint = ENDPOINTS.refresh
const submissionStore = useSubmissionsStore();
submissionStore.refreshWorkflows()
submissionStore.getSubmissions()
async function downloadArtifact(submission){
const downloadEndpoint = ENDPOINTS.download
const downloadUrl = `${downloadEndpoint}/${submission.workflow_id}`
let response = await fetchWrapper.get(downloadUrl)
const response = await fetchWrapper.get(downloadUrl)
const link = document.createElement('a')
link.href = response.url
document.body.appendChild(link)
link.click()
document.body.removeChild(link);
}
async function refreshSubmission(submission){
submissionStore.refreshSubmission(submission)
}
</script>

0 comments on commit 373b64f

Please sign in to comment.