Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

Keep portal overview next action permission-honest

rcourtman1deb8285779f
diff --git a/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md b/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md
index f0841cd85e..7830dbb2a8 100644
--- a/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md
+++ b/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md
@@ -236,6 +236,10 @@ Core rules:
describe account role as `Owner`, `Admin`, `Tech`, or `Read-only`, but it
must not leak internal identifiers such as `read_only` or legacy aliases
such as `member`.
+34. `Overview` must also keep `Next action` permission-honest for hosted
+ view-only accounts. When no workspace is ready, the primary route must
+ stay on reviewable `Workspaces` or `Access` surfaces before any blocked
+ hosted billing or owner/admin-only mutation path.
## Screen Model
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 64d8c01c28..2b94cf7f06 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -329,6 +329,10 @@ That same typed runtime contract must also normalize account-role labels before
render: customer-facing copy may say `Owner`, `Admin`, `Tech`, or `Read-only`,
but it must not surface raw runtime identifiers such as `read_only` or legacy
aliases such as `member`.
+That same runtime contract must also keep `Overview` next-action routing
+permission-honest for hosted view-only accounts: when no ready workspace
+exists, the primary route must stay on reviewable `Workspaces` or `Access`
+surfaces before any blocked hosted billing or owner/admin-only mutation path.
plus a package-local `tsc --noEmit` gate, so future account-shell work should
extend the typed source boundary instead of reviving opaque global runtime
objects, document-wide render events, or untyped embedded asset edits.
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index 393d09ee79..3544d35107 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -890,6 +890,10 @@ That same owned shell must also keep role labels on product vocabulary:
customer-facing copy may say `Owner`, `Admin`, `Tech`, or `Read-only`, but it
must not leak internal identifiers such as `read_only` or legacy aliases such
as `member`.
+That same owned `Overview` surface must also keep `Next action`
+permission-honest for hosted view-only users: when no workspace is ready, the
+primary route must stay on reviewable `Workspaces` or `Access` surfaces before
+any blocked hosted billing or owner/admin-only mutation path.
That same canonical shell/runtime boundary now also owns the bootstrap truth
for when self-hosted commercial history is relevant. Hosted-only accounts must
not render self-hosted license, refund, privacy, or support-escalation copy
diff --git a/internal/cloudcp/portal/dist/build_manifest.json b/internal/cloudcp/portal/dist/build_manifest.json
index 893651c46e..d3f19060de 100644
--- a/internal/cloudcp/portal/dist/build_manifest.json
+++ b/internal/cloudcp/portal/dist/build_manifest.json
@@ -1,5 +1,5 @@
{
- "source_hash": "28526fdef0c6ead9b953af6bdd043b5d3666234e37a54c60ae51ad5632805e36",
+ "source_hash": "8b7c5d843287396154b50573fdd2aa95e5d0a1308c252df25fde5597cb96ca7b",
"build_inputs": [
"package.json",
"tsconfig.json",
diff --git a/internal/cloudcp/portal/dist/portal_app.js b/internal/cloudcp/portal/dist/portal_app.js
index c3967badd0..c32965b3c0 100644
--- a/internal/cloudcp/portal/dist/portal_app.js
+++ b/internal/cloudcp/portal/dist/portal_app.js
@@ -1941,6 +1941,13 @@
var accounts = Array.isArray(bootstrap.accounts) ? bootstrap.accounts : [];
return bootstrap.has_self_hosted_commercial === true || !hasHostedAccounts(accounts);
}
+ function countWorkspaces(accounts) {
+ var total = 0;
+ for (var i = 0; i < accounts.length; i += 1) {
+ total += Array.isArray(accounts[i].workspaces) ? accounts[i].workspaces.length : 0;
+ }
+ return total;
+ }
function collectWorkspaces(accounts) {
var results = [];
for (var i = 0; i < accounts.length; i += 1) {
@@ -2234,13 +2241,14 @@
return '<div class="overview-task-item overview-task-item-action"><div class="overview-task-copy"><strong>' + escapeHTML(entry.workspace.display_name) + "</strong><span>" + escapeHTML(overviewWorkspaceContext(entry, includeAccountName, workspaceRowNote(entry.workspace))) + "</span></div>" + renderWorkspaceHandoffForm(entry.account.id, entry.workspace.id, accountAPIBasePath, "Open workspace") + "</div>";
}).join("") + "</div></article>";
}
- function renderOverviewNextActionCard(accounts, entries, accountAPIBasePath) {
+ function renderOverviewNextActionCard(accounts, entries, accountAPIBasePath, showSelfHostedCommercial) {
var attention = attentionOverviewEntries(entries);
var ready = readyOverviewEntries(entries);
var primaryAction = "";
var secondaryAction = "";
var title = "";
var description = "";
+ var totalWorkspaces = countWorkspaces(accounts);
var creatableAccount = accounts.find(function(account) {
return account.kind === "msp" && account.can_manage;
}) || null;
@@ -2250,6 +2258,7 @@
var accessAccount = accounts.find(function(account) {
return account.can_manage;
}) || null;
+ var hostedViewOnly = accounts.length > 0 && !accessAccount;
if (attention.length) {
title = "Review workspace health";
description = attention.length > 1 ? "Open Workspaces and resolve the pending health or lifecycle questions before you do anything else." : "Start in Workspaces with " + attention[0].workspace.display_name + " before you do anything else.";
@@ -2274,6 +2283,18 @@
title = "Open billing";
description = "No hosted workspace is attached, so the next obvious action is Billing for self-hosted subscriptions, licenses, refunds, or privacy requests.";
primaryAction = '<button class="btn-primary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="billing">Open billing</button>';
+ } else if (hostedViewOnly) {
+ if (totalWorkspaces > 0) {
+ title = "Review workspace state";
+ description = "No workspace is ready right now. Open Workspaces to review current state, then hand off any lifecycle or billing change to an owner or admin.";
+ primaryAction = '<button class="btn-primary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="workspaces">Review workspaces</button>';
+ secondaryAction = '<button class="btn-secondary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="access">Review access</button>';
+ } else {
+ title = "Review who can act";
+ description = showSelfHostedCommercial ? "No hosted workspace is attached yet. Review Access to see who can manage this hosted account, or use Billing only when the task is self-hosted." : "No hosted workspace is attached yet. Review Access to see who can create or manage the first workspace on this account.";
+ primaryAction = '<button class="btn-primary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="access">Review access</button>';
+ secondaryAction = showSelfHostedCommercial ? '<button class="btn-secondary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="billing">Open billing</button>' : "";
+ }
} else if (accessAccount) {
title = "Handle access in its own place";
description = "If the next task is people or roles, keep it in Access instead of mixing it into routine workspace work.";
@@ -2302,7 +2323,7 @@
attentionCount > 0 ? String(attentionCount) + " attention" : "Nothing urgent",
suspendedCount > 0 ? String(suspendedCount) + " suspended" : "No suspended"
] : ["No hosted account", "Billing available", "Support only on escalation"];
- return '<section class="account-content-panel account-content-panel-overview"><div class="account-stage-header account-stage-header-overview overview-stage-header"><div><div class="account-panel-kicker">Overview</div><h3>Account triage</h3><p>Only three questions matter here.</p>' + renderSectionContextChips(chips) + '</div></div><div class="overview-task-grid">' + renderOverviewAttentionCard(accounts, entries, showSelfHostedCommercial) + renderOverviewReadyCard(accounts, entries, context.accountAPIBasePath) + renderOverviewNextActionCard(accounts, entries, context.accountAPIBasePath) + "</div></section>";
+ return '<section class="account-content-panel account-content-panel-overview"><div class="account-stage-header account-stage-header-overview overview-stage-header"><div><div class="account-panel-kicker">Overview</div><h3>Account triage</h3><p>Only three questions matter here.</p>' + renderSectionContextChips(chips) + '</div></div><div class="overview-task-grid">' + renderOverviewAttentionCard(accounts, entries, showSelfHostedCommercial) + renderOverviewReadyCard(accounts, entries, context.accountAPIBasePath) + renderOverviewNextActionCard(accounts, entries, context.accountAPIBasePath, showSelfHostedCommercial) + "</div></section>";
}
function renderNoHostedWorkspacesSection() {
return '<section class="account-content-panel account-content-panel-workspaces"><div class="account-stage-header"><div><div class="account-panel-kicker">Workspaces</div><h3>Workspaces</h3><p>No hosted workspace is attached to this account.</p>' + renderSectionContextChips(["None attached", "Billing instead"]) + '</div></div><div class="empty-state empty-state-spaced"><p>There is nothing to open or manage here yet.</p><p class="support-copy">Use Billing for self-hosted subscriptions, licenses, refunds, or privacy requests.</p></div></section>';
diff --git a/internal/cloudcp/portal/frontend/src/shell_view.test.ts b/internal/cloudcp/portal/frontend/src/shell_view.test.ts
index bbc0b2e309..ae6e00d9d8 100644
--- a/internal/cloudcp/portal/frontend/src/shell_view.test.ts
+++ b/internal/cloudcp/portal/frontend/src/shell_view.test.ts
@@ -451,6 +451,68 @@ describe('shell view', function() {
expect(html).not.toContain('READ_ONLY');
});
+ it('keeps next action permission-honest for hosted view-only accounts with no workspace ready', function() {
+ var html = renderAuthenticatedPortalHTML(
+ createContext({
+ bootstrap: createBootstrap({
+ accounts: [
+ {
+ id: 'acct_view_empty',
+ name: 'Empty Hosted Account',
+ kind: 'cloud',
+ kind_label: 'Cloud',
+ role: 'read_only',
+ can_manage: false,
+ has_billing: true,
+ workspaces: [],
+ },
+ ],
+ }),
+ })
+ );
+
+ expect(html).toContain('Review who can act');
+ expect(html).toContain('Review Access to see who can create or manage the first workspace on this account.');
+ expect(html).toContain('Review access');
+ expect(html).not.toContain('Choose the right task path');
+ expect(html).not.toContain('If this is an access change, go to Access. If it is a billing or license issue, go to Billing. Support is only for escalation.');
+ });
+
+ it('keeps next action on review surfaces for suspended hosted view-only accounts', function() {
+ var html = renderAuthenticatedPortalHTML(
+ createContext({
+ bootstrap: createBootstrap({
+ accounts: [
+ {
+ id: 'acct_view_suspended',
+ name: 'Suspended Hosted Account',
+ kind: 'cloud',
+ kind_label: 'Cloud',
+ role: 'read_only',
+ can_manage: false,
+ has_billing: true,
+ workspaces: [
+ {
+ id: 'ws_view_suspended',
+ display_name: 'Paused Workspace',
+ state: 'suspended',
+ healthy: true,
+ health_status: 'healthy',
+ },
+ ],
+ },
+ ],
+ }),
+ })
+ );
+
+ expect(html).toContain('Review workspace state');
+ expect(html).toContain('Open Workspaces to review current state, then hand off any lifecycle or billing change to an owner or admin.');
+ expect(html).toContain('Review workspaces');
+ expect(html).toContain('Review access');
+ expect(html).not.toContain('Choose the right task path');
+ });
+
it('renders self-hosted overview copy when no hosted accounts are attached', function() {
var html = renderAuthenticatedPortalHTML(
createContext({
diff --git a/internal/cloudcp/portal/frontend/src/shell_view.ts b/internal/cloudcp/portal/frontend/src/shell_view.ts
index 5424b2b2d1..ed4b3043fb 100644
--- a/internal/cloudcp/portal/frontend/src/shell_view.ts
+++ b/internal/cloudcp/portal/frontend/src/shell_view.ts
@@ -713,13 +713,19 @@ function renderOverviewReadyCard(
);
}
-function renderOverviewNextActionCard(accounts: PortalAccountSummary[], entries: OverviewWorkspaceEntry[], accountAPIBasePath: string): string {
+function renderOverviewNextActionCard(
+ accounts: PortalAccountSummary[],
+ entries: OverviewWorkspaceEntry[],
+ accountAPIBasePath: string,
+ showSelfHostedCommercial: boolean
+): string {
var attention = attentionOverviewEntries(entries);
var ready = readyOverviewEntries(entries);
var primaryAction = '';
var secondaryAction = '';
var title = '';
var description = '';
+ var totalWorkspaces = countWorkspaces(accounts);
var creatableAccount = accounts.find(function(account) {
return account.kind === 'msp' && account.can_manage;
}) || null;
@@ -729,6 +735,7 @@ function renderOverviewNextActionCard(accounts: PortalAccountSummary[], entries:
var accessAccount = accounts.find(function(account) {
return account.can_manage;
}) || null;
+ var hostedViewOnly = accounts.length > 0 && !accessAccount;
if (attention.length) {
title = 'Review workspace health';
@@ -764,6 +771,22 @@ function renderOverviewNextActionCard(accounts: PortalAccountSummary[], entries:
title = 'Open billing';
description = 'No hosted workspace is attached, so the next obvious action is Billing for self-hosted subscriptions, licenses, refunds, or privacy requests.';
primaryAction = '<button class="btn-primary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="billing">Open billing</button>';
+ } else if (hostedViewOnly) {
+ if (totalWorkspaces > 0) {
+ title = 'Review workspace state';
+ description = 'No workspace is ready right now. Open Workspaces to review current state, then hand off any lifecycle or billing change to an owner or admin.';
+ primaryAction = '<button class="btn-primary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="workspaces">Review workspaces</button>';
+ secondaryAction = '<button class="btn-secondary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="access">Review access</button>';
+ } else {
+ title = 'Review who can act';
+ description = showSelfHostedCommercial
+ ? 'No hosted workspace is attached yet. Review Access to see who can manage this hosted account, or use Billing only when the task is self-hosted.'
+ : 'No hosted workspace is attached yet. Review Access to see who can create or manage the first workspace on this account.';
+ primaryAction = '<button class="btn-primary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="access">Review access</button>';
+ secondaryAction = showSelfHostedCommercial
+ ? '<button class="btn-secondary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="billing">Open billing</button>'
+ : '';
+ }
} else if (accessAccount) {
title = 'Handle access in its own place';
description = 'If the next task is people or roles, keep it in Access instead of mixing it into routine workspace work.';
@@ -820,7 +843,7 @@ function renderShellOverviewSection(context: ShellViewContext): string {
'<div class="overview-task-grid">' +
renderOverviewAttentionCard(accounts, entries, showSelfHostedCommercial) +
renderOverviewReadyCard(accounts, entries, context.accountAPIBasePath) +
- renderOverviewNextActionCard(accounts, entries, context.accountAPIBasePath) +
+ renderOverviewNextActionCard(accounts, entries, context.accountAPIBasePath, showSelfHostedCommercial) +
'</div>' +
'</section>'
);