class JobInputList extends RessourceList { static options = { item: ` <tr class="hoverable"> <td><span class="filename"></span></td> <td class="right-align"> <a class="action-button btn-floating tooltipped waves-effect waves-light" data-action="download" data-position="top" data-tooltip="View"><i class="material-icons">file_download</i></a> </td> </tr> `.trim(), ressourceMapper: jobInput => { return { 'id': jobInput.id, 'creation-date': jobInput.creation_date, 'filename': jobInput.filename }; }, sortValueName: 'creation-date', valueNames: [ {data: ['id']}, {data: ['creation-date']}, '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;} }