Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/gh313 #318

Merged
merged 2 commits into from
Dec 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 30 additions & 11 deletions vue/src/views/JobView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ div.component
tr
th conditions
td(v-if="job.condition.length > 0")
.condition.code(v-for="cond in job.condition" :key="cond.str") {{ cond.str }}
.condition(v-for="cond in job.condition" :key="cond.str")
span(v-if="cond.type === 'dependency'")
span dependency:
Job(:job-id="cond.job_id")
span is {{ join(cond.states, '|') }}
span(v-else) {{ cond.str }}
td(v-else) No conditions.

tr
Expand Down Expand Up @@ -156,19 +161,23 @@ export default {
},

created() {
const url = '/api/v1/jobs/' + this.job_id // FIXME
fetch(url)
.then(async (response) => {
if (response.ok)
this.job = await response.json()
else if (response.status === 404)
this.job = null
else
store.state.errors.add('fetch ' + url + ' ' + response.status + ' ' + await response.text())
})
this.fetchJob(this.job_id)
},

methods: {
fetchJob(job_id) {
const url = '/api/v1/jobs/' + job_id // FIXME
fetch(url)
.then(async (response) => {
if (response.ok)
this.job = await response.json()
else if (response.status === 404)
this.job = null
else
store.state.errors.add('fetch ' + url + ' ' + response.status + ' ' + await response.text())
})
},

markdown(src) { return src.trim() === '' ? '' : (new showdown.Converter()).makeHtml(src) },

setScheduleArg(param, ev) {
Expand Down Expand Up @@ -217,6 +226,16 @@ export default {
modal.$mount()
this.$root.$el.appendChild(modal.$el)
},

join,
},

watch: {
// Navigating to another job through the router doesn't recreate the view; the job_id just changes.
job_id: function (job_id) {
this.job = undefined
this.fetchJob(job_id)
}
},

}
Expand Down