class JobInputList extends RessourceList {
static options = {
item: `
|
file_download
|
`.trim(),
ressourceMapper: jobInput => {
return {
id: jobInput.id,
creationDate: jobInput.creation_date,
filename: jobInput.filename
};
},
sortValueName: 'creationDate',
valueNames: [{data: ['id']}, {data: ['creationDate']}, 'filename']
};
constructor(listElement, options = {}) {
super(listElement, {...JobInputList.options, ...options});
this.jobId = listElement.dataset.jobId;
}
init(user) {
this._init(user.jobs[this.jobId].inputs);
}
onclick(event) {
let jobInputElement;
let jobInputId;
let action;
let actionButtonElement;
jobInputElement = event.target.closest('tr[data-id]');
if (jobInputElement === null) {return;}
jobInputId = jobInputElement.dataset.id;
actionButtonElement = event.target.closest('.action-button[data-action]');
if (actionButtonElement === null) {return;}
action = actionButtonElement.dataset.action;
switch (action) {
case 'download':
window.location.href = `/jobs/${this.jobId}/inputs/${jobInputId}/download`;
break;
default:
break;
}
}
usersPatchHandler(patch) {return;}
}