Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
feat(cloudcp): refresh Pulse Account team state from bootstrap
rcourtmandee5a4449375
diff --git a/internal/cloudcp/portal/assets/portal.js b/internal/cloudcp/portal/assets/portal.jsindex 9c4fea09ce..7dea8266b8 100644--- a/internal/cloudcp/portal/assets/portal.js+++ b/internal/cloudcp/portal/assets/portal.js@@ -630,6 +630,7 @@ async function openBilling(accountID) {function toggleTeam(accountID) {var section = document.getElementById('team-section-' + accountID);+ if (!section) return;var visible = section.classList.contains('visible');section.classList.toggle('visible', !visible);if (!visible) loadTeam(accountID);@@ -649,6 +650,7 @@ function setTbodyMessage(tbody, msg, isError) {async function loadTeam(accountID) {var tbody = document.getElementById('team-list-' + accountID);var section = document.getElementById('team-section-' + accountID);+ if (!tbody || !section) return;var actorRole = section.getAttribute('data-actor-role') || '';var isOwner = actorRole === 'owner';setTbodyMessage(tbody, 'Loading\u2026', false);@@ -703,6 +705,20 @@ async function loadTeam(accountID) {}}+async function refreshAccountTeamSection(accountID) {+ if (!await refreshBootstrap()) {+ window.location.href = PORTAL_PATH;+ return false;+ }+ var section = document.getElementById('team-section-' + accountID);+ if (!section) {+ return true;+ }+ section.classList.add('visible');+ await loadTeam(accountID);+ return true;+}+async function inviteMember(accountID) {var emailEl = document.getElementById('invite-email-' + accountID);var roleEl = document.getElementById('invite-role-' + accountID);@@ -721,8 +737,10 @@ async function inviteMember(accountID) {return;}emailEl.value = '';+ if (!await refreshAccountTeamSection(accountID)) {+ return;+ }showToast('Member invited!');- loadTeam(accountID);} catch(e) {showToast('Network error.', true);}@@ -737,6 +755,9 @@ async function changeRole(accountID, userID, newRole) {});if (r.status === 409) { showToast('Cannot demote last owner.', true); loadTeam(accountID); return; }if (!r.ok) { showToast('Failed to update role.', true); loadTeam(accountID); return; }+ if (!await refreshAccountTeamSection(accountID)) {+ return;+ }showToast('Role updated.');} catch(e) {showToast('Network error.', true);@@ -752,8 +773,10 @@ async function removeMember(accountID, userID, email) {});if (r.status === 409) { showToast('Cannot remove last owner.', true); return; }if (!r.ok) { showToast('Failed to remove member.', true); return; }+ if (!await refreshAccountTeamSection(accountID)) {+ return;+ }showToast('Member removed.');- loadTeam(accountID);} catch(e) {showToast('Network error.', true);}diff --git a/internal/cloudcp/portal/handlers_test.go b/internal/cloudcp/portal/handlers_test.goindex b3c0678d54..137f1c7981 100644--- a/internal/cloudcp/portal/handlers_test.go+++ b/internal/cloudcp/portal/handlers_test.go@@ -810,6 +810,7 @@ func TestPortalPageTemplate_AccountServicesRendered(t *testing.T) {`fetch(LICENSE_API_BASE + '/v1/gdpr/request-delete'`,`fetch(LICENSE_API_BASE + '/v1/gdpr/confirm-delete'`,`if (!await refreshBootstrap())`,+ `refreshAccountTeamSection(accountID)`,`href="https://pulserelay.pro/refund.html?email=owner%40example.com"`,"commercial account actions now live here",}@@ -824,6 +825,9 @@ func TestPortalPageTemplate_AccountServicesRendered(t *testing.T) {if strings.Contains(html, `window.location.reload()`) {t.Errorf("expected workspace lifecycle to refresh the bootstrap contract instead of forcing a page reload")}+ if strings.Contains(html, `showToast('Member invited!');`+"\n"+` loadTeam(accountID);`) {+ t.Errorf("expected membership mutations to refresh the account bootstrap instead of only repainting the team table")+ }if strings.Contains(html, `await fetch('/auth/logout'`) {t.Errorf("expected portal paths to be renderer-owned, not hardcoded in the asset")}