class JobInputList extends RessourceList { static autoInit() { for (let jobInputListElement of document.querySelectorAll('.job-input-list:not(.no-autoinit)')) { new JobInputList(jobInputListElement); } } static options = { listContainerInnerHTMLGenerator: (listContainerElement) => { listContainerElement.innerHTML = `
search
Filename
`.trim(); }, ressourceMapper: (jobInput) => { return { 'id': jobInput.id, 'creation-date': jobInput.creation_date, 'filename': jobInput.filename }; }, sortParams: ['filename', {order: 'asc'}], listjs: { item: ` file_download `.trim(), valueNames: [ {data: ['id']}, {data: ['creation-date']}, 'filename' ] } }; constructor(listContainerElement, options={}) { super(listContainerElement, _.merge({}, JobInputList.options, options)); this.jobId = listContainerElement.dataset.jobId; } init(user) { this._init(user.jobs[this.jobId].inputs); } onClick(event) { let jobInputElement = event.target.closest('tr'); if (jobInputElement === null) {return;} let jobInputId = jobInputElement.dataset.id; if (jobInputId === undefined) {return;} let actionButtonElement = event.target.closest('.action-button'); let action = actionButtonElement === null ? 'download' : actionButtonElement.dataset.action; switch (action) { case 'download': { window.location.href = `/jobs/${this.jobId}/inputs/${jobInputId}/download`; break; } default: { break; } } } onPatch(patch) {return;} }