Simplify: single AMPP folder picker (repurpose S3 tree, remove separate input)
This commit is contained in:
parent
e55555d2b7
commit
9ec0f91848
1 changed files with 6 additions and 32 deletions
|
|
@ -473,7 +473,7 @@ body::before{content:'';position:fixed;inset:0;background:radial-gradient(ellips
|
|||
</div>
|
||||
|
||||
<div style="margin-bottom:1.5rem">
|
||||
<div class="section-title">Destination Folder</div>
|
||||
<div class="section-title">AMPP Destination Folder</div>
|
||||
<input class="form-input" id="folder-search" placeholder="🔍 Search folders…" oninput="renderFolderTree()" style="margin-bottom:.4rem;font-size:.78rem;padding:.4rem .65rem"/>
|
||||
<div class="folder-tree-box" id="folder-tree-box" style="max-height:320px;overflow-y:auto"></div>
|
||||
<div class="add-row" style="margin-top:.55rem" id="add-folder-row">
|
||||
|
|
@ -481,22 +481,7 @@ body::before{content:'';position:fixed;inset:0;background:radial-gradient(ellips
|
|||
<button class="btn-small" onclick="addFolder()">+ Add</button>
|
||||
</div>
|
||||
<div style="margin-top:.45rem;font-size:.73rem;color:var(--text-dim)">
|
||||
Prefix: <code id="prefix-display" style="color:var(--blue-bright);font-family:'JetBrains Mono',monospace">(root)</code>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- AMPP DESTINATION FOLDER -->
|
||||
<div style="margin-bottom:1.5rem" id="ampp-folder-section">
|
||||
<div class="section-title" style="display:flex;align-items:center;gap:.5rem">
|
||||
AMPP Destination Folder
|
||||
<span style="font-size:.7rem;font-weight:400;text-transform:none;letter-spacing:0;color:var(--text-dim)">— optional</span>
|
||||
</div>
|
||||
<input class="form-input" id="ampp-folder-path-input"
|
||||
placeholder="e.g. NEWS/PACKAGES (leave blank to skip)"
|
||||
oninput="updateAmppFolderFromInput(this.value)"
|
||||
style="font-size:.82rem;margin-bottom:.35rem">
|
||||
<div style="font-size:.75rem;color:var(--text-dim)">
|
||||
AMPP folder: <code id="ampp-folder-display" style="color:var(--blue-bright);font-family:'JetBrains Mono',monospace">(none — skip placement)</code>
|
||||
AMPP folder: <code id="prefix-display" style="color:var(--blue-bright);font-family:'JetBrains Mono',monospace">(root)</code>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -831,8 +816,7 @@ let currentUser = localStorage.getItem('dw_user') || null;
|
|||
let currentRole = localStorage.getItem('dw_role') || null;
|
||||
let uploadMode = 'http';
|
||||
let selectedPrefix = '';
|
||||
let selectedAmppFolderId = '';
|
||||
let selectedAmppFolderName = '';
|
||||
|
||||
let amppFolderCache = [];
|
||||
let folderTree = [];
|
||||
let selectedFiles = [];
|
||||
|
|
@ -1083,16 +1067,6 @@ async function deleteFolder(pathArr) {
|
|||
} catch(e) { showToast(e.message,'error'); }
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// AMPP FOLDER PICKER
|
||||
// ============================================================
|
||||
function updateAmppFolderFromInput(val) {
|
||||
selectedAmppFolderName = val.trim();
|
||||
selectedAmppFolderId = '';
|
||||
var el = document.getElementById('ampp-folder-display');
|
||||
if (el) el.textContent = selectedAmppFolderName || '(none — skip placement)';
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// FILE HANDLING
|
||||
// ============================================================
|
||||
|
|
@ -1251,7 +1225,7 @@ async function uploadFilePresigned(item, idx) {
|
|||
setFileStatus(idx, 'uploading', 'Getting URL\u2026');
|
||||
const pre = await api('POST', '/api/presigned', {
|
||||
filename: item.name, prefix: selectedPrefix, contentType: mime, size: item.file.size,
|
||||
amppFolderId: selectedAmppFolderId, amppFolderName: selectedAmppFolderName,
|
||||
amppFolderName: selectedPrefix,
|
||||
});
|
||||
if (!pre.success) throw new Error(pre.error || 'Failed to get presigned URL');
|
||||
return new Promise((resolve, reject) => {
|
||||
|
|
@ -1266,7 +1240,7 @@ async function uploadFilePresigned(item, idx) {
|
|||
});
|
||||
xhr.addEventListener('load', async () => {
|
||||
if (xhr.status >= 200 && xhr.status < 300) {
|
||||
try { await api('POST', '/api/presigned/complete', { key: pre.key, size: item.file.size, filename: item.name, amppFolderId: selectedAmppFolderId, amppFolderName: selectedAmppFolderName }); } catch(_) {}
|
||||
try { await api('POST', '/api/presigned/complete', { key: pre.key, size: item.file.size, filename: item.name, amppFolderName: selectedPrefix }); } catch(_) {}
|
||||
resolve({ key: pre.key });
|
||||
} else {
|
||||
reject(new Error(`S3 returned ${xhr.status}: ${xhr.statusText}`));
|
||||
|
|
@ -1341,7 +1315,7 @@ async function uploadFilePresigned(item, idx) {
|
|||
setFileStatus(idx, 'uploading', '100%');
|
||||
|
||||
// Notify server for quota tracking + queue AMPP placement
|
||||
try { await api('POST', '/api/presigned/complete', { key, size: item.file.size, filename: item.name, amppFolderId: selectedAmppFolderId, amppFolderName: selectedAmppFolderName }); } catch(_) {}
|
||||
try { await api('POST', '/api/presigned/complete', { key, size: item.file.size, filename: item.name, amppFolderName: selectedPrefix }); } catch(_) {}
|
||||
return { key };
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue