Drop the failover and shared-services pickers from the Partnership page

They describe what the partner runs during an outage, which is the Fallback tab's subject, not this page's.
This commit is contained in:
Gmer4Lfe
2026-08-17 15:30:52 -04:00
parent 0447fa6f86
commit 1a836dac75
2 changed files with 8 additions and 391 deletions
+8 -186
View File
@@ -120,47 +120,21 @@ textarea.vv-pt-set-input { resize:vertical; white-space:pre; }
<div style="color:#444;font-size:12px;padding:16px 0;text-align:center;">Loading…</div>
</div>
<!-- Row 2 — what has moved, and what you can do about it -->
<div style="display:flex;gap:12px;margin-bottom:12px;align-items:stretch;flex-wrap:wrap;">
<div class="vv-card" id="vv-pt-xfer-card" style="flex:1 1 260px;min-width:0;display:flex;flex-direction:column;">
<h3>Data Transferred</h3>
<div id="vv-pt-xfer-body" style="flex:1;color:#444;font-size:12px;">Loading…</div>
</div>
<div class="vv-card" id="vv-pt-actions-card" style="flex:2 1 340px;min-width:0;">
<h3>Actions</h3>
<div id="vv-pt-actions-body" style="color:#444;font-size:12px;">Loading…</div>
</div>
<!-- Data moved between the servers -->
<div class="vv-card" id="vv-pt-xfer-card" style="margin-bottom:12px;">
<h3>Data Transferred</h3>
<div id="vv-pt-xfer-body" style="color:#444;font-size:12px;">Loading…</div>
</div>
<!-- Row 3 — sync state, and the two lists that decide what the partner carries -->
<!-- Mirror sync + Actions side by side -->
<div style="display:flex;gap:12px;margin-bottom:12px;align-items:stretch;flex-wrap:wrap;">
<div class="vv-card" id="vv-pt-sync-card" style="flex:1 1 220px;min-width:0;display:flex;flex-direction:column;">
<h3>Mirror Sync</h3>
<div id="vv-pt-sync-body" style="flex:1;color:#444;font-size:12px;">Loading…</div>
</div>
<!-- Failover coverage: which of THIS host's containers the partner starts when this host is
down, and after how long. Backed by FALLBACK_<me>_TIER1-4 in this host's own conf, which
is what fallback.sh on the partner actually reads — so the picker edits the real list
rather than a second one that could disagree with it. -->
<div class="vv-card" id="vv-pt-cover-card" style="flex:1 1 300px;min-width:0;display:flex;flex-direction:column;">
<div style="display:flex;justify-content:space-between;align-items:center;">
<h3 style="margin:0;">Failover Coverage</h3>
<button id="vv-pt-cover-save" class="vv-pt-action-btn run"
onclick="vvPtSaveCover(this)" style="display:none;font-size:11px;">Save</button>
</div>
<div id="vv-pt-cover-body" style="flex:1;color:#444;font-size:12px;margin-top:8px;">Loading…</div>
</div>
<!-- Services deployed to the partner that are neither auth nor arr. These are pushed as XML
templates during onboard, so they run there rather than only starting during an outage. -->
<div class="vv-card" id="vv-pt-svc-card" style="flex:1 1 300px;min-width:0;display:flex;flex-direction:column;">
<div style="display:flex;justify-content:space-between;align-items:center;">
<h3 style="margin:0;">Shared Services</h3>
<button id="vv-pt-svc-save" class="vv-pt-action-btn run"
onclick="vvPtSaveSvc(this)" style="display:none;font-size:11px;">Save</button>
</div>
<div id="vv-pt-svc-body" style="flex:1;color:#444;font-size:12px;margin-top:8px;">Loading…</div>
<div class="vv-card" id="vv-pt-actions-card" style="flex:2 1 300px;min-width:0;">
<h3>Actions</h3>
<div id="vv-pt-actions-body" style="color:#444;font-size:12px;">Loading…</div>
</div>
</div>
@@ -778,157 +752,6 @@ function _renderXfer(x) {
</div>`;
}
// ── Failover coverage + shared services ───────────────────────────────────────
// Both cards read one endpoint and edit real conf arrays: the tiers fallback.sh consults during
// an outage, and the services stack onboard pushes. Loaded once — they are conf, not telemetry,
// and re-fetching them on the 10s poll would fight whatever the operator is mid-way through
// selecting.
let _vvLists = null, _vvListsLoaded = false;
function vvPtLoadLists() {
if (_vvListsLoaded) return;
_vvListsLoaded = true;
fetch('/plugins/varaverk/api/partnership_lists.php?_=' + Date.now())
.then(r => r.json())
.then(d => { if (d.ok) { _vvLists = d; _renderCover(); _renderSvc(); } })
.catch(() => {});
}
function _vvListRow(name, present, right) {
return `<div style="display:flex;align-items:center;justify-content:space-between;gap:8px;
padding:3px 0;border-bottom:1px solid #151515;">
<span style="font-size:11px;color:${present ? '#888' : '#5a4a2a'};overflow:hidden;
text-overflow:ellipsis;white-space:nowrap;" title="${vvEscAttr(name)}${present ? '' : ' — not on this host'}">
${vvEscHtml(name)}${present ? '' : ' <span style="color:#5a4a2a;">·absent</span>'}</span>
${right}</div>`;
}
function _renderCover() {
const el = document.getElementById('vv-pt-cover-body');
if (!el || !_vvLists) return;
const cover = _vvLists.cover || {};
const have = new Set(_vvLists.containers || []);
const names = Object.keys(cover).sort((a,b) => (cover[a]-cover[b]) || a.localeCompare(b));
let html = `<div style="font-size:9px;color:#3a3a3a;margin-bottom:6px;line-height:1.5;">
What the partner starts when this host is down. Tier 1 is immediate; 24 wait for
HOST*_TIER&lt;n&gt;_DELAY.</div>`;
html += names.length
? names.map(n => _vvListRow(n, have.has(n),
`<select class="vv-pt-cover-sel" data-name="${vvEscAttr(n)}" onchange="vvPtCoverChanged()"
style="font-size:10px;background:#0d0d0d;color:#aaa;border:1px solid #2a2a2a;border-radius:2px;">
${[1,2,3,4].map(t => `<option value="${t}"${cover[n]===t?' selected':''}>T${t}</option>`).join('')}
<option value="0">remove</option>
</select>`)).join('')
: `<div style="font-size:11px;color:#444;padding:6px 0;">Nothing covered.</div>`;
const opts = (_vvLists.containers || []).filter(c => !(c in cover));
html += `<div style="margin-top:8px;display:flex;gap:6px;align-items:center;">
<select id="vv-pt-cover-add" style="flex:1;min-width:0;font-size:10px;background:#0d0d0d;color:#aaa;
border:1px solid #2a2a2a;border-radius:2px;">
<option value="">+ add container…</option>
${opts.map(c => `<option value="${vvEscAttr(c)}">${vvEscHtml(c)}</option>`).join('')}
</select>
<button class="vv-pt-action-btn info" style="font-size:10px;" onclick="vvPtCoverAdd()">Add</button>
</div>`;
el.innerHTML = html;
}
function vvPtCoverAdd() {
const sel = document.getElementById('vv-pt-cover-add');
if (!sel || !sel.value || !_vvLists) return;
_vvLists.cover = _vvLists.cover || {};
_vvLists.cover[sel.value] = 1;
_renderCover();
vvPtCoverChanged();
}
function vvPtCoverChanged() {
document.getElementById('vv-pt-cover-save').style.display = '';
}
async function vvPtSaveCover(btn) {
const map = {};
document.querySelectorAll('.vv-pt-cover-sel').forEach(s => {
const t = parseInt(s.value, 10);
if (t >= 1 && t <= 4) map[s.dataset.name] = t; // 0 = remove, simply not sent
});
btn.disabled = true; btn.textContent = '⟳';
try {
const r = await fetch('/plugins/varaverk/api/partnership_lists.php', {
method: 'POST', headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
csrf_token: typeof csrf_token !== 'undefined' ? csrf_token : '',
action: 'cover', tiers: JSON.stringify(map),
})
});
const d = await r.json();
if (!d.ok) { vvAlert('Save failed: ' + (d.error ?? 'Unknown error')); btn.disabled = false; btn.textContent = 'Save'; return; }
btn.textContent = '✓'; _vvListsLoaded = false; vvPtLoadLists();
setTimeout(() => { btn.disabled = false; btn.textContent = 'Save'; btn.style.display = 'none'; }, 1500);
} catch (e) { btn.disabled = false; btn.textContent = 'Save'; vvAlert('Error: ' + e); }
}
function _renderSvc() {
const el = document.getElementById('vv-pt-svc-body');
if (!el || !_vvLists) return;
const cur = _vvLists.services || [];
const have = new Set(_vvLists.containers || []);
const xml = new Set(_vvLists.have_xml || []);
let html = `<div style="font-size:9px;color:#3a3a3a;margin-bottom:6px;line-height:1.5;">
Non-auth, non-arr services deployed to the partner at onboard and run there continuously.
Needs a my-&lt;name&gt;.xml template to push.</div>`;
html += cur.length
? cur.map(n => _vvListRow(n, have.has(n),
`<button class="vv-pt-action-btn warn" style="font-size:9px;opacity:.6;"
onclick="vvPtSvcRemove('${vvEscAttr(n)}')">✕</button>`)).join('')
: `<div style="font-size:11px;color:#444;padding:6px 0;">No shared services.</div>`;
const opts = (_vvLists.containers || []).filter(c => !cur.includes(c) && xml.has(c));
html += `<div style="margin-top:8px;display:flex;gap:6px;align-items:center;">
<select id="vv-pt-svc-add" style="flex:1;min-width:0;font-size:10px;background:#0d0d0d;color:#aaa;
border:1px solid #2a2a2a;border-radius:2px;">
<option value="">+ add service…</option>
${opts.map(c => `<option value="${vvEscAttr(c)}">${vvEscHtml(c)}</option>`).join('')}
</select>
<button class="vv-pt-action-btn info" style="font-size:10px;" onclick="vvPtSvcAdd()">Add</button>
</div>`;
el.innerHTML = html;
}
function vvPtSvcAdd() {
const sel = document.getElementById('vv-pt-svc-add');
if (!sel || !sel.value || !_vvLists) return;
_vvLists.services = (_vvLists.services || []).concat([sel.value]);
_renderSvc();
document.getElementById('vv-pt-svc-save').style.display = '';
}
function vvPtSvcRemove(name) {
if (!_vvLists) return;
_vvLists.services = (_vvLists.services || []).filter(n => n !== name);
_renderSvc();
document.getElementById('vv-pt-svc-save').style.display = '';
}
async function vvPtSaveSvc(btn) {
btn.disabled = true; btn.textContent = '⟳';
try {
const r = await fetch('/plugins/varaverk/api/partnership_lists.php', {
method: 'POST', headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
csrf_token: typeof csrf_token !== 'undefined' ? csrf_token : '',
action: 'services', stack: JSON.stringify(_vvLists.services || []),
})
});
const d = await r.json();
if (!d.ok) { vvAlert('Save failed: ' + (d.error ?? 'Unknown error')); btn.disabled = false; btn.textContent = 'Save'; return; }
btn.textContent = '✓'; _vvListsLoaded = false; vvPtLoadLists();
setTimeout(() => { btn.disabled = false; btn.textContent = 'Save'; btn.style.display = 'none'; }, 1500);
} catch (e) { btn.disabled = false; btn.textContent = 'Save'; vvAlert('Error: ' + e); }
}
function _renderSync(sync) {
const jobs = sync.jobs || {};
const gates = sync.gates || {};
@@ -1580,7 +1403,6 @@ function _render(data) {
_renderOfflineWarn(cfg);
// Mirror sync health
vvPtLoadLists();
_renderXfer(data.xfer || {});
document.getElementById('vv-pt-sync-body').innerHTML = _renderSync(data.sync || {});