Drop the Host Settings card now the partnership settings card covers HOST1/HOST2

It existed to render two fields that live in master.conf's HOST IDENTITIES group, which the shared renderer now includes — one settings surface for the page rather than two both editing the same file.
This commit is contained in:
Gmer4Lfe
2026-08-17 14:52:21 -04:00
parent 8cf3ff31db
commit 2216072669
2 changed files with 5 additions and 72 deletions
@@ -64,9 +64,14 @@ require_once dirname(__DIR__) . '/include/confform.php';
$files = vv_get_conf_files(); $files = vv_get_conf_files();
$out = []; $out = [];
foreach ($files as $f) { foreach ($files as $f) {
// "HOST IDENTITIES" is included alongside the partnership subsections because it holds HOST1
// and HOST2 — the hostnames the whole partnership is keyed on. They were shown by a separate
// "Host Settings" card on the partnership page, which existed only to render those two fields
// and is now redundant: one settings surface for the page, not two that both edit master.conf.
$groups = array_values(array_filter( $groups = array_values(array_filter(
vv_conf_all_groups($f), vv_conf_all_groups($f),
fn($g) => stripos($g['subsection'], 'partnership') !== false fn($g) => stripos($g['subsection'], 'partnership') !== false
|| stripos($g['subsection'], 'host identities') !== false
)); ));
if ($groups) { if ($groups) {
$out[] = ['file' => $f, 'groups' => $groups]; $out[] = ['file' => $f, 'groups' => $groups];
-72
View File
@@ -178,15 +178,6 @@ textarea.vv-pt-set-input { resize:vertical; white-space:pre; }
Collapsed together they cost one line until opened. --> Collapsed together they cost one line until opened. -->
<div id="vv-pt-settings-body" style="display:none;margin-top:10px;"> <div id="vv-pt-settings-body" style="display:none;margin-top:10px;">
<div id="vv-pt-hosts-section" style="display:none;margin-bottom:16px;">
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;">
<div class="vv-cl-title" style="margin:0;">Host settings</div>
<button id="vv-pt-hosts-save" class="vv-pt-action-btn run"
onclick="vvPtSaveHosts(this)" style="display:none;">Save</button>
</div>
<div id="vv-pt-hosts-body"></div>
</div>
<div id="vv-pt-arrays-wrap" style="display:none;margin-bottom:16px;"></div> <div id="vv-pt-arrays-wrap" style="display:none;margin-bottom:16px;"></div>
<div id="vv-pt-settings-conf"></div> <div id="vv-pt-settings-conf"></div>
@@ -388,32 +379,6 @@ function vvPtToggleSync(el, varName, enabled) {
// ── Host Settings ───────────────────────────────────────────────────────────── // ── Host Settings ─────────────────────────────────────────────────────────────
function _renderHostSettings(nodes, isOwner) {
let html = '<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px;">';
for (const n of nodes) {
const rdonly = isOwner ? '' : 'readonly style="opacity:.5;cursor:default;"';
html += `<div>
<div class="vv-pt-set-key" style="margin-bottom:4px;">${_vvSetEsc(n.id)}</div>
<input type="text" ${rdonly}
class="vv-pt-set-input vv-pt-host-inp"
data-key="${_vvSetEsc(n.id)}" data-file="master.conf" data-type="scalar"
data-orig="${_vvSetEsc(n.hostname)}"
value="${_vvSetEsc(n.hostname)}"
oninput="vvPtHostChanged(this)"
placeholder="hostname">
</div>`;
}
html += '</div>';
if (!isOwner) html += '<div style="font-size:10px;color:#333;margin-top:6px;">Editing requires host1.</div>';
return html;
}
function vvPtHostChanged(el) {
el.classList.toggle('changed', el.value !== el.dataset.orig);
const any = document.querySelector('.vv-pt-host-inp.changed');
document.getElementById('vv-pt-hosts-save').style.display = any ? '' : 'none';
}
// Stop the background media seed. Safe to press: rsync.sh runs --inplace --partial, so this // Stop the background media seed. Safe to press: rsync.sh runs --inplace --partial, so this
// costs the file in flight and a later start resumes the share rather than restarting it. // costs the file in flight and a later start resumes the share rather than restarting it.
// Phase 3 — the media seed, as its own phase rather than the tail of an onboard. Routed through // Phase 3 — the media seed, as its own phase rather than the tail of an onboard. Routed through
@@ -457,37 +422,6 @@ async function vvPtStopSeed(btn) {
} }
} }
async function vvPtSaveHosts(btn) {
const changedEls = document.querySelectorAll('.vv-pt-host-inp.changed');
if (!changedEls.length) return;
const changes = [];
changedEls.forEach(el => changes.push({key: el.dataset.key, file: el.dataset.file, type: el.dataset.type, value: el.value}));
if (!await vvConfirm(`Save ${changes.length} host setting(s)?`)) return;
btn.disabled = true; btn.textContent = '⟳ Saving…';
fetch('/plugins/varaverk/api/confform.php', {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
csrf_token: typeof csrf_token !== 'undefined' ? csrf_token : '',
id: '__settings__',
changes: JSON.stringify(changes)
})
})
.then(r => r.json())
.then(d => {
btn.disabled = false;
if (d.ok) {
changedEls.forEach(el => { el.dataset.orig = el.value; el.classList.remove('changed'); });
btn.textContent = '✓ Saved';
setTimeout(() => { btn.textContent = 'Save'; btn.style.display = 'none'; }, 2000);
} else {
btn.textContent = 'Save';
vvAlert('Save failed: ' + (d.error ?? 'Unknown error'));
}
})
.catch(e => { btn.disabled = false; btn.textContent = 'Save'; vvAlert('Error: ' + e); });
}
// ── Array settings cards ─────────────────────────────────────────────────────── // ── Array settings cards ───────────────────────────────────────────────────────
let _vvArrFiles = null; let _vvArrFiles = null;
@@ -1465,12 +1399,6 @@ function _render(data) {
// Config bar // Config bar
document.getElementById('vv-pt-config-body').innerHTML = _renderConfig(cfg); document.getElementById('vv-pt-config-body').innerHTML = _renderConfig(cfg);
// Host settings — always shown upfront
const hostsCard = document.getElementById("vv-pt-hosts-section");
hostsCard.style.display = nodes.length ? '' : 'none';
document.getElementById('vv-pt-hosts-body').innerHTML = _renderHostSettings(nodes, isOwner);
document.getElementById('vv-pt-hosts-save').style.display = 'none';
// Offline countdown warning // Offline countdown warning
_renderOfflineWarn(cfg); _renderOfflineWarn(cfg);