reference corresponding ressources (jobs/queryresults) in JobList and QueryResultList

This commit is contained in:
Patrick Jentsch 2021-01-14 12:30:49 +01:00
parent f8bdfa3a04
commit 223ae773d6
2 changed files with 12 additions and 0 deletions

View File

@ -1,9 +1,15 @@
class JobList extends RessourceList { class JobList extends RessourceList {
constructor(listElement, options = {}) { constructor(listElement, options = {}) {
super(listElement, {...JobList.options, ...options}); super(listElement, {...JobList.options, ...options});
this.jobs = undefined;
this.user.eventListeners.job.addEventListener((eventType, payload) => this.eventHandler(eventType, payload)); this.user.eventListeners.job.addEventListener((eventType, payload) => this.eventHandler(eventType, payload));
} }
init(jobs) {
this.jobs = jobs;
super.init(jobs);
}
onclick(event) { onclick(event) {
let ressourceElement = event.target.closest('tr'); let ressourceElement = event.target.closest('tr');
if (ressourceElement === null) {return;} if (ressourceElement === null) {return;}

View File

@ -1,9 +1,15 @@
class QueryResultList extends RessourceList { class QueryResultList extends RessourceList {
constructor(listElement, options = {}) { constructor(listElement, options = {}) {
super(listElement, {...QueryResultList.options, ...options}); super(listElement, {...QueryResultList.options, ...options});
this.queryResults = undefined;
this.user.eventListeners.queryResult.addEventListener((eventType, payload) => this.eventHandler(eventType, payload)); this.user.eventListeners.queryResult.addEventListener((eventType, payload) => this.eventHandler(eventType, payload));
} }
init(queryResults) {
this.queryResults = queryResults;
super.init(queryResults);
}
onclick(event) { onclick(event) {
let ressourceElement = event.target.closest('tr'); let ressourceElement = event.target.closest('tr');
if (ressourceElement === null) {return;} if (ressourceElement === null) {return;}