Merge pull request #4628 from artoscinote/ma_SCI_7473

Fix inventory multiline file uploads [SCI-7473]
This commit is contained in:
artoscinote 2022-11-21 12:59:40 +01:00 committed by GitHub
commit 92d446b43d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View file

@ -32,12 +32,13 @@ var AssetColumnHelper = (function() {
} else {
$el
.prev('.file-hidden-field-container')
.html(`<input type="hidden"
form="${$el.attr('form')}"
name="repository_cells[${$el.data('col-id')}]"
.html(`<input type="hidden"
form="${$el.attr('form')}"
name="repository_cells[${$el.data('col-id')}]"
value="${blob.signed_id}"/>`);
filesUploadedCntr += 1;
if (filesUploadedCntr === filesToUploadCntr) {
resolve('done');
}
@ -52,12 +53,13 @@ var AssetColumnHelper = (function() {
let empty = $cell.is(':empty');
let fileName = $cell.find('a.file-preview-link').text();
let placeholder = I18n.t('repositories.table.assets.select_file_btn', { max_size: GLOBAL_CONSTANTS.FILE_MAX_SIZE_MB });
let rowId = $cell.parent().attr('id');
$cell.html(`
<div class="file-editing">
<div class="file-hidden-field-container hidden"></div>
<input class=""
id="repository_file_${columnId}"
id="repository_file_${columnId}_${rowId}"
form="${formId}"
type="file"
data-col-id="${columnId}"
@ -66,7 +68,7 @@ var AssetColumnHelper = (function() {
data-type="RepositoryAssetValue">
<div class="file-upload-button ${empty ? 'new-file' : ''}">
<i class="fas fa-paperclip icon"></i>
<label data-placeholder="${placeholder}" for="repository_file_${columnId}">${fileName}</label>
<label data-placeholder="${placeholder}" for="repository_file_${columnId}_${rowId}">${fileName}</label>
<span class="delete-action fas fa-trash"> </span>
</div>
</div>`);

View file

@ -26,7 +26,7 @@ var RepositoryDatatableRowEditor = (function() {
let $row = $form.closest('tr');
let valid = true;
let directUrl = $table.data('direct-upload-url');
let $files = $row.find('input[type=file]');
let $files = $table.find('input[type=file]');
$row.find('.has-error').removeClass('has-error').find('span').remove();
// Validations here