Enhance API response in portal files listing: streamline JSON structure by consolidating repeated code, improve error handling for directory checks, and add portal files directory information to the response. Update HTML template to display the server directory path dynamically.
This commit is contained in:
@@ -72,7 +72,8 @@
|
||||
<button type="button" class="btn btn-outline btn-sm" id="uploadBtn">Upload file</button>
|
||||
<input type="file" id="uploadInput" style="display:none;" />
|
||||
</div>
|
||||
<p class="mono" style="font-size:0.8rem; margin-bottom:0.75rem;">Served at <strong id="baseUrl">/files/</strong> — use in cloud-init e.g. <code>curl -fsSL "http://SERVER/files/first-boot/splash.png" -o /tmp/splash.png</code></p>
|
||||
<p class="mono" style="font-size:0.8rem; margin-bottom:0.5rem;">Served at <strong id="baseUrl">/files/</strong> — use in cloud-init e.g. <code>curl -fsSL "http://SERVER/files/first-boot/splash.png" -o /tmp/splash.png</code></p>
|
||||
<p class="mono" style="font-size:0.75rem; color:var(--text-muted); margin-bottom:0.75rem;">Directory on server: <strong id="portalDir">—</strong></p>
|
||||
<table>
|
||||
<thead><tr><th>Name</th><th>Type</th><th>Size</th><th>Description</th><th>Actions</th></tr></thead>
|
||||
<tbody id="portalBody"></tbody>
|
||||
@@ -121,6 +122,7 @@
|
||||
descriptions = data.descriptions || {};
|
||||
currentPath = data.current_path || '';
|
||||
document.getElementById('baseUrl').textContent = baseUrl + (currentPath ? currentPath + '/' : '');
|
||||
document.getElementById('portalDir').textContent = data.portal_files_dir || '—';
|
||||
buildBreadcrumb();
|
||||
|
||||
var tbody = document.getElementById('portalBody');
|
||||
|
||||
Reference in New Issue
Block a user