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): render Pulse Account from bootstrap contract
rcourtman22e3199b81aa
diff --git a/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md b/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.mdindex 9104657955..18953eca74 100644--- a/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md+++ b/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md@@ -234,6 +234,9 @@ frontend state seam for:1. account identity context2. hosted account and workspace summaries3. public/commercial edge URLs needed by the account shell+4. the canonical bootstrap route path and stable workspace summary fields, so+ the frontend can render and refresh account/workspace state from one owned+ contract instead of depending on server-rendered DOM structureThe portal package also owns a dedicated bootstrap JSON handler shape for thesame contract, so route wiring can promote the shell toward a maintaineddiff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex f503d2e6a2..0eec99e87b 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -194,9 +194,11 @@ contract in `internal/cloudcp/portal/page.go`, `internal/cloudcp/portal/handlersand `internal/cloudcp/portal/handlers_test.go`. `/api/portal/bootstrap` andthe in-page `pulse-account-bootstrap` payload must stay shape-identical foraccount identity context, workspace summaries, and renderer-owned public,-commercial, and control-plane route configuration. New account frontend work-must extend that shared contract rather than inventing a second local payload-shape or hardcoding production URLs and route prefixes in static assets.+commercial, and control-plane route configuration, including the canonical+bootstrap route path and stable workspace summary fields such as `created_at`.+New account frontend work must extend that shared contract rather than+inventing a second local payload shape or hardcoding production URLs, route+prefixes, or DOM-scraped account facts in static assets.Hosted Pulse Cloud tenant-org AI reads now also follow that same canonicalrule: `internal/api/ai_hosted_runtime.go`, `internal/api/ai_handlers.go`,`internal/api/ai_handler.go`, and `internal/api/hosted_billing_state.go`diff --git a/internal/cloudcp/portal/assets/portal.js b/internal/cloudcp/portal/assets/portal.jsindex f212198007..2f3b9f835e 100644--- a/internal/cloudcp/portal/assets/portal.js+++ b/internal/cloudcp/portal/assets/portal.js@@ -9,10 +9,183 @@ if (bootstrapEl) {}var LICENSE_API_BASE = portalBootstrap.commercial_api_base_url || '';var PORTAL_PATH = portalBootstrap.portal_path || '/portal';+var BOOTSTRAP_PATH = portalBootstrap.bootstrap_path || '/api/portal/bootstrap';var LOGOUT_PATH = portalBootstrap.logout_path || '/auth/logout';var ACCOUNT_API_BASE_PATH = portalBootstrap.account_api_base_path || '/api/accounts';var PORTAL_API_BASE_PATH = portalBootstrap.portal_api_base_path || '/api/portal';+function escapeHTML(value) {+ return String(value || '')+ .replace(/&/g, '&')+ .replace(/</g, '<')+ .replace(/>/g, '>')+ .replace(/"/g, '"')+ .replace(/'/g, ''');+}++function escapeAttr(value) {+ return escapeHTML(value);+}++function formatWorkspaceDate(value) {+ if (!value) return '';+ var date = new Date(value);+ if (Number.isNaN(date.getTime())) return '';+ return date.toLocaleDateString(undefined, { month: 'short', day: 'numeric', year: 'numeric' });+}++function roleBadgeHTML(role) {+ if (role === 'owner') return '<span class="badge" style="background:#f1f5f9;color:#64748b">Owner</span>';+ if (role === 'admin') return '<span class="badge" style="background:#f1f5f9;color:#64748b">Admin</span>';+ if (role === 'tech') return '<span class="badge" style="background:#f1f5f9;color:#64748b">Tech</span>';+ return '';+}++function renderWorkspaceCard(account, workspace) {+ var state = String(workspace.state || '');+ var safeState = escapeHTML(state);+ var createdLabel = formatWorkspaceDate(workspace.created_at);+ var openAction = '';+ if (state === 'active') {+ openAction = '<form method="POST" action="' + escapeAttr(ACCOUNT_API_BASE_PATH + '/' + account.id + '/tenants/' + workspace.id + '/handoff') + '">' ++ '<button type="submit" class="btn-primary">Open →</button>' ++ '</form>';+ } else {+ openAction = '<span style="font-size:13px;color:#94a3b8">' + safeState + '</span>';+ }++ var manageAction = '';+ if (account.can_manage && (state === 'active' || state === 'suspended' || state === 'failed')) {+ manageAction = '<button class="btn-danger" onclick="suspendOrDelete(event,\'' + escapeAttr(account.id) + '\',\'' + escapeAttr(workspace.id) + '\',\'' + escapeAttr(state) + '\',\'' + escapeAttr(workspace.display_name) + '\')">⋯</button>';+ }++ var createdMeta = createdLabel ? '<span class="ws-created">Created ' + escapeHTML(createdLabel) + '</span>' : '';+ return '' ++ '<div class="workspace-card">' ++ '<div class="ws-info">' ++ '<span class="ws-name">' + escapeHTML(workspace.display_name) + '</span>' ++ '<div class="ws-meta">' ++ (workspace.healthy+ ? '<span class="badge badge-healthy">Healthy</span>'+ : '<span class="badge badge-unhealthy">Checking</span>') ++ '<span class="badge badge-' + safeState + '">' + safeState + '</span>' ++ createdMeta ++ '</div>' ++ '</div>' ++ '<div class="ws-actions">' ++ openAction ++ manageAction ++ '</div>' ++ '</div>';+}++function renderAccountSection(account) {+ var workspaces = Array.isArray(account.workspaces) ? account.workspaces : [];+ var workspaceHTML = '';+ if (workspaces.length === 0) {+ workspaceHTML = '<div class="empty-state"><p>No workspaces yet. Create one to get started.</p></div>';+ } else {+ workspaceHTML = '<div class="workspace-list">' + workspaces.map(function(workspace) {+ return renderWorkspaceCard(account, workspace);+ }).join('') + '</div>';+ }++ var actions = '';+ var teamSection = '';+ var addWorkspaceForm = '';+ if (account.can_manage) {+ actions = '<div class="account-actions">' ++ (account.kind === 'msp'+ ? '<button class="btn-secondary" id="add-ws-btn-' + escapeAttr(account.id) + '" onclick="toggleAddWorkspace(\'' + escapeAttr(account.id) + '\')">+ Add workspace</button>'+ : '') ++ (account.has_billing+ ? '<button class="btn-secondary" onclick="openBilling(\'' + escapeAttr(account.id) + '\')">Manage billing</button>'+ : '') ++ '<button class="btn-secondary" id="team-btn-' + escapeAttr(account.id) + '" onclick="toggleTeam(\'' + escapeAttr(account.id) + '\',\'' + escapeAttr(account.role) + '\')">Manage team</button>' ++ '</div>';++ teamSection = '' ++ '<div class="team-section" id="team-section-' + escapeAttr(account.id) + '" data-actor-role="' + escapeAttr(account.role) + '">' ++ '<h3>Team members</h3>' ++ '<table class="team-table">' ++ '<thead><tr><th>Email</th><th>Role</th><th></th></tr></thead>' ++ '<tbody id="team-list-' + escapeAttr(account.id) + '">' ++ '<tr><td colspan="3" style="color:#94a3b8;text-align:center;padding:16px">Loading…</td></tr>' ++ '</tbody>' ++ '</table>' ++ '<div class="team-invite">' ++ '<div><label for="invite-email-' + escapeAttr(account.id) + '">Email</label><input type="email" id="invite-email-' + escapeAttr(account.id) + '" placeholder="[email protected]" autocomplete="off"></div>' ++ '<div><label for="invite-role-' + escapeAttr(account.id) + '">Role</label><select id="invite-role-' + escapeAttr(account.id) + '"><option value="admin">Admin</option><option value="tech">Tech</option><option value="read_only">Read-only</option></select></div>' ++ '<button class="btn-primary" style="padding:8px 14px;font-size:13px" onclick="inviteMember(\'' + escapeAttr(account.id) + '\')">Invite</button>' ++ '</div>' ++ '</div>';++ if (account.kind === 'msp') {+ addWorkspaceForm = '' ++ '<div class="add-workspace-form" id="add-ws-form-' + escapeAttr(account.id) + '">' ++ '<label for="ws-name-' + escapeAttr(account.id) + '">Workspace name (e.g. client name)</label>' ++ '<input type="text" id="ws-name-' + escapeAttr(account.id) + '" placeholder="Acme Corp" maxlength="80" autocomplete="off">' ++ '<div class="form-actions">' ++ '<button class="btn-primary" onclick="createWorkspace(\'' + escapeAttr(account.id) + '\')">Create workspace</button>' ++ '<button class="btn-secondary" onclick="toggleAddWorkspace(\'' + escapeAttr(account.id) + '\')">Cancel</button>' ++ '<div class="spinner" id="ws-spinner-' + escapeAttr(account.id) + '"></div>' ++ '</div>' ++ '</div>';+ }+ }++ return '' ++ '<section class="account-section">' ++ '<div class="account-header">' ++ '<h2>' + escapeHTML(account.name) + '</h2>' ++ '<span class="badge badge-' + escapeHTML(account.kind) + '">' + escapeHTML(account.kind_label) + '</span>' ++ roleBadgeHTML(account.role) ++ '</div>' ++ workspaceHTML ++ actions ++ teamSection ++ addWorkspaceForm ++ '</section>';+}++function renderAccounts(accounts) {+ var root = document.getElementById('accounts-root');+ if (!root) return;+ var safeAccounts = Array.isArray(accounts) ? accounts : [];+ if (safeAccounts.length === 0) {+ root.innerHTML = '' ++ '<div class="empty-state" style="margin-top:48px">' ++ '<p>No workspaces found. If you just signed up, check your email for setup instructions.</p>' ++ '<p style="margin-top:12px;font-size:13px">Need help? Contact <a href="mailto:' + escapeAttr(portalBootstrap.support_email || '') + '" style="color:#1d4ed8">' + escapeHTML(portalBootstrap.support_email || '') + '</a></p>' ++ '</div>';+ return;+ }+ root.innerHTML = safeAccounts.map(renderAccountSection).join('');+}++function applyBootstrap(data) {+ portalBootstrap = data || {};+ LICENSE_API_BASE = portalBootstrap.commercial_api_base_url || LICENSE_API_BASE;+ PORTAL_PATH = portalBootstrap.portal_path || PORTAL_PATH;+ BOOTSTRAP_PATH = portalBootstrap.bootstrap_path || BOOTSTRAP_PATH;+ LOGOUT_PATH = portalBootstrap.logout_path || LOGOUT_PATH;+ ACCOUNT_API_BASE_PATH = portalBootstrap.account_api_base_path || ACCOUNT_API_BASE_PATH;+ PORTAL_API_BASE_PATH = portalBootstrap.portal_api_base_path || PORTAL_API_BASE_PATH;+ renderAccounts(portalBootstrap.accounts || []);+}++async function refreshBootstrap() {+ if (!BOOTSTRAP_PATH) return;+ try {+ var response = await fetch(BOOTSTRAP_PATH, {+ headers: { 'Accept': 'application/json' }+ });+ if (!response.ok) return;+ var data = await response.json();+ applyBootstrap(data);+ } catch (_) {}+}+function showToast(msg, isError) {var t = document.getElementById('toast');t.textContent = msg;@@ -30,6 +203,9 @@ document.getElementById('logout-btn').onclick = async function() {window.location.href = PORTAL_PATH;};+applyBootstrap(portalBootstrap);+refreshBootstrap();+function toggleServicePanel(panelID) {var panels = ['manage-service-panel', 'retrieve-service-panel', 'refund-service-panel', 'data-service-panel'];for (var i = 0; i < panels.length; i++) {diff --git a/internal/cloudcp/portal/bootstrap.go b/internal/cloudcp/portal/bootstrap.goindex 3c096ba421..0e098683fd 100644--- a/internal/cloudcp/portal/bootstrap.go+++ b/internal/cloudcp/portal/bootstrap.go@@ -3,6 +3,7 @@ package portalimport ("encoding/json""html/template"+ "time")type BootstrapWorkspace struct {@@ -10,6 +11,7 @@ type BootstrapWorkspace struct {DisplayName string `json:"display_name"`State string `json:"state"`Healthy bool `json:"healthy"`+ CreatedAt string `json:"created_at"`}type BootstrapAccount struct {@@ -29,6 +31,7 @@ type BootstrapData struct {SupportEmail string `json:"support_email"`CommercialAPIBaseURL string `json:"commercial_api_base_url"`PortalPath string `json:"portal_path"`+ BootstrapPath string `json:"bootstrap_path"`LogoutPath string `json:"logout_path"`AccountAPIBasePath string `json:"account_api_base_path"`PortalAPIBasePath string `json:"portal_api_base_path"`@@ -53,6 +56,7 @@ func BuildBootstrapData(email string, accounts []portalPageAccount) BootstrapDatDisplayName: workspace.DisplayName,State: workspace.State,Healthy: workspace.Healthy,+ CreatedAt: workspace.CreatedAt.UTC().Format(time.RFC3339),})}bootstrapAccounts = append(bootstrapAccounts, BootstrapAccount{@@ -73,6 +77,7 @@ func BuildBootstrapData(email string, accounts []portalPageAccount) BootstrapDatSupportEmail: defaultSupportEmail,CommercialAPIBaseURL: defaultCommercialAPIBaseURL,PortalPath: defaultPortalPath,+ BootstrapPath: PortalBootstrapPath,LogoutPath: defaultLogoutPath,AccountAPIBasePath: defaultAccountAPIBasePath,PortalAPIBasePath: defaultPortalAPIBasePath,diff --git a/internal/cloudcp/portal/handlers_test.go b/internal/cloudcp/portal/handlers_test.goindex 6c6de6c5b1..d17baf0810 100644--- a/internal/cloudcp/portal/handlers_test.go+++ b/internal/cloudcp/portal/handlers_test.go@@ -728,7 +728,6 @@ func TestPortalPageTemplate_TeamManagementHiddenForNonManagers(t *testing.T) {`id="team-btn-a_readonly"`,`id="team-section-a_readonly"`,`id="invite-email-a_readonly"`,- "Team members",}for _, needle := range mustNotContain {if strings.Contains(html, needle) {@@ -784,9 +783,11 @@ func TestPortalPageTemplate_AccountServicesRendered(t *testing.T) {mustContain := []string{"<title>Pulse Account</title>","Pulse Account",+ `id="accounts-root"`,`id="pulse-account-bootstrap"`,`"commercial_api_base_url":"https://license.pulserelay.pro"`,fmt.Sprintf(`"portal_path":"%s"`, PortalPagePath),+ fmt.Sprintf(`"bootstrap_path":"%s"`, PortalBootstrapPath),fmt.Sprintf(`"logout_path":"%s"`, PortalLogoutPath),fmt.Sprintf(`"account_api_base_path":"%s"`, PortalAccountAPIBasePath),fmt.Sprintf(`"portal_api_base_path":"%s"`, PortalAPIBasePath),@@ -862,6 +863,9 @@ func TestBuildPortalBootstrapJSON_Contract(t *testing.T) {if got := payload["portal_path"]; got != PortalPagePath {t.Fatalf("portal_path = %#v", got)}+ if got := payload["bootstrap_path"]; got != PortalBootstrapPath {+ t.Fatalf("bootstrap_path = %#v", got)+ }if got := payload["logout_path"]; got != PortalLogoutPath {t.Fatalf("logout_path = %#v", got)}@@ -901,6 +905,9 @@ func TestBuildPortalBootstrapJSON_Contract(t *testing.T) {if got := workspace["healthy"]; got != true {t.Fatalf("workspace healthy = %#v", got)}+ if got := workspace["created_at"]; got != "0001-01-01T00:00:00Z" {+ t.Fatalf("workspace created_at = %#v", got)+ }}func TestHandlePortalBootstrap_Success(t *testing.T) {@@ -936,6 +943,9 @@ func TestHandlePortalBootstrap_Success(t *testing.T) {if got := payload["portal_api_base_path"]; got != PortalAPIBasePath {t.Fatalf("portal_api_base_path = %#v", got)}+ if got := payload["bootstrap_path"]; got != PortalBootstrapPath {+ t.Fatalf("bootstrap_path = %#v", got)+ }accounts, ok := payload["accounts"].([]any)if !ok || len(accounts) != 1 {t.Fatalf("accounts = %#v", payload["accounts"])@@ -955,6 +965,9 @@ func TestHandlePortalBootstrap_Success(t *testing.T) {if got := workspace["display_name"]; got != "Bootstrap Workspace" {t.Fatalf("workspace display_name = %#v", got)}+ if got := workspace["created_at"]; got != "2026-03-25T10:00:00Z" {+ t.Fatalf("workspace created_at = %#v", got)+ }}func TestHandlePortalBootstrap_RequiresAuth(t *testing.T) {diff --git a/internal/cloudcp/portal/templates/portal.html b/internal/cloudcp/portal/templates/portal.htmlindex 320db382ad..94dd375145 100644--- a/internal/cloudcp/portal/templates/portal.html+++ b/internal/cloudcp/portal/templates/portal.html@@ -21,11 +21,12 @@<h1>Pulse Account</h1><p>Manage Cloud workspaces, MSP access, and self-hosted commercial account services from one account surface. Hosted workspace lifecycle lives here today, and the self-hosted billing, license recovery, refund, and privacy tools below now share the same Pulse Account shell instead of staying fragmented across public utility pages.</p></section>+ <div id="accounts-root">{{if eq (len .Accounts) 0}}- <div class="empty-state" style="margin-top:48px">- <p>No workspaces found. If you just signed up, check your email for setup instructions.</p>- <p style="margin-top:12px;font-size:13px">Need help? Contact <a href="mailto:{{.SupportEmail}}" style="color:#1d4ed8">{{.SupportEmail}}</a></p>- </div>+ <div class="empty-state" style="margin-top:48px">+ <p>No workspaces found. If you just signed up, check your email for setup instructions.</p>+ <p style="margin-top:12px;font-size:13px">Need help? Contact <a href="mailto:{{.SupportEmail}}" style="color:#1d4ed8">{{.SupportEmail}}</a></p>+ </div>{{else}}{{range $ai, $account := .Accounts}}<section class="account-section">@@ -113,6 +114,7 @@</section>{{end}}{{end}}+ </div><section class="service-section"><div class="service-header">