Skip to content

Commit

Permalink
YDA-5894: hide download buttons when no checksum report
Browse files Browse the repository at this point in the history
  • Loading branch information
leonidastri authored Aug 13, 2024
1 parent 8d96743 commit 2f60ee1
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 13 deletions.
14 changes: 10 additions & 4 deletions deposit/static/deposit/js/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ $(function () {

$('#showChecksumReport .collection').text(folder)
$('#showChecksumReport .modal-body #checksumReport').html('')
$('#showChecksumReport .modal-footer .download-report-text').addClass('d-none')
$('#showChecksumReport .modal-footer .download-report-csv').addClass('d-none')
$('#showChecksumReport .modal-footer .download-report-text').attr('href', downloadUrl + '&format=text')
$('#showChecksumReport .modal-footer .download-report-csv').attr('href', downloadUrl + '&format=csv')

Expand All @@ -167,11 +169,15 @@ $(function () {

table += '<thead><tr><th>Filename</th><th>Size</th><th>Checksum</th></tr></thead>'
$.each(data, function (index, obj) {
table += `<tr>
<td>${obj.name}</td>
<td>${obj.size}</td>
<td>${obj.checksum}</td>
if (data.length > 0) {
table += `<tr>
<td>${obj.name}</td>
<td>${obj.size}</td>
<td>${obj.checksum}</td>
</tr>`
$('#showChecksumReport .modal-footer .download-report-text').removeClass('d-none')
$('#showChecksumReport .modal-footer .download-report-csv').removeClass('d-none')
}
})
table += '</tbody></table>'

Expand Down
16 changes: 11 additions & 5 deletions research/static/research/js/research.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ $(function () {

$('#showChecksumReport .collection').text(folder)
$('#showChecksumReport .modal-body #checksumReport').html('')
$('#showChecksumReport .modal-footer .download-report-text').addClass('d-none')
$('#showChecksumReport .modal-footer .download-report-csv').addClass('d-none')
$('#showChecksumReport .modal-footer .download-report-text').attr('href', downloadUrl + '&format=text')
$('#showChecksumReport .modal-footer .download-report-csv').attr('href', downloadUrl + '&format=csv')

Expand All @@ -193,11 +195,15 @@ $(function () {

table += '<thead><tr><th>Filename</th><th>Size</th><th>Checksum</th></tr></thead>'
$.each(data, function (index, obj) {
table += `<tr>
<td>${obj.name}</td>
<td>${obj.size}</td>
<td>${obj.checksum}</td>
</tr>`
if (data.length > 0) {
table += `<tr>
<td>${obj.name}</td>
<td>${obj.size}</td>
<td>${obj.checksum}</td>
</tr>`
$('#showChecksumReport .modal-footer .download-report-text').removeClass('d-none')
$('#showChecksumReport .modal-footer .download-report-csv').removeClass('d-none')
}
})
table += '</tbody></table>'

Expand Down
14 changes: 10 additions & 4 deletions vault/static/vault/js/vault.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ $(function () {

$('#showChecksumReport .collection').text(folder)
$('#showChecksumReport .modal-body #checksumReport').html('')
$('#showChecksumReport .modal-footer .download-report-text').addClass('d-none')
$('#showChecksumReport .modal-footer .download-report-csv').addClass('d-none')
$('#showChecksumReport .modal-footer .download-report-text').attr('href', downloadUrl + '&format=text')
$('#showChecksumReport .modal-footer .download-report-csv').attr('href', downloadUrl + '&format=csv')

Expand All @@ -58,11 +60,15 @@ $(function () {

table += '<thead><tr><th>Filename</th><th>Size</th><th>Checksum</th></tr></thead>'
$.each(data, function (index, obj) {
table += `<tr>
<td>${obj.name}</td>
<td>${obj.size}</td>
<td>${obj.checksum}</td>
if (data.length > 0) {
table += `<tr>
<td>${obj.name}</td>
<td>${obj.size}</td>
<td>${obj.checksum}</td>
</tr>`
$('#showChecksumReport .modal-footer .download-report-text').removeClass('d-none')
$('#showChecksumReport .modal-footer .download-report-csv').removeClass('d-none')
}
})
table += '</tbody></table>'

Expand Down

0 comments on commit 2f60ee1

Please sign in to comment.