Changeset View
Changeset View
Standalone View
Standalone View
swh/web/assets/src/bundles/save/index.js
Show First 20 Lines • Show All 114 Lines • ▼ Show 20 Lines | saveRequestsTable = $('#swh-origin-save-requests') | ||||
if (row.save_task_status === 'succeed' || row.save_task_status === 'failed') { | if (row.save_task_status === 'succeed' || row.save_task_status === 'failed') { | ||||
return `<i class="mdi mdi-information-outline swh-save-request-info" ` + | return `<i class="mdi mdi-information-outline swh-save-request-info" ` + | ||||
'aria-hidden="true" style="cursor: pointer"' + | 'aria-hidden="true" style="cursor: pointer"' + | ||||
`onclick="swh.save.displaySaveRequestInfo(event, ${row.id})"></i>`; | `onclick="swh.save.displaySaveRequestInfo(event, ${row.id})"></i>`; | ||||
} else { | } else { | ||||
return ''; | return ''; | ||||
} | } | ||||
} | } | ||||
}, | |||||
{ | |||||
render: (data, type, row) => { | |||||
if (row.save_request_status === 'accepted') { | |||||
const saveAgainButton = | |||||
'<button class="btn btn-default btn-sm swh-save-origin-again" type="button" ' + | |||||
`onclick="swh.save.fillSaveRequestFormAndScroll(` + | |||||
`'${row.visit_type}', '${row.origin_url}');">` + | |||||
'<i class="mdi mdi-camera mdi-fw" aria-hidden="true"></i>' + | |||||
'Save again</button>'; | |||||
return saveAgainButton; | |||||
} | |||||
} | |||||
} | } | ||||
], | ], | ||||
scrollY: '50vh', | scrollY: '50vh', | ||||
scrollCollapse: true, | scrollCollapse: true, | ||||
order: [[0, 'desc']], | order: [[0, 'desc']], | ||||
responsive: { | responsive: { | ||||
details: { | details: { | ||||
type: 'none' | type: 'none' | ||||
▲ Show 20 Lines • Show All 295 Lines • ▼ Show 20 Lines | .then(saveRequestTaskInfo => { | ||||
</tr>`; | </tr>`; | ||||
} | } | ||||
content += '</tbody></table>'; | content += '</tbody></table>'; | ||||
} | } | ||||
$('.swh-popover').html(content); | $('.swh-popover').html(content); | ||||
$(event.target).popover('update'); | $(event.target).popover('update'); | ||||
}); | }); | ||||
} | } | ||||
export function fillSaveRequestFormAndScroll(visitType, originUrl) { | |||||
$('#swh-input-visit-type option').each(function() { | |||||
let val = $(this).val(); | |||||
if (val === visitType) { | |||||
$(this).prop('selected', true); | |||||
} | |||||
}); | |||||
$('#swh-input-origin-url').val(originUrl); | |||||
window.scrollTo(0, 0); | |||||
} |