Add Phase 1 cancel: remove SSH keys from both sides + reset state
onboard_cancel.sh: - SSHes HOST2 while key still valid: removes HOST1 pubkey from authorized_keys and clears HOST2_PHASE* from setup.db on the remote side - Deletes local private + public key pair - Clears HOST2_PHASE* from local setup.db - Graceful if HOST2 unreachable (local side still cleaned up) partnership.php: - Cancel button (warn style, slightly dimmed) at phase 0 and phase 1 - vvPtCancel() top-level function, calls onboard_cancel.sh via run.php
This commit is contained in:
@@ -96,6 +96,16 @@ function vvPtOnboard(btn) {
|
||||
.finally(() => setTimeout(() => { btn.disabled = false; btn.textContent = '▶ Onboard (Mirror)'; }, 4000));
|
||||
}
|
||||
|
||||
function vvPtCancel(btn, hostId) {
|
||||
if (!confirm(`Cancel Phase 1 for ${hostId}?\n\nThis will:\n• Remove HOST1's SSH key from ${hostId}'s authorized_keys\n• Delete the local key pair\n• Reset phase state on both hosts\n\nContinue?`)) return;
|
||||
btn.disabled = true;
|
||||
btn.textContent = '⟳ Cancelling…';
|
||||
_vvPtRun('Partnership/onboard_cancel.sh')
|
||||
.then(d => { if (!d.ok) alert('Failed: ' + (d.error ?? 'Unknown error')); })
|
||||
.catch(e => alert('Error: ' + e))
|
||||
.finally(() => setTimeout(() => { btn.disabled = false; btn.textContent = '✕ Cancel'; }, 4000));
|
||||
}
|
||||
|
||||
function vvPtOffboard(btn) {
|
||||
if (btn.style.opacity === '0.35' || btn.style.cursor === 'default') return;
|
||||
if (!confirm('Run partnership_offboard.sh?\n\nThis will end the partnership, reconfigure WebUIs, and revoke SSH access.\n\nContinue?')) return;
|
||||
@@ -285,6 +295,11 @@ function _renderActions(nodes, cfg) {
|
||||
style="opacity:.5;">
|
||||
▶ Full Onboard
|
||||
</button>`;
|
||||
html += `<button class="vv-pt-action-btn warn" onclick="vvPtCancel(this, '${remote.id}')"
|
||||
title="Remove SSH keys from both sides and reset phase state — use if a partial Phase 1 left a stale key"
|
||||
style="opacity:.7;">
|
||||
✕ Cancel
|
||||
</button>`;
|
||||
} else if (phase === 1) {
|
||||
// Phase 1 done — waiting for HOST2 to onboard and trigger Phase 2
|
||||
html += `<span style="font-size:11px;color:#ff9800;align-self:center;">⏳ Waiting for ${remote.id} to onboard…</span>`;
|
||||
@@ -292,6 +307,10 @@ function _renderActions(nodes, cfg) {
|
||||
title="Manually trigger Phase 2 — deploy containers, arr stack, and establish partnership on ${remote.hostname}. Normally triggered automatically when ${remote.id} completes its onboard.">
|
||||
▶ Run Phase 2 Manually
|
||||
</button>`;
|
||||
html += `<button class="vv-pt-action-btn warn" onclick="vvPtCancel(this, '${remote.id}')"
|
||||
title="Remove SSH keys from both sides and reset to phase 0 — ${remote.id}'s authorized_keys will be cleaned up before the key is deleted">
|
||||
✕ Cancel
|
||||
</button>`;
|
||||
} else {
|
||||
// Phase 2 done — fully onboarded
|
||||
html += `<span style="font-size:11px;color:#4caf50;align-self:center;">✅ Partnership established</span>`;
|
||||
|
||||
Reference in New Issue
Block a user