Web: only fetch selected job if not yet fully known
This commit is contained in:
parent
e672289a11
commit
81ad3575db
@ -54,10 +54,23 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
// UI component event handlers:
|
// UI component event handlers:
|
||||||
onSelectedJobChanged(jobSummary) {
|
onSelectedJobChanged(jobSummary) {
|
||||||
|
const fullJob = API.Job.constructFromObject(jobSummary);
|
||||||
|
if (fullJob.created) {
|
||||||
|
// The 'created' field is not part of the JobUpdate, but it is part of
|
||||||
|
// Job, so if that field is there, we can assume that this is an
|
||||||
|
// already-fetched job.
|
||||||
|
// TODO: keep track of when this was fetched, and re-fetch if necessary.
|
||||||
|
this.selectedJob = fullJob;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const jobsAPI = new API.JobsApi(this.apiClient);
|
const jobsAPI = new API.JobsApi(this.apiClient);
|
||||||
this._wrap(jobsAPI.fetchJob(jobSummary.id))
|
this._wrap(jobsAPI.fetchJob(jobSummary.id))
|
||||||
.then((job) => {
|
.then((job) => {
|
||||||
this.selectedJob = job;
|
this.selectedJob = job;
|
||||||
|
// Forward the full job to Tabulator, so that the next selection
|
||||||
|
// doesn't have to re-fetch it.
|
||||||
|
this.$refs.jobsTable.processJobUpdate(job);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
sendMessage(message) {
|
sendMessage(message) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user