Show error for broken file in repository row [SCI-6838] (#4146)

This commit is contained in:
ajugo 2022-06-08 13:35:06 +02:00 committed by GitHub
parent 1f0225043f
commit a5065b82cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 16 deletions

View file

@ -2,23 +2,29 @@
$.fn.dataTable.render.RepositoryAssetValue = function(data) {
var asset = data.value;
return `
<div class="asset-value-cell">
${asset.icon_html}
<div>
<a class="file-preview-link"
id="modal_link${asset.id}"
data-no-turbolink="true"
data-id="true"
data-status="asset-present"
data-preview-url="${asset.preview_url}"
href="${asset.url}"
>
${asset.file_name}
</a>
if (asset.id) {
return `
<div class="asset-value-cell">
${asset.icon_html}
<div>
<a class="file-preview-link"
id="modal_link${asset.id}"
data-no-turbolink="true"
data-id="true"
data-status="asset-present"
data-preview-url="${asset.preview_url}"
href="${asset.url}"
>
${asset.file_name}
</a>
</div>
</div>
</div>
`;
`;
}
return `<div class="processing-error">
<i class="fas fa-exclamation-triangle"></i>
${I18n.t('my_modules.repository.full_view.error')}
</div>`;
};
$.fn.dataTable.render.defaultRepositoryAssetValue = function() {

View file

@ -16,6 +16,15 @@
}
}
.processing-error {
color: $brand-danger;
margin-left: 2px;
.fa-exclamation-triangle {
margin-right: 5px;
}
}
.repository-table-error {
background: $color-white;
display: none;

View file

@ -13,6 +13,8 @@ module RepositoryDatatable
file_name: asset.file_name,
icon_html: FileIconsHelper.file_extension_icon_html(asset)
}
rescue StandardError => e
Rails.logger.error e.message
end
end
end

View file

@ -986,6 +986,7 @@ en:
modal_live_header: ': Live version'
modal_snapshot_header: ': Snapshot of %{snapshot_date}'
assign_modal_header: 'Assign from %{repository_name} inventory'
error: 'Error'
snapshots:
simple_view:
live_bottom_label: 'Live version'