Stripped from the internal repo: per-box deploy trees, Go services (nodelist/astmeta/proxy/svxdr), deploy/sync scripts and all secrets. Config templates for nginx, PHP-FPM, Redis and tmpfiles live in install/ with CHANGEME placeholders. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
32 lines
1.4 KiB
JavaScript
32 lines
1.4 KiB
JavaScript
// ui_msg.js — shared status/error message helpers (dmr-web, svx-web, svxlink-web).
|
|
// Canonical copy: callmgr2/www-mumien/lib/ui_msg.js; other repos carry a COPY.
|
|
//
|
|
// setMsg(elOrId, text, isErr) inline text line: hidden when empty, green/red
|
|
// showErr(elOrId, text) show/hide an error line, keeps its own colour
|
|
// flashMsg(selOrEl, html, isErr, ttlMs) panel-style box (svxlink-web); ttl 0 = stays
|
|
(function () {
|
|
'use strict';
|
|
const el = x => (typeof x === 'string' ? (document.getElementById(x) || document.querySelector(x)) : x);
|
|
function setMsg(target, msg, isErr) {
|
|
const e = el(target); if (!e) return;
|
|
if (!msg) { e.style.display = 'none'; e.textContent = ''; return; }
|
|
e.textContent = msg;
|
|
e.style.color = isErr ? '#ff8080' : '#0f0';
|
|
e.style.display = 'block';
|
|
}
|
|
function showErr(target, msg) {
|
|
const e = el(target); if (!e) return;
|
|
if (!msg) { e.style.display = 'none'; e.textContent = ''; return; }
|
|
e.textContent = msg;
|
|
e.style.display = 'block';
|
|
}
|
|
function flashMsg(target, html, isErr, ttlMs) {
|
|
const e = el(target); if (!e) return;
|
|
e.innerHTML = '<div class="panel" style="color:' + (isErr ? '#ff8080' : '#00ff9c') + ';">' + html + '</div>';
|
|
if (ttlMs > 0) setTimeout(() => { if (e.firstChild) e.innerHTML = ''; }, ttlMs);
|
|
}
|
|
window.setMsg = setMsg;
|
|
window.showErr = showErr;
|
|
window.flashMsg = flashMsg;
|
|
})();
|