Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 59 additions & 3 deletions src/lib/php/UI/template/include/upload.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,16 @@
</li>
<li>
<div class="form-group">
<input type="checkbox" class="browse-upload-checkbox view-license-rc-size" name="excludefolder" value="1"/>
{{ 'Ignore Configured Folders:'|trans }} {{ configureExcludeFolders|join(', ') }}
<img src="images/info_16.png" data-toggle="tooltip" title="{{'Configure folders from Admin-Customize-Exclude-Files from scanning'|trans}}" alt="" class="info-bullet"/>
<div style="display: flex; align-items: center; gap: 8px; flex-wrap: wrap;">
<input type="checkbox" class="browse-upload-checkbox view-license-rc-size" name="excludefolder" value="1" style="margin-right: 6px;"/>
<span style="white-space: nowrap;">{{ 'Ignore Configured Folders:'|trans }}</span>
<div id="chipsContainer" class="form-control" style="height: auto; min-height: 38px; display: flex; flex-wrap: wrap; align-items: center; padding: 5px 12px; max-width: 350px; margin: 0;">
<div id="excludeFoldersChips" style="display: flex; flex-wrap: wrap; align-items: center;"></div>
<input type="text" id="excludeFolderChipInput" style="border: none; outline: none; box-shadow: none; flex-grow: 1; flex-shrink: 1; min-width: 80px; max-width: 180px; width: 140px; padding: 0; margin-left: 8px; background: transparent;" placeholder="Add folder to ignore..." autocomplete="off"/>
</div>
<img src="images/info_16.png" data-toggle="tooltip" title="{{'Configure folders from Admin-Customize-Exclude-Files from scanning'|trans}}" alt="" class="info-bullet" style="margin-left: 6px;"/>
</div>
<input type="hidden" name="excludefolderSpecific" id="excludefolderSpecific" />
</div>
</li>
<li>
Expand Down Expand Up @@ -105,6 +112,55 @@
$('[data-toggle="tooltip"]').tooltip();
});
</script>
<script>
// Chips-based exclude folders logic
let excludeFolders = [];
// Initialize from backend-provided folders
{% if configureExcludeFolders %}
excludeFolders = `{{ configureExcludeFolders }}`.split(',').filter(f => f.trim() !== '');
{% endif %}
function renderExcludeFolderChips() {
const chipsDiv = document.getElementById('excludeFoldersChips');
chipsDiv.innerHTML = '';
excludeFolders.forEach((folder, idx) => {
const chip = document.createElement('span');
chip.className = 'badge';
chip.style = 'margin-right:6px;padding:6px 10px;font-size:14px;display:inline-block;background-color:#e0e3e8;color:#333;border-radius:12px;';
chip.textContent = folder;
const closeBtn = document.createElement('span');
closeBtn.innerHTML = '&times;';
closeBtn.style = 'margin-left:8px;cursor:pointer;font-weight:bold;';
closeBtn.onclick = function() {
excludeFolders.splice(idx, 1);
updateExcludeFoldersInput();
renderExcludeFolderChips();
};
chip.appendChild(closeBtn);
chipsDiv.appendChild(chip);
});
}
function updateExcludeFoldersInput() {
document.getElementById('excludefolderSpecific').value = excludeFolders.join(',');
}
// Add chip on Enter key in input
document.addEventListener('DOMContentLoaded', function() {
const input = document.getElementById('excludeFolderChipInput');
input.addEventListener('keydown', function(e) {
if (e.key === 'Enter') {
e.preventDefault();
const value = input.value.trim();
if (value && !excludeFolders.includes(value)) {
excludeFolders.push(value);
updateExcludeFoldersInput();
renderExcludeFolderChips();
input.value = '';
}
}
});
renderExcludeFolderChips();
updateExcludeFoldersInput();
});
</script>
{% for aFoot in parmAgentFoots %}
<script type="text/javascript">{{ aFoot }} </script>
{% endfor %}
Expand Down
14 changes: 8 additions & 6 deletions src/www/ui/page/UploadPageBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,14 @@ protected function postUploadAddJobs(Request $request, $fileName, $uploadId, $jo
global $SysConf;
$unpackArgs = intval($request->get('scm')) === 1 ? '-I' : '';

if (intval($request->get('excludefolder'))) {
$rawExclude = $SysConf['SYSCONFIG']['ExcludeFolders'] ?? '';
if (trim($rawExclude) !== '') {
$excludeFolders = $this->sanitizeExcludePatterns($rawExclude);
$excludeArgs = '-E ' . $excludeFolders;
$unpackArgs .= ' ' . $excludeArgs;
// Only process exclude folders if checkbox is checked
if (intval($request->get('excludefolder')) === 1) {
$userExclude = $request->get('excludefolderSpecific');
if ($userExclude) {
$sanitized = $this->sanitizeExcludePatterns($userExclude);
if ($sanitized !== '') {
$unpackArgs .= ' -E ' . $sanitized;
}
}
}
$adj2nestDependencies = array();
Expand Down
Loading