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
Make portal task sections action-first
rcourtman9810ab60fec6
diff --git a/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md b/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.mdindex 5abdae1da2..6ce2974106 100644--- a/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md+++ b/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md@@ -159,6 +159,14 @@ Core rules:17. When `Workspaces` or `Access` are unavailable, the tab must show anexplicit unavailable state that points to the right live task instead ofrendering blank space.+18. `Access` must stay action-first: roster, invite, role change, and remove+ access are the job; view-only users may review the roster but must never+ see live controls that imply they can mutate it.+19. `Billing` must present one obvious billing path at a time, with hosted+ billing first when applicable and self-hosted licenses, refunds, or+ privacy as secondary job-specific paths rather than a billing essay.+20. `Support` must explain only when to escalate and what to send so it reads+ as a handoff path, not a competing task surface.## Screen Model@@ -188,9 +196,15 @@ Each signed-in state should render:fleet status3. an explicit `Workspaces` area for open, create, and lifecycle actions4. an explicit `Access` area for roster, invites, role changes, and removals+ `Access` copy should stay terse and task-led; the section exists to do the+ roster job, not to teach Pulse's internal role model at length.5. an explicit `Billing` area that leads with hosted billing when applicableand nests self-hosted commercial utilities only when relevant+ `Billing` should default to a single obvious task picker, not a broad+ dashboard of overlapping billing explanations.6. a `Support` area that is present only as an escalation path+ `Support` should collapse to failed-path routing plus the minimum escalation+ packet needed for handoff.7. explicit action groups, not anonymous menu affordances8. explicit unavailable-state panels for top-level tasks that are not activefor the current account shapediff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.mdindex 31fbf6048b..ceecbfeac5 100644--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md@@ -822,6 +822,10 @@ standalone Relay portal. That shell now also owns two product rulesexplicitly: `Overview` is one shell-level triage surface across the currentaccount set rather than a repeated per-account dashboard, and unavailabletop-level `Workspaces` or `Access` tasks must render an explicit unavailable-state instead of blank space. Until that candidate lane lands, new commercial-account work must extend the governed Pulse account shape rather than spawning-additional one-off recovery or billing pages.+state instead of blank space. The same shell also owns action-first task+surfaces for `Access`, `Billing`, and `Support`: access mutations must be+permission-honest and roster-led, billing must reduce to one obvious job at a+time with hosted billing first when relevant, and support must stay a failed+path handoff rather than a peer workflow. Until that candidate lane lands, new+commercial account work must extend the governed Pulse account shape rather+than spawning additional one-off recovery or billing pages.diff --git a/internal/cloudcp/portal/dist/build_manifest.json b/internal/cloudcp/portal/dist/build_manifest.jsonindex 6903ef965e..1eada6dcb0 100644--- a/internal/cloudcp/portal/dist/build_manifest.json+++ b/internal/cloudcp/portal/dist/build_manifest.json@@ -1,5 +1,5 @@{- "source_hash": "f8db7b472d42dd5ea5f8591220a731d899c84dbc04dba76527445e5f9b86587d",+ "source_hash": "f81f84c69040e458ed52e4d489cbd96781beb09acd1a6a552015a4abbc7554f1","build_inputs": ["package.json","tsconfig.json",diff --git a/internal/cloudcp/portal/dist/portal_app.js b/internal/cloudcp/portal/dist/portal_app.jsindex e6cbb00f0b..2ebbd4cc2e 100644--- a/internal/cloudcp/portal/dist/portal_app.js+++ b/internal/cloudcp/portal/dist/portal_app.js@@ -176,7 +176,7 @@}return count;}- function renderAccessStats(accountID, entry) {+ function renderAccessStats(accountID, entry, canManage) {var stats = getElement("access-stats-" + accountID);if (!stats) return;if (!entry.accessVisible) {@@ -184,11 +184,11 @@return;}if (entry.accessQuery.status === "loading") {- stats.innerHTML = '<div class="access-stat-card"><span class="access-stat-label">Roster</span><span class="access-stat-value">Loading\u2026</span></div><div class="access-stat-card"><span class="access-stat-label">Invites</span><span class="access-stat-value">Ready</span></div>';+ stats.innerHTML = '<div class="access-stat-card"><span class="access-stat-label">Roster</span><span class="access-stat-value">Loading\u2026</span></div><div class="access-stat-card"><span class="access-stat-label">Mode</span><span class="access-stat-value">' + (canManage ? "Manage" : "View") + "</span></div>";return;}if (entry.accessQuery.status === "error") {- stats.innerHTML = '<div class="access-stat-card"><span class="access-stat-label">Roster</span><span class="access-stat-value access-stat-error">Needs attention</span></div><div class="access-stat-card"><span class="access-stat-label">Fallback</span><span class="access-stat-value">Invite only</span></div>';+ stats.innerHTML = '<div class="access-stat-card"><span class="access-stat-label">Roster</span><span class="access-stat-value access-stat-error">Needs attention</span></div><div class="access-stat-card"><span class="access-stat-label">Mode</span><span class="access-stat-value">' + (canManage ? "Manage" : "View") + "</span></div>";return;}var members = entry.accessQuery.data;@@ -199,9 +199,16 @@cell.className = "access-control-cell " + className;return cell;}- function renderAccessRoleControl(accountID, member, isOwner) {+ function renderAccessRoleControl(accountID, member, isOwner, canManage) {var currentRole = normalizedAccessRole(member.role);var group = createAccessControlCell("access-control-cell-role");+ if (!canManage) {+ var badge = document.createElement("span");+ badge.className = "access-role-badge";+ badge.textContent = roleLabel(currentRole);+ group.appendChild(badge);+ return group;+ }if (currentRole === "owner" && !isOwner) {var locked = document.createElement("span");locked.className = "access-role-badge";@@ -225,7 +232,15 @@group.appendChild(sel);return group;}- function renderAccessMemberAction(accountID, member, isOwner) {+ function renderAccessMemberAction(accountID, member, isOwner, canManage) {+ if (!canManage) {+ var readonly = createAccessControlCell("access-control-cell-access");+ var readonlyText = document.createElement("span");+ readonlyText.className = "access-control-locked";+ readonlyText.textContent = "View only";+ readonly.appendChild(readonlyText);+ return readonly;+ }if (normalizedAccessRole(member.role) === "owner" && !isOwner) {var locked = createAccessControlCell("access-control-cell-access");var lockedText = document.createElement("span");@@ -246,7 +261,7 @@group.appendChild(btn);return group;}- function renderAccessMemberRow(accountID, member, isOwner) {+ function renderAccessMemberRow(accountID, member, isOwner, canManage) {var row = document.createElement("div");row.className = "access-member-row";var identity = document.createElement("div");@@ -267,8 +282,8 @@caption.textContent = roleCapabilityCopy(member.role);identity.appendChild(caption);row.appendChild(identity);- row.appendChild(renderAccessRoleControl(accountID, member, isOwner));- row.appendChild(renderAccessMemberAction(accountID, member, isOwner) || createAccessControlCell("access-control-cell-access"));+ row.appendChild(renderAccessRoleControl(accountID, member, isOwner, canManage));+ row.appendChild(renderAccessMemberAction(accountID, member, isOwner, canManage) || createAccessControlCell("access-control-cell-access"));return row;}function ensureAccessRosterHead(container) {@@ -295,8 +310,9 @@var rosterPanel = roster.closest(".access-roster");var actorRole = section.getAttribute("data-actor-role") || "";var isOwner = actorRole === "owner";+ var canManage = section.getAttribute("data-can-manage") === "true";section.classList.toggle("visible", entry.accessVisible);- renderAccessStats(accountID, entry);+ renderAccessStats(accountID, entry, canManage);if (!entry.accessVisible) {return;}@@ -312,7 +328,12 @@}if (!entry.accessQuery.data.length) {if (rosterPanel) rosterPanel.classList.add("state-only");- setContainerMessage(roster, "No one added yet", "Invite someone new when this account needs shared access.", false);+ setContainerMessage(+ roster,+ "No one added yet",+ canManage ? "Invite someone when this hosted account needs shared access." : "There is no hosted roster to review yet on this account.",+ false+ );return;}roster.textContent = "";@@ -321,7 +342,7 @@ensureAccessRosterHead(roster);for (var i = 0; i < entry.accessQuery.data.length; i += 1) {var member = entry.accessQuery.data[i];- roster.appendChild(renderAccessMemberRow(accountID, member, isOwner));+ roster.appendChild(renderAccessMemberRow(accountID, member, isOwner, canManage));}}function renderAccountUI(accountState, accounts) {@@ -2031,14 +2052,12 @@]) + '</div><div class="account-stage-header-actions">' + workspaceHeaderActions + '</div></div></div><div class="workspace-operations-shell workspace-operations-shell-idle" id="workspace-operations-shell-' + escapeAttr(account.id) + '"><div class="workspace-operations-main">' + workspaceHTML + '</div><div class="workspace-operations-detail" id="workspace-operations-detail-' + escapeAttr(account.id) + '">' + workspaceManagement + "</div></div></section>";}function renderAccountAccessSection(account) {- var accessPolicy = '<div class="access-policy-panel"><div class="access-panel-heading"><h4>Role rules</h4><p>Invite the smallest role that still lets someone do the work they actually own on this account.</p></div><div class="access-policy-list"><div class="access-policy-row"><strong>Owner</strong><span>Billing, access control, and full account control.</span></div><div class="access-policy-row"><strong>Admin</strong><span>Workspace control plus billing for the account.</span></div><div class="access-policy-row"><strong>Tech</strong><span>Workspace control without billing ownership.</span></div><div class="access-policy-row"><strong>Read-only</strong><span>Workspace review and verification without control-plane changes.</span></div></div></div>';- var reviewDesk = '<div class="access-review-shell"><div class="access-review-strip"><div class="access-panel-heading access-panel-heading-tight"><div class="account-panel-kicker">Access review</div><h4>Keep access explicit</h4><p>Use the roster as a controlled access list, not a vague shared bucket.</p></div><div class="access-review-grid"><div class="access-review-card"><strong>Owners stay rare</strong><span>Reserve Owner for billing, access control, and full account control. Default to Admin, Tech, or Read-only first.</span></div><div class="access-review-card"><strong>Keep access narrow</strong><span>Use Tech for workspace control and Read-only for verification instead of handing out broader access.</span></div><div class="access-review-card"><strong>Remove stale access fast</strong><span>If someone no longer owns the work, remove them instead of leaving dormant access attached to the account.</span></div></div></div></div>';- return '<section class="account-content-panel account-content-panel-access"><section class="access-management-panel access-section access-section-shell" id="access-section-' + escapeAttr(account.id) + '" data-actor-role="' + escapeAttr(account.role) + '"><div class="access-management-header"><div><div class="account-panel-kicker">Access</div><h3>People and roles</h3><p>Invite people, change roles, and remove stale access without mixing that work into workspace operations.</p>' + renderSectionContextChips([- account.can_manage ? "Managed roster" : "View only",- "Invite",- "Roles",- "Remove access"- ]) + '</div><button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="workspaces">Back to workspaces</button></div><div class="access-management-stats" id="access-stats-' + escapeAttr(account.id) + '"></div><div class="access-management-grid"><div class="access-roster-column"><div class="access-roster"><div class="access-panel-heading"><h4>People on this account</h4><p>Every person here can reach this hosted account. Keep the list small and the role choice explicit.</p></div><div class="access-roster-list" id="access-list-' + escapeAttr(account.id) + '"><div class="access-list-message">Loading\u2026</div></div></div>' + reviewDesk + '</div><div class="access-side-column"><div class="access-operations-panel"><div class="access-panel-heading access-panel-heading-tight"><div class="account-panel-kicker">Access controls</div><h4>Invite, role, remove</h4><p>Use this column when you need to add someone, tighten a role, or remove access that no longer belongs here.</p></div><div class="access-operations-grid"><div class="access-invite-panel"><div class="access-panel-heading"><h4>Invite someone new</h4><p>Add a person with the minimum role they need for this account.</p></div><div class="access-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 type="button" class="btn-primary btn-compact" data-action="invite-member" data-account-id="' + escapeAttr(account.id) + '">Invite</button></div></div>' + accessPolicy + "</div></div></div></div></section></section>";+ var accessHeaderTitle = account.can_manage ? "Manage access" : "Review access";+ var accessHeaderCopy = account.can_manage ? "Invite people, change roles, and remove stale access from one hosted roster." : "Review who already has access to this hosted account. An owner or admin must make changes.";+ var accessContextChips = account.can_manage ? ["Invite people", "Change roles", "Remove access"] : ["View roster", "Owner or admin required"];+ var accessPolicy = '<div class="access-policy-panel"><div class="access-panel-heading"><h4>' + (account.can_manage ? "Choose the smallest role" : "Role meanings") + "</h4><p>" + (account.can_manage ? "Match each person to the narrowest role that still lets them do the job they own." : "Use these role meanings to understand what each person on this roster can do.") + '</p></div><div class="access-policy-list"><div class="access-policy-row"><strong>Owner</strong><span>Full account, billing, and access control.</span></div><div class="access-policy-row"><strong>Admin</strong><span>Workspace control, billing, and roster management.</span></div><div class="access-policy-row"><strong>Tech</strong><span>Workspace control without billing or roster ownership.</span></div><div class="access-policy-row"><strong>Read-only</strong><span>Review access without control-plane changes.</span></div></div></div>';+ var accessActions = account.can_manage ? '<div class="access-invite-panel"><div class="access-panel-heading"><h4>Invite people</h4><p>Add one person with the minimum role they need on this account.</p></div><div class="access-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 type="button" class="btn-primary btn-compact" data-action="invite-member" data-account-id="' + escapeAttr(account.id) + '">Invite</button></div></div>' : '<div class="access-invite-panel"><div class="access-panel-heading"><h4>Need an access change?</h4><p>An owner or admin on this account must invite people, change roles, or remove access.</p></div></div>';+ return '<section class="account-content-panel account-content-panel-access"><section class="access-management-panel access-section access-section-shell" id="access-section-' + escapeAttr(account.id) + '" data-actor-role="' + escapeAttr(account.role) + '" data-can-manage="' + escapeAttr(account.can_manage ? "true" : "false") + '"><div class="access-management-header"><div><div class="account-panel-kicker">Access</div><h3>' + accessHeaderTitle + "</h3><p>" + accessHeaderCopy + "</p>" + renderSectionContextChips(accessContextChips) + '</div><button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="workspaces">Back to workspaces</button></div><div class="access-management-stats" id="access-stats-' + escapeAttr(account.id) + '"></div><div class="access-management-grid"><div class="access-roster-column"><div class="access-roster"><div class="access-panel-heading"><h4>People on this account</h4><p>Review the hosted roster here before you open, change, or remove access.</p></div><div class="access-roster-list" id="access-list-' + escapeAttr(account.id) + '"><div class="access-list-message">Loading\u2026</div></div></div></div><div class="access-side-column"><div class="access-operations-panel"><div class="access-panel-heading access-panel-heading-tight"><div class="account-panel-kicker">Next action</div><h4>' + (account.can_manage ? "Pick the access job" : "This account is view-only for you") + "</h4><p>" + (account.can_manage ? "Use this column to invite people, tighten roles, or remove access that no longer belongs here." : "You can review the roster here, but access changes must be done by an owner or admin.") + '</p></div><div class="access-operations-grid">' + accessActions + accessPolicy + "</div></div></div></div></section></section>";}function renderHostedBillingCards(accounts) {var hostedBillingAccounts = accounts.filter(function(account) {@@ -2053,7 +2072,7 @@}).join("");}function renderSupportSection(context) {- return '<section class="portal-support-panel"><div class="account-panel-kicker">Support</div><h2>Escalation</h2><p>Come here only after the workspace, access, or billing path has stopped you.</p>' + renderSectionContextChips(["Escalation only", "Bring context", context.bootstrap.support_email ? "Email" : "Support"]) + '<div class="portal-support-layout"><div class="portal-support-route-grid"><div class="portal-support-route-card"><div class="account-panel-kicker">Hosted account</div><h3>Hosted problems</h3><p>Use support for hosted issues only after you have already tried the Workspaces or Access path.</p><div class="portal-support-points"><div class="portal-support-point"><strong>Use after the hosted path fails</strong><span>Workspace access, lifecycle, and account access should already be narrowed before you escalate.</span></div><div class="portal-support-point"><strong>Keep the account context intact</strong><span>Include the account, workspace, and action that failed so support can pick up the same issue quickly.</span></div></div><div class="portal-support-actions"><button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="workspaces">Open workspaces</button><button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="access">Open access</button><a class="portal-support-link" href="mailto:' + escapeAttr(context.bootstrap.support_email || "") + '">' + escapeHTML(context.bootstrap.support_email || "") + '</a></div></div><div class="portal-support-route-card"><div class="account-panel-kicker">Billing</div><h3>Billing and self-hosted issues</h3><p>Use this route only after hosted billing or the self-hosted billing tools have failed to complete the request cleanly.</p><div class="portal-support-points"><div class="portal-support-point"><strong>Start in Billing</strong><span>Hosted billing, licenses, refunds, and privacy should already be narrowed to one failed request.</span></div><div class="portal-support-point"><strong>Escalate from the same path</strong><span>Bring the billing tool or hosted billing action that failed instead of reopening the story from scratch.</span></div></div><div class="portal-support-actions"><button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="billing">Open billing</button><a class="portal-support-link" href="mailto:' + escapeAttr(context.bootstrap.support_email || "") + '">' + escapeHTML(context.bootstrap.support_email || "") + '</a></div></div></div><div class="portal-support-runbook"><div class="account-panel-kicker">Escalation packet</div><h3>What to send</h3><p>Keep the packet short and concrete so support can pick up the exact failed path immediately.</p><div class="portal-support-runbook-list"><div class="portal-support-runbook-step"><strong>1. Name the path</strong><span>Say whether the failed path was Workspaces, Access, or Billing.</span></div><div class="portal-support-runbook-step"><strong>2. Name the account</strong><span>Include the hosted account and workspace when relevant, or the billing email for self-hosted work.</span></div><div class="portal-support-runbook-step"><strong>3. Name the action</strong><span>Include the exact button, form, or billing tool that failed and what happened next.</span></div></div></div></div></section>';+ return '<section class="portal-support-panel"><div class="account-panel-kicker">Support</div><h2>Escalation only</h2><p>Use support only when the Workspaces, Access, or Billing path has already stopped you.</p>' + renderSectionContextChips(["Escalation only", "Bring context", context.bootstrap.support_email ? "Email" : "Support"]) + '<div class="portal-support-layout"><div class="portal-support-route-grid"><div class="portal-support-route-card"><div class="account-panel-kicker">Hosted path</div><h3>Workspace or access path failed</h3><p>Go back to the hosted task first. Escalate only when the same workspace or access path still cannot finish the job.</p><div class="portal-support-points"><div class="portal-support-point"><strong>Start from the same task</strong><span>Use Workspaces for lifecycle issues and Access for roster issues before you escalate.</span></div><div class="portal-support-point"><strong>Keep the hosted context intact</strong><span>Include the account, workspace, and failed action so support inherits the same request.</span></div></div><div class="portal-support-actions"><button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="workspaces">Open workspaces</button><button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="access">Open access</button><a class="portal-support-link" href="mailto:' + escapeAttr(context.bootstrap.support_email || "") + '">' + escapeHTML(context.bootstrap.support_email || "") + '</a></div></div><div class="portal-support-route-card"><div class="account-panel-kicker">Billing path</div><h3>Billing path failed</h3><p>Use this route only after hosted billing or one self-hosted billing job has failed to complete cleanly.</p><div class="portal-support-points"><div class="portal-support-point"><strong>Name the billing job</strong><span>Say whether the failed path was hosted billing, licenses, refunds, or privacy.</span></div><div class="portal-support-point"><strong>Keep the request intact</strong><span>Bring the same account or billing email and the failed action instead of reopening the story.</span></div></div><div class="portal-support-actions"><button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="billing">Open billing</button><a class="portal-support-link" href="mailto:' + escapeAttr(context.bootstrap.support_email || "") + '">' + escapeHTML(context.bootstrap.support_email || "") + '</a></div></div></div><div class="portal-support-runbook"><div class="account-panel-kicker">What to send</div><h3>Keep the escalation short</h3><p>Support should inherit the same request, not reconstruct it from scratch.</p><div class="portal-support-runbook-list"><div class="portal-support-runbook-step"><strong>1. Failed path</strong><span>Say whether the blocked path was Workspaces, Access, hosted billing, licenses, refunds, or privacy.</span></div><div class="portal-support-runbook-step"><strong>2. Account or email</strong><span>Include the hosted account and workspace when relevant, or the commercial billing email for self-hosted work.</span></div><div class="portal-support-runbook-step"><strong>3. Failed action</strong><span>Name the exact button, form, or billing step that failed and what happened next.</span></div></div></div></div></section>';}function renderHeaderHTML(context) {if (context.bootstrap.authenticated) {@@ -2068,14 +2087,14 @@var hostedBillingCount = accounts.filter(function(account) {return account.has_billing;}).length;- var billingNote = hosted ? "Hosted billing lives here when it applies. Self-hosted licenses, refunds, and privacy stay separate underneath it." : "Use this billing surface for self-hosted subscriptions, licenses, refunds, and privacy requests.";+ var billingNote = hosted ? "Use hosted billing first when the request belongs to a hosted workspace account. Self-hosted licenses, refunds, and privacy stay separate underneath it." : "Use this billing surface only for self-hosted subscriptions, licenses, refunds, and privacy requests.";var hostedContent = accounts.length ? accounts.map(function(account) {return '<section class="account-surface"><div class="account-surface-body">' + renderAccountWorkspaceSection(account, context.accountAPIBasePath) + renderAccountAccessSection(account) + "</div></section>";}).join("") : renderNoHostedWorkspacesSection() + renderNoHostedAccessSection();return '<div class="portal-shell" data-shell-section="' + activeSection + '"><div class="portal-shell-layout">' + renderShellNavigation(accounts, context.bootstrap.support_email || "", activeSection) + '<div class="portal-shell-main">' + (accounts.length === 1 ? renderAccountContextStrip(accounts[0]) : "") + '<section class="portal-content-panel portal-content-panel-overview">' + renderShellOverviewSection(context) + '<div id="accounts-root">' + hostedContent + '</div></section><section class="portal-content-panel portal-content-panel-billing billing-section" id="billing-section"><div class="billing-header"><div><div class="account-panel-kicker">Billing</div><h2>Billing</h2>' + renderSectionContextChips([hostedBillingCount > 0 ? "Hosted billing" : "No hosted billing","Self-hosted tools"- ]) + '</div><div class="billing-note">' + billingNote + '</div></div><div class="billing-overview-grid">' + renderHostedBillingCards(accounts) + '</div><div class="billing-shell"><aside class="billing-shell-sidebar"><div class="billing-shell-sidebar-head"><div class="account-panel-kicker">Self-hosted billing</div><h3>Self-hosted tools</h3><p>Use these only when the job is a self-hosted purchase, license, refund, or privacy request.</p></div><div class="billing-action-list">' + renderBillingActionRow("open-manage-billing", "Self-hosted billing", "Manage subscriptions", "Billing", "Open Stripe for self-hosted plan, invoice, and payment changes.", "manage-billing-panel", "manage-inline-email", ["Plan changes", "Invoices"]) + renderBillingActionRow("open-retrieve-billing", "Licenses", "Retrieve licenses", "Licenses", "Recover the latest active self-hosted license and invoice link.", "retrieve-billing-panel", "retrieve-inline-email", ["Latest active license", "Invoice lookup"]) + renderBillingActionRow("open-refund-billing", "Refunds", "Refund requests", "Refunds", "Request a self-serve refund when the purchase is still eligible.", "refund-billing-panel", "refund-inline-email", ["Eligibility check", "Revocation"]) + renderBillingActionRow("open-data-billing", "Privacy", "Data and privacy", "Privacy", "Request export or deletion for commercial account data.", "data-billing-panel", "data-export-email", ["Export", "Deletion"]) + '</div><div class="billing-inline-support"><div class="account-panel-kicker">Escalation</div><h4>Keep the billing request contained</h4><p>Use Support only when a hosted billing or self-hosted billing request cannot complete cleanly from this section.</p><div class="billing-inline-support-points"><div class="billing-inline-support-point"><strong>Hosted billing first when present</strong><span>Use the hosted billing cards above before you touch the self-hosted tools.</span></div><div class="billing-inline-support-point"><strong>Escalate with context</strong><span>Bring the billing tool or hosted billing action and the exact failed step if you need support.</span></div></div><div class="billing-inline-support-actions"><button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="support">Open support</button></div></div></aside><div class="billing-shell-main"><div class="billing-detail-shell"><div class="billing-panel billing-panel-empty visible" id="billing-panel-empty"><div class="account-panel-kicker">Billing brief</div><h3>Choose the billing task</h3><p>Pick one self-hosted billing request at a time. Verification happens first so billing, license, refund, or privacy work stays contained.</p><div class="billing-empty-shell"><div class="billing-empty-primary"><div class="billing-empty-section billing-empty-section-compact"><div class="billing-empty-column-title">What each tool does</div><div class="billing-empty-flow-list"><div class="billing-empty-flow"><strong>Billing</strong><span>Stripe customer portal access for self-hosted invoices, payment methods, and plan changes.</span></div><div class="billing-empty-flow"><strong>Licenses</strong><span>Recover the latest active self-hosted license and the matching invoice link.</span></div><div class="billing-empty-flow"><strong>Refunds</strong><span>Check eligibility before revoking active commercial access.</span></div><div class="billing-empty-flow"><strong>Privacy</strong><span>Request export or deletion without leaving Pulse Account.</span></div></div></div><div class="billing-empty-section billing-empty-section-compact"><div class="billing-empty-column-title">Before you start</div><div class="billing-empty-points billing-empty-points-stack"><div class="billing-empty-point"><strong>One request</strong><span>Keep a single billing request active instead of bouncing across sections.</span></div><div class="billing-empty-point"><strong>Identity first</strong><span>Verification happens before any sensitive account action opens.</span></div><div class="billing-empty-point"><strong>Stay focused</strong><span>Use the hosted billing cards above when the request is tied to a hosted workspace account.</span></div></div></div></div><div class="billing-empty-side"><div class="billing-empty-section billing-empty-section-support"><div class="billing-empty-column-title">Escalation</div><div class="billing-empty-checklist"><div class="billing-empty-check"><strong>Escalate quickly</strong><span>If hosted billing or the self-hosted tools do not behave as expected, escalate from this section.</span></div><div class="billing-empty-check"><strong>Billing packet</strong><span>Bring the billing tool, commercial email, and the exact failed action so support starts with the same request state.</span></div></div><div class="billing-empty-support">Need help with billing, refund, privacy, or license requests? <a class="portal-support-link" href="mailto:' + escapeAttr(context.bootstrap.support_email || "") + '">' + escapeHTML(context.bootstrap.support_email || "") + '</a></div><div class="billing-empty-actions"><button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="support">Open support</button></div></div></div></div></div><div class="billing-panel" id="manage-billing-panel"><div id="manage-billing-root"></div></div><div class="billing-panel" id="retrieve-billing-panel"><div id="retrieve-billing-root"></div></div><div class="billing-panel" id="refund-billing-panel"><div id="refund-billing-root"></div></div><div class="billing-panel" id="data-billing-panel"><h3>Data and privacy</h3><p>Request export or deletion of the commercial data tied to an email address. Payment data held directly by Stripe still requires support handling.</p><div class="subsection"><div id="data-export-root"></div></div><div class="subsection"><div id="data-delete-root"></div></div><div class="helper-text">Payment-card data stays with Stripe. For Stripe deletion support, contact <a href="mailto:' + escapeAttr(context.bootstrap.support_email || "") + '">' + escapeHTML(context.bootstrap.support_email || "") + '</a>.</div></div></div></div></div></section><section class="portal-content-panel portal-content-panel-support">' + renderSupportSection(context) + "</section></div></div></div>";+ ]) + '</div><div class="billing-note">' + billingNote + '</div></div><div class="billing-overview-grid">' + renderHostedBillingCards(accounts) + '</div><div class="billing-shell"><aside class="billing-shell-sidebar"><div class="billing-shell-sidebar-head"><div class="account-panel-kicker">Self-hosted billing</div><h3>Pick the self-hosted job</h3><p>Use one path at a time for self-hosted billing, licenses, refunds, or privacy.</p></div><div class="billing-action-list">' + renderBillingActionRow("open-manage-billing", "Self-hosted billing", "Manage subscriptions", "Billing", "Open Stripe for self-hosted plan, invoice, and payment changes.", "manage-billing-panel", "manage-inline-email", ["Plan changes", "Invoices"]) + renderBillingActionRow("open-retrieve-billing", "Licenses", "Retrieve licenses", "Licenses", "Recover the latest active self-hosted license and invoice link.", "retrieve-billing-panel", "retrieve-inline-email", ["Latest active license", "Invoice lookup"]) + renderBillingActionRow("open-refund-billing", "Refunds", "Refund requests", "Refunds", "Request a self-serve refund when the purchase is still eligible.", "refund-billing-panel", "refund-inline-email", ["Eligibility check", "Revocation"]) + renderBillingActionRow("open-data-billing", "Privacy", "Data and privacy", "Privacy", "Request export or deletion for commercial account data.", "data-billing-panel", "data-export-email", ["Export", "Deletion"]) + '</div><div class="billing-inline-support"><div class="account-panel-kicker">Escalation only</div><h4>Use Support only after Billing fails</h4><p>Escalate with the same hosted billing action or self-hosted path and the exact failed step.</p><div class="billing-inline-support-actions"><button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="support">Open support</button><a class="portal-support-link" href="mailto:' + escapeAttr(context.bootstrap.support_email || "") + '">' + escapeHTML(context.bootstrap.support_email || "") + '</a></div></div></aside><div class="billing-shell-main"><div class="billing-detail-shell"><div class="billing-panel billing-panel-empty visible" id="billing-panel-empty"><div class="account-panel-kicker">Next action</div><h3>Choose one billing path</h3><p>Open the job you need. Use hosted billing above when it applies, and use these self-hosted paths only for self-hosted purchases.</p><div class="billing-empty-shell"><div class="billing-empty-primary"><div class="billing-empty-section billing-empty-section-compact"><div class="billing-empty-column-title">Available now</div><div class="billing-empty-flow-list"><div class="billing-empty-flow"><strong>Billing</strong><span>Manage self-hosted plans, invoices, and payment methods.</span></div><div class="billing-empty-flow"><strong>Licenses</strong><span>Recover the latest active self-hosted license and invoice link.</span></div><div class="billing-empty-flow"><strong>Refunds</strong><span>Check eligibility before revoking active self-hosted access.</span></div><div class="billing-empty-flow"><strong>Privacy</strong><span>Request export or deletion for commercial account data.</span></div></div></div></div><div class="billing-empty-side"><div class="billing-empty-section billing-empty-section-support"><div class="billing-empty-column-title">Escalation</div><div class="billing-empty-checklist"><div class="billing-empty-check"><strong>Use support last</strong><span>Only after hosted billing or one self-hosted path fails.</span></div><div class="billing-empty-check"><strong>Send the same request</strong><span>Include the billing path, account or commercial email, and the failed step.</span></div></div><div class="billing-empty-support">Need escalation for billing, refund, privacy, or license work? <a class="portal-support-link" href="mailto:' + escapeAttr(context.bootstrap.support_email || "") + '">' + escapeHTML(context.bootstrap.support_email || "") + '</a></div><div class="billing-empty-actions"><button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="support">Open support</button></div></div></div></div></div><div class="billing-panel" id="manage-billing-panel"><div id="manage-billing-root"></div></div><div class="billing-panel" id="retrieve-billing-panel"><div id="retrieve-billing-root"></div></div><div class="billing-panel" id="refund-billing-panel"><div id="refund-billing-root"></div></div><div class="billing-panel" id="data-billing-panel"><h3>Data and privacy</h3><p>Request export or deletion of the commercial data tied to an email address. Payment data held directly by Stripe still requires support handling.</p><div class="subsection"><div id="data-export-root"></div></div><div class="subsection"><div id="data-delete-root"></div></div><div class="helper-text">Payment-card data stays with Stripe. For Stripe deletion support, contact <a href="mailto:' + escapeAttr(context.bootstrap.support_email || "") + '">' + escapeHTML(context.bootstrap.support_email || "") + '</a>.</div></div></div></div></div></section><section class="portal-content-panel portal-content-panel-support">' + renderSupportSection(context) + "</section></div></div></div>";}function renderSignedOutPortalHTML(context) {var statusHTML = "";diff --git a/internal/cloudcp/portal/frontend/src/account_runtime.test.ts b/internal/cloudcp/portal/frontend/src/account_runtime.test.tsindex 01d3e1492f..3a40686cd2 100644--- a/internal/cloudcp/portal/frontend/src/account_runtime.test.ts+++ b/internal/cloudcp/portal/frontend/src/account_runtime.test.ts@@ -199,7 +199,7 @@ describe('account runtime', function() {document.body.innerHTML ='<div id="workspace-management-acct_1" class="workspace-management-panel"><button id="workspace-management-close-acct_1"></button><div id="workspace-management-empty-acct_1"></div><div id="workspace-management-content-acct_1" hidden><div id="workspace-management-meta-acct_1"></div><h4 id="workspace-management-title-acct_1"></h4><p id="workspace-management-summary-acct_1"></p><div id="workspace-management-health-acct_1"></div><div id="workspace-management-lifecycle-acct_1"></div><div id="workspace-management-created-acct_1"></div><div id="workspace-management-guidance-acct_1"></div><button id="workspace-management-action-acct_1"></button></div></div>' +- '<div id="access-section-acct_1" class="access-section" data-actor-role="owner">' ++ '<div id="access-section-acct_1" class="access-section" data-actor-role="owner" data-can-manage="true">' +'<div id="access-stats-acct_1"></div>' +'<table><tbody id="access-list-acct_1"></tbody></table>' +'<input id="invite-email-acct_1">' +diff --git a/internal/cloudcp/portal/frontend/src/account_view.test.ts b/internal/cloudcp/portal/frontend/src/account_view.test.tsindex fc1863cac1..2831655ac7 100644--- a/internal/cloudcp/portal/frontend/src/account_view.test.ts+++ b/internal/cloudcp/portal/frontend/src/account_view.test.ts@@ -74,7 +74,7 @@ describe('account view', function() {it('renders team loading, error, and populated member states', function() {document.body.innerHTML =- '<div id="access-section-acct_1" class="access-section" data-actor-role="owner">' ++ '<div id="access-section-acct_1" class="access-section" data-actor-role="owner" data-can-manage="true">' +'<div id="access-stats-acct_1"></div>' +'<table><tbody id="access-list-acct_1"></tbody></table>' +'</div>';@@ -84,7 +84,8 @@ describe('account view', function() {accessQuery: { status: 'loading', error: '', data: [] },}));expect(document.getElementById('access-list-acct_1')?.textContent).toContain('Loading roster');- expect(document.getElementById('access-stats-acct_1')?.textContent).toContain('Invites');+ expect(document.getElementById('access-stats-acct_1')?.textContent).toContain('Mode');+ expect(document.getElementById('access-stats-acct_1')?.textContent).toContain('Manage');renderAccessSection('acct_1', createEntry({accessVisible: true,@@ -92,7 +93,7 @@ describe('account view', function() {}));expect(document.getElementById('access-list-acct_1')?.textContent).toContain('Roster needs attention');expect(document.getElementById('access-list-acct_1')?.textContent).toContain('Failed to load access roster.');- expect(document.getElementById('access-stats-acct_1')?.textContent).toContain('Invite only');+ expect(document.getElementById('access-stats-acct_1')?.textContent).toContain('Manage');renderAccessSection('acct_1',@@ -116,7 +117,7 @@ describe('account view', function() {it('normalizes legacy member roles into the current read-only operator model', function() {document.body.innerHTML =- '<div id="access-section-acct_1" class="access-section" data-actor-role="owner">' ++ '<div id="access-section-acct_1" class="access-section" data-actor-role="owner" data-can-manage="true">' +'<div id="access-stats-acct_1"></div>' +'<div id="access-list-acct_1"></div>' +'</div>';@@ -143,6 +144,35 @@ describe('account view', function() {expect(document.getElementById('access-stats-acct_1')?.textContent).toContain('1');});+ it('renders access roster as view-only when the account is not manageable', function() {+ document.body.innerHTML =+ '<div id="access-section-acct_1" class="access-section" data-actor-role="tech" data-can-manage="false">' ++ '<div id="access-stats-acct_1"></div>' ++ '<div id="access-list-acct_1"></div>' ++ '</div>';++ renderAccessSection(+ 'acct_1',+ createEntry({+ accessVisible: true,+ accessQuery: {+ status: 'ready',+ error: '',+ data: [+ { email: '[email protected]', role: 'owner', user_id: 'u1' },+ { email: '[email protected]', role: 'tech', user_id: 'u2' },+ ],+ },+ })+ );++ expect(document.querySelector('[data-action="change-role"]')).toBeNull();+ expect(document.querySelector('[data-action="remove-member"]')).toBeNull();+ expect(document.querySelector('.access-role-select')).toBeNull();+ expect(document.getElementById('access-list-acct_1')?.textContent).toContain('View only');+ expect(document.getElementById('access-stats-acct_1')?.textContent).toContain('Members');+ });+it('renders workspace management selection from account UI state', function() {document.body.innerHTML ='<div id="workspace-operations-shell-acct_1" class="workspace-operations-shell workspace-operations-shell-idle">' +@@ -179,10 +209,10 @@ describe('account view', function() {document.body.innerHTML ='<div id="add-ws-form-acct_1" class="add-workspace-form"></div><div id="ws-spinner-acct_1"></div>' +'<div id="workspace-management-acct_1" class="workspace-management-panel"><button id="workspace-management-close-acct_1"></button><div id="workspace-management-empty-acct_1"></div><div id="workspace-management-content-acct_1" hidden><div id="workspace-management-meta-acct_1"></div><h4 id="workspace-management-title-acct_1"></h4><p id="workspace-management-summary-acct_1"></p><div id="workspace-management-health-acct_1"></div><div id="workspace-management-lifecycle-acct_1"></div><div id="workspace-management-created-acct_1"></div><div id="workspace-management-guidance-acct_1"></div><button id="workspace-management-action-acct_1"></button></div></div>' +- '<div id="access-section-acct_1" class="access-section" data-actor-role="admin"><div id="access-stats-acct_1"></div><table><tbody id="access-list-acct_1"></tbody></table></div>' ++ '<div id="access-section-acct_1" class="access-section" data-actor-role="admin" data-can-manage="true"><div id="access-stats-acct_1"></div><table><tbody id="access-list-acct_1"></tbody></table></div>' +'<div id="add-ws-form-acct_2" class="add-workspace-form"></div><div id="ws-spinner-acct_2"></div>' +'<div id="workspace-management-acct_2" class="workspace-management-panel"><button id="workspace-management-close-acct_2"></button><div id="workspace-management-empty-acct_2"></div><div id="workspace-management-content-acct_2" hidden><div id="workspace-management-meta-acct_2"></div><h4 id="workspace-management-title-acct_2"></h4><p id="workspace-management-summary-acct_2"></p><div id="workspace-management-health-acct_2"></div><div id="workspace-management-lifecycle-acct_2"></div><div id="workspace-management-created-acct_2"></div><div id="workspace-management-guidance-acct_2"></div><button id="workspace-management-action-acct_2"></button></div></div>' +- '<div id="access-section-acct_2" class="access-section" data-actor-role="owner"><div id="access-stats-acct_2"></div><table><tbody id="access-list-acct_2"></tbody></table></div>';+ '<div id="access-section-acct_2" class="access-section" data-actor-role="owner" data-can-manage="true"><div id="access-stats-acct_2"></div><table><tbody id="access-list-acct_2"></tbody></table></div>';var state: PortalAccountState = {byAccountID: {diff --git a/internal/cloudcp/portal/frontend/src/account_view.ts b/internal/cloudcp/portal/frontend/src/account_view.tsindex c4e6fedd65..6ce30e9554 100644--- a/internal/cloudcp/portal/frontend/src/account_view.ts+++ b/internal/cloudcp/portal/frontend/src/account_view.ts@@ -203,7 +203,7 @@ function countMembersByRole(members: PortalAccessMember[], role: string): numberreturn count;}-function renderAccessStats(accountID: string, entry: PortalAccountUIEntry): void {+function renderAccessStats(accountID: string, entry: PortalAccountUIEntry, canManage: boolean): void {var stats = getElement<HTMLElement>('access-stats-' + accountID);if (!stats) return;if (!entry.accessVisible) {@@ -213,13 +213,13 @@ function renderAccessStats(accountID: string, entry: PortalAccountUIEntry): voidif (entry.accessQuery.status === 'loading') {stats.innerHTML ='<div class="access-stat-card"><span class="access-stat-label">Roster</span><span class="access-stat-value">Loading…</span></div>' +- '<div class="access-stat-card"><span class="access-stat-label">Invites</span><span class="access-stat-value">Ready</span></div>';+ '<div class="access-stat-card"><span class="access-stat-label">Mode</span><span class="access-stat-value">' + (canManage ? 'Manage' : 'View') + '</span></div>';return;}if (entry.accessQuery.status === 'error') {stats.innerHTML ='<div class="access-stat-card"><span class="access-stat-label">Roster</span><span class="access-stat-value access-stat-error">Needs attention</span></div>' +- '<div class="access-stat-card"><span class="access-stat-label">Fallback</span><span class="access-stat-value">Invite only</span></div>';+ '<div class="access-stat-card"><span class="access-stat-label">Mode</span><span class="access-stat-value">' + (canManage ? 'Manage' : 'View') + '</span></div>';return;}@@ -237,9 +237,16 @@ function createAccessControlCell(className: string): HTMLDivElement {return cell;}-function renderAccessRoleControl(accountID: string, member: PortalAccessMember, isOwner: boolean): HTMLElement {+function renderAccessRoleControl(accountID: string, member: PortalAccessMember, isOwner: boolean, canManage: boolean): HTMLElement {var currentRole = normalizedAccessRole(member.role);var group = createAccessControlCell('access-control-cell-role');+ if (!canManage) {+ var badge = document.createElement('span');+ badge.className = 'access-role-badge';+ badge.textContent = roleLabel(currentRole);+ group.appendChild(badge);+ return group;+ }if (currentRole === 'owner' && !isOwner) {var locked = document.createElement('span');locked.className = 'access-role-badge';@@ -265,7 +272,15 @@ function renderAccessRoleControl(accountID: string, member: PortalAccessMember,return group;}-function renderAccessMemberAction(accountID: string, member: PortalAccessMember, isOwner: boolean): HTMLElement | null {+function renderAccessMemberAction(accountID: string, member: PortalAccessMember, isOwner: boolean, canManage: boolean): HTMLElement | null {+ if (!canManage) {+ var readonly = createAccessControlCell('access-control-cell-access');+ var readonlyText = document.createElement('span');+ readonlyText.className = 'access-control-locked';+ readonlyText.textContent = 'View only';+ readonly.appendChild(readonlyText);+ return readonly;+ }if (normalizedAccessRole(member.role) === 'owner' && !isOwner) {var locked = createAccessControlCell('access-control-cell-access');var lockedText = document.createElement('span');@@ -288,7 +303,7 @@ function renderAccessMemberAction(accountID: string, member: PortalAccessMember,return group;}-function renderAccessMemberRow(accountID: string, member: PortalAccessMember, isOwner: boolean): HTMLElement {+function renderAccessMemberRow(accountID: string, member: PortalAccessMember, isOwner: boolean, canManage: boolean): HTMLElement {var row = document.createElement('div');row.className = 'access-member-row';@@ -316,8 +331,8 @@ function renderAccessMemberRow(accountID: string, member: PortalAccessMember, isidentity.appendChild(caption);row.appendChild(identity);- row.appendChild(renderAccessRoleControl(accountID, member, isOwner));- row.appendChild(renderAccessMemberAction(accountID, member, isOwner) || createAccessControlCell('access-control-cell-access'));+ row.appendChild(renderAccessRoleControl(accountID, member, isOwner, canManage));+ row.appendChild(renderAccessMemberAction(accountID, member, isOwner, canManage) || createAccessControlCell('access-control-cell-access'));return row;}@@ -351,8 +366,9 @@ export function renderAccessSection(accountID: string, entry: PortalAccountUIEntvar actorRole = section.getAttribute('data-actor-role') || '';var isOwner = actorRole === 'owner';+ var canManage = section.getAttribute('data-can-manage') === 'true';section.classList.toggle('visible', entry.accessVisible);- renderAccessStats(accountID, entry);+ renderAccessStats(accountID, entry, canManage);if (!entry.accessVisible) {return;@@ -369,7 +385,14 @@ export function renderAccessSection(accountID: string, entry: PortalAccountUIEnt}if (!entry.accessQuery.data.length) {if (rosterPanel) rosterPanel.classList.add('state-only');- setContainerMessage(roster, 'No one added yet', 'Invite someone new when this account needs shared access.', false);+ setContainerMessage(+ roster,+ 'No one added yet',+ canManage+ ? 'Invite someone when this hosted account needs shared access.'+ : 'There is no hosted roster to review yet on this account.',+ false+ );return;}@@ -379,7 +402,7 @@ export function renderAccessSection(accountID: string, entry: PortalAccountUIEntensureAccessRosterHead(roster);for (var i = 0; i < entry.accessQuery.data.length; i += 1) {var member = entry.accessQuery.data[i];- roster.appendChild(renderAccessMemberRow(accountID, member, isOwner));+ roster.appendChild(renderAccessMemberRow(accountID, member, isOwner, canManage));}}diff --git a/internal/cloudcp/portal/frontend/src/shell_view.test.ts b/internal/cloudcp/portal/frontend/src/shell_view.test.tsindex 8e89d40e87..584c7de737 100644--- a/internal/cloudcp/portal/frontend/src/shell_view.test.ts+++ b/internal/cloudcp/portal/frontend/src/shell_view.test.ts@@ -187,50 +187,83 @@ describe('shell view', function() {expect(html.indexOf('id="add-ws-form-acct_1"')).toBeGreaterThan(html.indexOf('Workspace management'));expect(html.indexOf('id="add-ws-form-acct_1"')).toBeGreaterThan(html.indexOf('Keep this section workspace-only'));expect(html).toContain('data-action="clear-workspace-selection"');- expect(html).toContain('People and roles');- expect(html).toContain('Invite');- expect(html).toContain('Roles');+ expect(html).toContain('Manage access');+ expect(html).toContain('Invite people');+ expect(html).toContain('Change roles');expect(html).toContain('Remove access');- expect(html).toContain('Invite someone new');- expect(html).toContain('Role rules');- expect(html).toContain('Access review');- expect(html).toContain('Keep access explicit');- expect(html).toContain('Owners stay rare');- expect(html).toContain('Billing, access control, and full account control.');- expect(html).toContain('Workspace control plus billing for the account.');- expect(html).toContain('Workspace control without billing ownership.');- expect(html).toContain('Workspace review and verification without control-plane changes.');+ expect(html).toContain('Pick the access job');+ expect(html).toContain('Choose the smallest role');+ expect(html).toContain('Full account, billing, and access control.');+ expect(html).toContain('Workspace control, billing, and roster management.');+ expect(html).toContain('Workspace control without billing or roster ownership.');+ expect(html).toContain('Review access without control-plane changes.');expect(html).toContain('People on this account');+ expect(html).toContain('data-can-manage="true"');expect(html).toContain('data-action="workspace-action"');expect(html).toContain('billing-action-row');expect(html).toContain('billing-action-button');expect(html).toContain('id="billing-panel-empty"');- expect(html).toContain('Choose the billing task');- expect(html).toContain('Billing brief');+ expect(html).toContain('Choose one billing path');expect(html).toContain('Hosted billing');expect(html).toContain('Self-hosted tools');expect(html).toContain('Self-hosted billing');- expect(html).toContain('Keep the billing request contained');- expect(html).toContain('Hosted billing first when present');+ expect(html).toContain('Pick the self-hosted job');+ expect(html).toContain('Use Support only after Billing fails');+ expect(html).toContain('Use hosted billing first when the request belongs to a hosted workspace account.');expect(html).toContain('Open support');- expect(html).toContain('What each tool does');- expect(html).toContain('Before you start');- expect(html).toContain('Escalate quickly');- expect(html).toContain('Identity first');+ expect(html).toContain('Available now');+ expect(html).toContain('Use support last');+ expect(html).toContain('Send the same request');expect(html).toContain('id="open-retrieve-billing"');expect(html).toContain('id="data-billing-panel"');expect(html).toContain('>Billing<');expect(html).toContain('>Licenses<');expect(html).toContain('>Refunds<');expect(html).toContain('>Privacy<');- expect(html).toContain('Escalation');- expect(html).toContain('Hosted problems');- expect(html).toContain('Billing and self-hosted issues');- expect(html).toContain('Escalation packet');+ expect(html).toContain('Escalation only');+ expect(html).toContain('Workspace or access path failed');+ expect(html).toContain('Billing path failed');+ expect(html).toContain('Keep the escalation short');expect(html).toContain('What to send');expect(html).toContain('Open billing');});+ it('renders a view-only access surface when the account cannot manage access', function() {+ var html = renderAuthenticatedPortalHTML(+ createContext({+ bootstrap: createBootstrap({+ accounts: [+ {+ id: 'acct_ro',+ name: 'Observer Account',+ kind: 'cloud',+ kind_label: 'Cloud',+ role: 'tech',+ can_manage: false,+ has_billing: false,+ workspaces: [+ {+ id: 'ws_ro',+ display_name: 'Observed Workspace',+ state: 'active',+ healthy: true,+ health_status: 'healthy',+ },+ ],+ },+ ],+ }),+ })+ );++ expect(html).toContain('Review access');+ expect(html).toContain('Owner or admin required');+ expect(html).toContain('This account is view-only for you');+ expect(html).toContain('Need an access change?');+ expect(html).toContain('data-can-manage="false"');+ expect(html).not.toContain('data-action="invite-member"');+ });+it('renders self-hosted overview copy when no hosted accounts are attached', function() {var html = renderAuthenticatedPortalHTML(createContext({@@ -248,7 +281,7 @@ describe('shell view', function() {expect(html).toContain('Billing tools are ready');expect(html).toContain('There is nothing to open or manage here yet.');expect(html).toContain('There are no hosted roles or invites to manage for this account right now.');- expect(html).toContain('Use this billing surface for self-hosted subscriptions, licenses, refunds, and privacy requests.');+ expect(html).toContain('Use this billing surface only for self-hosted subscriptions, licenses, refunds, and privacy requests.');expect(html).toContain('No hosted billing attached');expect(html).toContain('Billing');expect(html).not.toContain('Self-hosted commercial services');diff --git a/internal/cloudcp/portal/frontend/src/shell_view.ts b/internal/cloudcp/portal/frontend/src/shell_view.tsindex 644d5ee0b1..684358fbdd 100644--- a/internal/cloudcp/portal/frontend/src/shell_view.ts+++ b/internal/cloudcp/portal/frontend/src/shell_view.ts@@ -904,43 +904,60 @@ function renderAccountWorkspaceSection(account: PortalAccountSummary, accountAPI}function renderAccountAccessSection(account: PortalAccountSummary): string {+ var accessHeaderTitle = account.can_manage ? 'Manage access' : 'Review access';+ var accessHeaderCopy = account.can_manage+ ? 'Invite people, change roles, and remove stale access from one hosted roster.'+ : 'Review who already has access to this hosted account. An owner or admin must make changes.';+ var accessContextChips = account.can_manage+ ? ['Invite people', 'Change roles', 'Remove access']+ : ['View roster', 'Owner or admin required'];var accessPolicy ='<div class="access-policy-panel">' +'<div class="access-panel-heading">' +- '<h4>Role rules</h4>' +- '<p>Invite the smallest role that still lets someone do the work they actually own on this account.</p>' ++ '<h4>' + (account.can_manage ? 'Choose the smallest role' : 'Role meanings') + '</h4>' ++ '<p>' + (account.can_manage+ ? 'Match each person to the narrowest role that still lets them do the job they own.'+ : 'Use these role meanings to understand what each person on this roster can do.') + '</p>' +'</div>' +'<div class="access-policy-list">' +- '<div class="access-policy-row"><strong>Owner</strong><span>Billing, access control, and full account control.</span></div>' +- '<div class="access-policy-row"><strong>Admin</strong><span>Workspace control plus billing for the account.</span></div>' +- '<div class="access-policy-row"><strong>Tech</strong><span>Workspace control without billing ownership.</span></div>' +- '<div class="access-policy-row"><strong>Read-only</strong><span>Workspace review and verification without control-plane changes.</span></div>' ++ '<div class="access-policy-row"><strong>Owner</strong><span>Full account, billing, and access control.</span></div>' ++ '<div class="access-policy-row"><strong>Admin</strong><span>Workspace control, billing, and roster management.</span></div>' ++ '<div class="access-policy-row"><strong>Tech</strong><span>Workspace control without billing or roster ownership.</span></div>' ++ '<div class="access-policy-row"><strong>Read-only</strong><span>Review access without control-plane changes.</span></div>' +'</div>' +'</div>';- var reviewDesk =- '<div class="access-review-shell">' +- '<div class="access-review-strip">' +- '<div class="access-panel-heading access-panel-heading-tight">' +- '<div class="account-panel-kicker">Access review</div>' +- '<h4>Keep access explicit</h4>' +- '<p>Use the roster as a controlled access list, not a vague shared bucket.</p>' ++ var accessActions = account.can_manage+ ? (+ '<div class="access-invite-panel">' ++ '<div class="access-panel-heading">' ++ '<h4>Invite people</h4>' ++ '<p>Add one person with the minimum role they need on this account.</p>' +'</div>' +- '<div class="access-review-grid">' +- '<div class="access-review-card">' +- '<strong>Owners stay rare</strong>' +- '<span>Reserve Owner for billing, access control, and full account control. Default to Admin, Tech, or Read-only first.</span>' +- '</div>' +- '<div class="access-review-card">' +- '<strong>Keep access narrow</strong>' +- '<span>Use Tech for workspace control and Read-only for verification instead of handing out broader access.</span>' +- '</div>' +- '<div class="access-review-card">' +- '<strong>Remove stale access fast</strong>' +- '<span>If someone no longer owns the work, remove them instead of leaving dormant access attached to the account.</span>' +- '</div>' ++ '<div class="access-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 type="button" class="btn-primary btn-compact" data-action="invite-member" data-account-id="' ++ escapeAttr(account.id) ++ '">Invite</button>' +'</div>' +- '</div>' +- '</div>';+ '</div>'+ )+ : (+ '<div class="access-invite-panel">' ++ '<div class="access-panel-heading">' ++ '<h4>Need an access change?</h4>' ++ '<p>An owner or admin on this account must invite people, change roles, or remove access.</p>' ++ '</div>' ++ '</div>'+ );return ('<section class="account-content-panel account-content-panel-access">' +@@ -948,18 +965,15 @@ function renderAccountAccessSection(account: PortalAccountSummary): string {escapeAttr(account.id) +'" data-actor-role="' +escapeAttr(account.role) ++ '" data-can-manage="' ++ escapeAttr(account.can_manage ? 'true' : 'false') +'">' +'<div class="access-management-header">' +'<div>' +'<div class="account-panel-kicker">Access</div>' +- '<h3>People and roles</h3>' +- '<p>Invite people, change roles, and remove stale access without mixing that work into workspace operations.</p>' +- renderSectionContextChips([- account.can_manage ? 'Managed roster' : 'View only',- 'Invite',- 'Roles',- 'Remove access',- ]) ++ '<h3>' + accessHeaderTitle + '</h3>' ++ '<p>' + accessHeaderCopy + '</p>' ++ renderSectionContextChips(accessContextChips) +'</div>' +'<button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="workspaces">Back to workspaces</button>' +'</div>' +@@ -971,7 +985,7 @@ function renderAccountAccessSection(account: PortalAccountSummary): string {'<div class="access-roster">' +'<div class="access-panel-heading">' +'<h4>People on this account</h4>' +- '<p>Every person here can reach this hosted account. Keep the list small and the role choice explicit.</p>' ++ '<p>Review the hosted roster here before you open, change, or remove access.</p>' +'</div>' +'<div class="access-roster-list" id="access-list-' +escapeAttr(account.id) +@@ -979,37 +993,18 @@ function renderAccountAccessSection(account: PortalAccountSummary): string {'<div class="access-list-message">Loading…</div>' +'</div>' +'</div>' +- reviewDesk +'</div>' +'<div class="access-side-column">' +'<div class="access-operations-panel">' +'<div class="access-panel-heading access-panel-heading-tight">' +- '<div class="account-panel-kicker">Access controls</div>' +- '<h4>Invite, role, remove</h4>' +- '<p>Use this column when you need to add someone, tighten a role, or remove access that no longer belongs here.</p>' ++ '<div class="account-panel-kicker">Next action</div>' ++ '<h4>' + (account.can_manage ? 'Pick the access job' : 'This account is view-only for you') + '</h4>' ++ '<p>' + (account.can_manage+ ? 'Use this column to invite people, tighten roles, or remove access that no longer belongs here.'+ : 'You can review the roster here, but access changes must be done by an owner or admin.') + '</p>' +'</div>' +'<div class="access-operations-grid">' +- '<div class="access-invite-panel">' +- '<div class="access-panel-heading">' +- '<h4>Invite someone new</h4>' +- '<p>Add a person with the minimum role they need for this account.</p>' +- '</div>' +- '<div class="access-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 type="button" class="btn-primary btn-compact" data-action="invite-member" data-account-id="' +- escapeAttr(account.id) +- '">Invite</button>' +- '</div>' +- '</div>' ++ accessActions +accessPolicy +'</div>' +'</div>' +@@ -1057,18 +1052,18 @@ function renderSupportSection(context: ShellViewContext): string {return ('<section class="portal-support-panel">' +'<div class="account-panel-kicker">Support</div>' +- '<h2>Escalation</h2>' +- '<p>Come here only after the workspace, access, or billing path has stopped you.</p>' ++ '<h2>Escalation only</h2>' ++ '<p>Use support only when the Workspaces, Access, or Billing path has already stopped you.</p>' +renderSectionContextChips(['Escalation only', 'Bring context', context.bootstrap.support_email ? 'Email' : 'Support']) +'<div class="portal-support-layout">' +'<div class="portal-support-route-grid">' +'<div class="portal-support-route-card">' +- '<div class="account-panel-kicker">Hosted account</div>' +- '<h3>Hosted problems</h3>' +- '<p>Use support for hosted issues only after you have already tried the Workspaces or Access path.</p>' ++ '<div class="account-panel-kicker">Hosted path</div>' ++ '<h3>Workspace or access path failed</h3>' ++ '<p>Go back to the hosted task first. Escalate only when the same workspace or access path still cannot finish the job.</p>' +'<div class="portal-support-points">' +- '<div class="portal-support-point"><strong>Use after the hosted path fails</strong><span>Workspace access, lifecycle, and account access should already be narrowed before you escalate.</span></div>' +- '<div class="portal-support-point"><strong>Keep the account context intact</strong><span>Include the account, workspace, and action that failed so support can pick up the same issue quickly.</span></div>' ++ '<div class="portal-support-point"><strong>Start from the same task</strong><span>Use Workspaces for lifecycle issues and Access for roster issues before you escalate.</span></div>' ++ '<div class="portal-support-point"><strong>Keep the hosted context intact</strong><span>Include the account, workspace, and failed action so support inherits the same request.</span></div>' +'</div>' +'<div class="portal-support-actions">' +'<button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="workspaces">Open workspaces</button>' +@@ -1077,12 +1072,12 @@ function renderSupportSection(context: ShellViewContext): string {'</div>' +'</div>' +'<div class="portal-support-route-card">' +- '<div class="account-panel-kicker">Billing</div>' +- '<h3>Billing and self-hosted issues</h3>' +- '<p>Use this route only after hosted billing or the self-hosted billing tools have failed to complete the request cleanly.</p>' ++ '<div class="account-panel-kicker">Billing path</div>' ++ '<h3>Billing path failed</h3>' ++ '<p>Use this route only after hosted billing or one self-hosted billing job has failed to complete cleanly.</p>' +'<div class="portal-support-points">' +- '<div class="portal-support-point"><strong>Start in Billing</strong><span>Hosted billing, licenses, refunds, and privacy should already be narrowed to one failed request.</span></div>' +- '<div class="portal-support-point"><strong>Escalate from the same path</strong><span>Bring the billing tool or hosted billing action that failed instead of reopening the story from scratch.</span></div>' ++ '<div class="portal-support-point"><strong>Name the billing job</strong><span>Say whether the failed path was hosted billing, licenses, refunds, or privacy.</span></div>' ++ '<div class="portal-support-point"><strong>Keep the request intact</strong><span>Bring the same account or billing email and the failed action instead of reopening the story.</span></div>' +'</div>' +'<div class="portal-support-actions">' +'<button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="billing">Open billing</button>' +@@ -1091,13 +1086,13 @@ function renderSupportSection(context: ShellViewContext): string {'</div>' +'</div>' +'<div class="portal-support-runbook">' +- '<div class="account-panel-kicker">Escalation packet</div>' +- '<h3>What to send</h3>' +- '<p>Keep the packet short and concrete so support can pick up the exact failed path immediately.</p>' ++ '<div class="account-panel-kicker">What to send</div>' ++ '<h3>Keep the escalation short</h3>' ++ '<p>Support should inherit the same request, not reconstruct it from scratch.</p>' +'<div class="portal-support-runbook-list">' +- '<div class="portal-support-runbook-step"><strong>1. Name the path</strong><span>Say whether the failed path was Workspaces, Access, or Billing.</span></div>' +- '<div class="portal-support-runbook-step"><strong>2. Name the account</strong><span>Include the hosted account and workspace when relevant, or the billing email for self-hosted work.</span></div>' +- '<div class="portal-support-runbook-step"><strong>3. Name the action</strong><span>Include the exact button, form, or billing tool that failed and what happened next.</span></div>' ++ '<div class="portal-support-runbook-step"><strong>1. Failed path</strong><span>Say whether the blocked path was Workspaces, Access, hosted billing, licenses, refunds, or privacy.</span></div>' ++ '<div class="portal-support-runbook-step"><strong>2. Account or email</strong><span>Include the hosted account and workspace when relevant, or the commercial billing email for self-hosted work.</span></div>' ++ '<div class="portal-support-runbook-step"><strong>3. Failed action</strong><span>Name the exact button, form, or billing step that failed and what happened next.</span></div>' +'</div>' +'</div>' +'</div>' +@@ -1129,8 +1124,8 @@ export function renderAuthenticatedPortalHTML(context: ShellViewContext): stringreturn account.has_billing;}).length;var billingNote = hosted- ? 'Hosted billing lives here when it applies. Self-hosted licenses, refunds, and privacy stay separate underneath it.'- : 'Use this billing surface for self-hosted subscriptions, licenses, refunds, and privacy requests.';+ ? 'Use hosted billing first when the request belongs to a hosted workspace account. Self-hosted licenses, refunds, and privacy stay separate underneath it.'+ : 'Use this billing surface only for self-hosted subscriptions, licenses, refunds, and privacy requests.';var hostedContent = accounts.length? accounts.map(function(account) {return (@@ -1171,8 +1166,8 @@ export function renderAuthenticatedPortalHTML(context: ShellViewContext): string'<aside class="billing-shell-sidebar">' +'<div class="billing-shell-sidebar-head">' +'<div class="account-panel-kicker">Self-hosted billing</div>' +- '<h3>Self-hosted tools</h3>' +- '<p>Use these only when the job is a self-hosted purchase, license, refund, or privacy request.</p>' ++ '<h3>Pick the self-hosted job</h3>' ++ '<p>Use one path at a time for self-hosted billing, licenses, refunds, or privacy.</p>' +'</div>' +'<div class="billing-action-list">' +renderBillingActionRow('open-manage-billing', 'Self-hosted billing', 'Manage subscriptions', 'Billing', 'Open Stripe for self-hosted plan, invoice, and payment changes.', 'manage-billing-panel', 'manage-inline-email', ['Plan changes', 'Invoices']) +@@ -1181,41 +1176,34 @@ export function renderAuthenticatedPortalHTML(context: ShellViewContext): stringrenderBillingActionRow('open-data-billing', 'Privacy', 'Data and privacy', 'Privacy', 'Request export or deletion for commercial account data.', 'data-billing-panel', 'data-export-email', ['Export', 'Deletion']) +'</div>' +'<div class="billing-inline-support">' +- '<div class="account-panel-kicker">Escalation</div>' +- '<h4>Keep the billing request contained</h4>' +- '<p>Use Support only when a hosted billing or self-hosted billing request cannot complete cleanly from this section.</p>' +- '<div class="billing-inline-support-points">' +- '<div class="billing-inline-support-point"><strong>Hosted billing first when present</strong><span>Use the hosted billing cards above before you touch the self-hosted tools.</span></div>' +- '<div class="billing-inline-support-point"><strong>Escalate with context</strong><span>Bring the billing tool or hosted billing action and the exact failed step if you need support.</span></div>' +- '</div>' ++ '<div class="account-panel-kicker">Escalation only</div>' ++ '<h4>Use Support only after Billing fails</h4>' ++ '<p>Escalate with the same hosted billing action or self-hosted path and the exact failed step.</p>' +'<div class="billing-inline-support-actions">' +'<button type="button" class="btn-secondary btn-compact" data-shell-action="activate-section" data-shell-section="support">Open support</button>' ++ '<a class="portal-support-link" href="mailto:' ++ escapeAttr(context.bootstrap.support_email || '') ++ '">' ++ escapeHTML(context.bootstrap.support_email || '') ++ '</a>' +'</div>' +'</div>' +'</aside>' +'<div class="billing-shell-main">' +'<div class="billing-detail-shell">' +'<div class="billing-panel billing-panel-empty visible" id="billing-panel-empty">' +- '<div class="account-panel-kicker">Billing brief</div>' +- '<h3>Choose the billing task</h3>' +- '<p>Pick one self-hosted billing request at a time. Verification happens first so billing, license, refund, or privacy work stays contained.</p>' ++ '<div class="account-panel-kicker">Next action</div>' ++ '<h3>Choose one billing path</h3>' ++ '<p>Open the job you need. Use hosted billing above when it applies, and use these self-hosted paths only for self-hosted purchases.</p>' +'<div class="billing-empty-shell">' +'<div class="billing-empty-primary">' +'<div class="billing-empty-section billing-empty-section-compact">' +- '<div class="billing-empty-column-title">What each tool does</div>' ++ '<div class="billing-empty-column-title">Available now</div>' +'<div class="billing-empty-flow-list">' +- '<div class="billing-empty-flow"><strong>Billing</strong><span>Stripe customer portal access for self-hosted invoices, payment methods, and plan changes.</span></div>' +- '<div class="billing-empty-flow"><strong>Licenses</strong><span>Recover the latest active self-hosted license and the matching invoice link.</span></div>' +- '<div class="billing-empty-flow"><strong>Refunds</strong><span>Check eligibility before revoking active commercial access.</span></div>' +- '<div class="billing-empty-flow"><strong>Privacy</strong><span>Request export or deletion without leaving Pulse Account.</span></div>' +- '</div>' +- '</div>' +- '<div class="billing-empty-section billing-empty-section-compact">' +- '<div class="billing-empty-column-title">Before you start</div>' +- '<div class="billing-empty-points billing-empty-points-stack">' +- '<div class="billing-empty-point"><strong>One request</strong><span>Keep a single billing request active instead of bouncing across sections.</span></div>' +- '<div class="billing-empty-point"><strong>Identity first</strong><span>Verification happens before any sensitive account action opens.</span></div>' +- '<div class="billing-empty-point"><strong>Stay focused</strong><span>Use the hosted billing cards above when the request is tied to a hosted workspace account.</span></div>' ++ '<div class="billing-empty-flow"><strong>Billing</strong><span>Manage self-hosted plans, invoices, and payment methods.</span></div>' ++ '<div class="billing-empty-flow"><strong>Licenses</strong><span>Recover the latest active self-hosted license and invoice link.</span></div>' ++ '<div class="billing-empty-flow"><strong>Refunds</strong><span>Check eligibility before revoking active self-hosted access.</span></div>' ++ '<div class="billing-empty-flow"><strong>Privacy</strong><span>Request export or deletion for commercial account data.</span></div>' +'</div>' +'</div>' +'</div>' +@@ -1223,10 +1211,10 @@ export function renderAuthenticatedPortalHTML(context: ShellViewContext): string'<div class="billing-empty-section billing-empty-section-support">' +'<div class="billing-empty-column-title">Escalation</div>' +'<div class="billing-empty-checklist">' +- '<div class="billing-empty-check"><strong>Escalate quickly</strong><span>If hosted billing or the self-hosted tools do not behave as expected, escalate from this section.</span></div>' +- '<div class="billing-empty-check"><strong>Billing packet</strong><span>Bring the billing tool, commercial email, and the exact failed action so support starts with the same request state.</span></div>' ++ '<div class="billing-empty-check"><strong>Use support last</strong><span>Only after hosted billing or one self-hosted path fails.</span></div>' ++ '<div class="billing-empty-check"><strong>Send the same request</strong><span>Include the billing path, account or commercial email, and the failed step.</span></div>' +'</div>' +- '<div class="billing-empty-support">Need help with billing, refund, privacy, or license requests? <a class="portal-support-link" href="mailto:' ++ '<div class="billing-empty-support">Need escalation for billing, refund, privacy, or license work? <a class="portal-support-link" href="mailto:' +escapeAttr(context.bootstrap.support_email || '') +'">' +escapeHTML(context.bootstrap.support_email || '') +