Webapp redesign phase 2: Overview and imaging floor
Imaging floor (/imaging, /imaging/tiles): - One line per PC: status chip, serial with machine number, hostname and IP, stage text with a segmented stage track, one action plus a '...' menu. Everything else (description, error, timestamps, Intune ID + QR, Set category / ARTS links, LAPS QR, log tail) is in the row's expandable body. - Order: failed, needs action (stage 7), in progress, done; log-only bays fold into one collapsed group. imaging_status.floor_state() and floor_order() compute this. - Status filter buttons with live counts next to the text filter. SSE refresh, expanded-row memory and LAPS handling are unchanged. - Stage text is never truncated; BIOS updates and erasing are bold. Overview (/): - Services popover, technician to-do line, the six most urgent floor rows (?limit=6 partial, refreshed every 15 s), and image cards with lint warnings, map errors and missing zips as separate chips. New, clone, delete and unattend stay on the cards' menus. Copy buttons are now handled once in static/app.js, with a fallback for plain-http pages where navigator.clipboard is unavailable.
This commit is contained in:
@@ -467,3 +467,30 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
});
|
||||
|
||||
|
||||
// Copy buttons: any .copy-btn[data-copy-text], on every page. The LAN is
|
||||
// plain http, so navigator.clipboard is often unavailable; fall back to a
|
||||
// hidden textarea + execCommand. The button briefly reads "Copied".
|
||||
document.addEventListener('click', function (e) {
|
||||
var btn = e.target.closest && e.target.closest('.copy-btn');
|
||||
if (!btn) return;
|
||||
var text = btn.getAttribute('data-copy-text') || '';
|
||||
if (!text) return;
|
||||
var done = function (ok) {
|
||||
var orig = btn.getAttribute('data-orig-label') || btn.textContent;
|
||||
btn.setAttribute('data-orig-label', orig);
|
||||
btn.textContent = ok ? 'Copied' : 'Copy failed';
|
||||
setTimeout(function () { btn.textContent = orig; }, 1400);
|
||||
};
|
||||
if (navigator.clipboard && window.isSecureContext) {
|
||||
navigator.clipboard.writeText(text).then(function () { done(true); }, function () { done(false); });
|
||||
return;
|
||||
}
|
||||
var ta = document.createElement('textarea');
|
||||
ta.value = text; ta.setAttribute('readonly', ''); ta.style.position = 'fixed'; ta.style.opacity = '0';
|
||||
document.body.appendChild(ta); ta.select();
|
||||
var ok = false;
|
||||
try { ok = document.execCommand('copy'); } catch (err) { ok = false; }
|
||||
document.body.removeChild(ta);
|
||||
done(ok);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user