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.

Open portal on real tasks first

rcourtmanba1f9ac9f3aa
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 873baf9d5d..b6918cd280 100644
--- a/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md
+++ b/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md
@@ -278,6 +278,11 @@ Core rules:
presentation, and hierarchy driven by spacing, typography, and dividers
instead of dashboard chrome, decorative dark rails, nested card stacks,
or dense pill collections competing with the active job.
+42. The signed-in shell must also open on the first live task, not the
+ summary layer. Hosted accounts should land in `Workspaces`; self-hosted-
+ only accounts should land in `Billing`. `Overview` remains available as a
+ precise triage surface, but it must not be the default first impression
+ for authenticated users.
## Screen Model
@@ -303,6 +308,9 @@ Each signed-in state should render:
1. a concise overview band that answers `Needs attention`, `Ready`, and `Next
action`
The overview band is shell-level triage, not one repeated card per account.
+ The overview band remains available from navigation, but authenticated
+ users should open on the first live task for the current account shape
+ rather than landing here by default.
2. account cards with role, account kind, workspace totals, and account-level
fleet status
3. an explicit `Workspaces` area for open, create, and lifecycle actions
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 09bf90cde7..0e20c1771a 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -324,6 +324,10 @@ self-hosted commercial history is relevant to the signed-in account, so
hosted-only accounts do not render self-hosted license, refund, privacy, or
self-hosted escalation paths by default, and self-hosted-only accounts do not
front-load an empty hosted-billing block before the real self-hosted jobs.
+That same typed bootstrap/runtime contract must also derive the default signed-
+in shell section from account shape: hosted accounts open on `Workspaces`,
+self-hosted-only accounts open on `Billing`, and `Overview` remains available
+as triage instead of acting as the default authenticated landing layer.
The same account-shape runtime contract must also keep the shell navigation
honest: unavailable hosted `Workspaces` or `Access` tasks must read as
unavailable in the nav itself rather than implying live hosted work. `Support` follows the same
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index b2cbba133c..5fedeee67d 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -911,6 +911,10 @@ Navigation chrome, account framing, and overview panels must stay visually
quieter than the active task surface, with flatter light treatment and
list-first task presentation instead of dark ornamental rails or nested
explanatory cards.
+That same owned shell must also open on the first live job instead of the
+summary layer: hosted accounts should land in `Workspaces`, and self-hosted-
+only accounts should land in `Billing`. `Overview` remains part of the shell,
+but it is triage, not the default authenticated landing surface.
That same owned shell also owns the signed-out visual posture: the unauthenticated
`/portal` page must read like the same product boundary, not a leftover
marketing block plus a generic login card. The auth surface should present one
diff --git a/internal/cloudcp/portal/dist/build_manifest.json b/internal/cloudcp/portal/dist/build_manifest.json
index a3779a172d..6f05cf3af1 100644
--- a/internal/cloudcp/portal/dist/build_manifest.json
+++ b/internal/cloudcp/portal/dist/build_manifest.json
@@ -1,5 +1,5 @@
{
- "source_hash": "f7f77f15e1e887cf22dbf1d2761f62f85af88f539f80de9e7b84facb9c43c890",
+ "source_hash": "ce6e280f3787d7661ec4b3c30bb7997ff7a0df50d8dac23eeb0d44dcd7daf574",
"build_inputs": [
"package.json",
"tsconfig.json",
@@ -33,6 +33,7 @@
"src/runtime.ts",
"src/shell.test.ts",
"src/shell.ts",
+ "src/shell_section.ts",
"src/shell_view.test.ts",
"src/shell_view.ts",
"src/state.test.ts",
diff --git a/internal/cloudcp/portal/dist/portal_app.js b/internal/cloudcp/portal/dist/portal_app.js
index 9c7ea117f9..9a354c4e30 100644
--- a/internal/cloudcp/portal/dist/portal_app.js
+++ b/internal/cloudcp/portal/dist/portal_app.js
@@ -717,6 +717,23 @@
};
}
+ // src/shell_section.ts
+ function preferredPortalShellSection(bootstrap) {
+ var accounts = Array.isArray(bootstrap.accounts) ? bootstrap.accounts : [];
+ var hasHostedAccounts2 = accounts.length > 0;
+ var hasSelfHostedCommercial2 = bootstrap.has_self_hosted_commercial === true || !hasHostedAccounts2;
+ if (!bootstrap.authenticated) {
+ return "overview";
+ }
+ if (hasHostedAccounts2) {
+ return "workspaces";
+ }
+ if (hasSelfHostedCommercial2) {
+ return "billing";
+ }
+ return "overview";
+ }
+
// src/state.ts
function emptyStatus() {
return {
@@ -751,9 +768,9 @@
byAccountID: {}
};
}
- function createPortalShellState() {
+ function createPortalShellState(initialBootstrap) {
return {
- activeSection: "overview"
+ activeSection: preferredPortalShellSection(initialBootstrap)
};
}
function createMutationState() {
@@ -2480,7 +2497,7 @@
var accounts = Array.isArray(context.bootstrap.accounts) ? context.bootstrap.accounts : [];
var hosted = hasHostedAccounts(accounts);
var showSelfHostedCommercial = hasSelfHostedCommercial(context.bootstrap);
- var activeSection = context.activeSection || "overview";
+ var activeSection = context.activeSection || preferredPortalShellSection(context.bootstrap);
var hostedBillingCount = accounts.filter(function(account) {
return account.has_billing;
}).length;
@@ -2619,7 +2636,7 @@
var accountState = createPortalAccountState();
syncPortalAccountStateBootstrap(accountState, bootstrapState.accounts || []);
var loginState = createPortalLoginState();
- var shellState = createPortalShellState();
+ var shellState = createPortalShellState(bootstrapState);
var billingState = createPortalBillingState();
syncLoginStateBootstrapEmail(loginState, bootstrapState.email || "");
syncBillingStateBootstrapEmail(billingState, bootstrapState.email || "");
diff --git a/internal/cloudcp/portal/frontend/src/shell.test.ts b/internal/cloudcp/portal/frontend/src/shell.test.ts
index c94c1d5acf..a3ae2ab1af 100644
--- a/internal/cloudcp/portal/frontend/src/shell.test.ts
+++ b/internal/cloudcp/portal/frontend/src/shell.test.ts
@@ -78,4 +78,29 @@ describe('shell runtime', function() {
expect(scrollIntoView).toHaveBeenCalledTimes(1);
expect(scrollIntoView).toHaveBeenCalledWith({ block: 'nearest', inline: 'center' });
});
+
+ it('opens hosted accounts on workspaces by default', function() {
+ var store = createPortalStore(bootstrapDefaults, {
+ authenticated: true,
+ email: '[email protected]',
+ accounts: [
+ {
+ id: 'acct_default',
+ name: 'Acme MSP',
+ kind: 'msp',
+ kind_label: 'MSP',
+ role: 'owner',
+ can_manage: true,
+ has_billing: true,
+ members: [],
+ workspaces: [],
+ },
+ ],
+ });
+
+ installShell({ store: store });
+
+ var activeLink = document.querySelector('.portal-shell-nav-link.active') as HTMLElement | null;
+ expect(activeLink?.getAttribute('data-shell-section')).toBe('workspaces');
+ });
});
diff --git a/internal/cloudcp/portal/frontend/src/shell_section.ts b/internal/cloudcp/portal/frontend/src/shell_section.ts
new file mode 100644
index 0000000000..63c06257bc
--- /dev/null
+++ b/internal/cloudcp/portal/frontend/src/shell_section.ts
@@ -0,0 +1,20 @@
+import type { PortalBootstrapData, PortalShellSection } from './types';
+
+export function preferredPortalShellSection(
+ bootstrap: Pick<PortalBootstrapData, 'authenticated' | 'has_self_hosted_commercial' | 'accounts'>
+): PortalShellSection {
+ var accounts = Array.isArray(bootstrap.accounts) ? bootstrap.accounts : [];
+ var hasHostedAccounts = accounts.length > 0;
+ var hasSelfHostedCommercial = bootstrap.has_self_hosted_commercial === true || !hasHostedAccounts;
+
+ if (!bootstrap.authenticated) {
+ return 'overview';
+ }
+ if (hasHostedAccounts) {
+ return 'workspaces';
+ }
+ if (hasSelfHostedCommercial) {
+ return 'billing';
+ }
+ return 'overview';
+}
diff --git a/internal/cloudcp/portal/frontend/src/shell_view.test.ts b/internal/cloudcp/portal/frontend/src/shell_view.test.ts
index 2075adabcd..4f1dbb64fe 100644
--- a/internal/cloudcp/portal/frontend/src/shell_view.test.ts
+++ b/internal/cloudcp/portal/frontend/src/shell_view.test.ts
@@ -234,6 +234,30 @@ describe('shell view', function() {
expect(html).not.toContain('>Privacy<');
});
+ it('defaults the authenticated hosted shell to workspaces', function() {
+ var html = renderAuthenticatedPortalHTML(
+ createContext({
+ bootstrap: createBootstrap({
+ accounts: [
+ {
+ id: 'acct_default',
+ name: 'Default Account',
+ kind: 'cloud',
+ kind_label: 'Cloud',
+ role: 'owner',
+ can_manage: true,
+ has_billing: true,
+ members: [],
+ workspaces: [],
+ },
+ ],
+ }),
+ })
+ );
+
+ expect(html).toContain('data-shell-section="workspaces"');
+ });
+
it('renders mixed billing tools only when self-hosted commercial history is relevant', function() {
var html = renderAuthenticatedPortalHTML(
createContext({
@@ -278,6 +302,19 @@ describe('shell view', function() {
expect(html).toContain('Escalate with the same hosted billing action or self-hosted path and the exact failed step.');
});
+ it('defaults the authenticated self-hosted shell to billing', function() {
+ var html = renderAuthenticatedPortalHTML(
+ createContext({
+ bootstrap: createBootstrap({
+ has_self_hosted_commercial: true,
+ accounts: [],
+ }),
+ })
+ );
+
+ expect(html).toContain('data-shell-section="billing"');
+ });
+
it('keeps top-level task navigation in the canonical section order', function() {
var html = renderAuthenticatedPortalHTML(
createContext({
@@ -307,11 +344,11 @@ describe('shell view', function() {
})
);
- var overviewIndex = html.indexOf('data-shell-section="overview"');
- var workspacesIndex = html.indexOf('data-shell-section="workspaces"');
- var accessIndex = html.indexOf('data-shell-section="access"');
- var billingIndex = html.indexOf('data-shell-section="billing"');
- var supportIndex = html.indexOf('data-shell-section="support"');
+ var overviewIndex = html.indexOf('data-shell-action="activate-section" data-shell-section="overview"');
+ var workspacesIndex = html.indexOf('data-shell-action="activate-section" data-shell-section="workspaces"');
+ var accessIndex = html.indexOf('data-shell-action="activate-section" data-shell-section="access"');
+ var billingIndex = html.indexOf('data-shell-action="activate-section" data-shell-section="billing"');
+ var supportIndex = html.indexOf('data-shell-action="activate-section" data-shell-section="support"');
expect(overviewIndex).toBeGreaterThan(-1);
expect(workspacesIndex).toBeGreaterThan(overviewIndex);
diff --git a/internal/cloudcp/portal/frontend/src/shell_view.ts b/internal/cloudcp/portal/frontend/src/shell_view.ts
index b766df2122..37bda845dc 100644
--- a/internal/cloudcp/portal/frontend/src/shell_view.ts
+++ b/internal/cloudcp/portal/frontend/src/shell_view.ts
@@ -6,6 +6,7 @@ import type {
PortalWorkspaceSummary,
} from './types';
import { portalRoleLabel } from './account_roles';
+import { preferredPortalShellSection } from './shell_section';
import { workspaceHealthLabel, workspaceHealthState, workspaceRowNote, workspaceStatusCopy } from './workspace_presentation';
export interface ShellViewContext {
@@ -1369,7 +1370,7 @@ export function renderAuthenticatedPortalHTML(context: ShellViewContext): string
var accounts = Array.isArray(context.bootstrap.accounts) ? context.bootstrap.accounts : [];
var hosted = hasHostedAccounts(accounts);
var showSelfHostedCommercial = hasSelfHostedCommercial(context.bootstrap);
- var activeSection = context.activeSection || 'overview';
+ var activeSection = context.activeSection || preferredPortalShellSection(context.bootstrap);
var hostedBillingCount = accounts.filter(function(account) {
return account.has_billing;
}).length;
diff --git a/internal/cloudcp/portal/frontend/src/state.ts b/internal/cloudcp/portal/frontend/src/state.ts
index 7888e469f4..dee203b8cd 100644
--- a/internal/cloudcp/portal/frontend/src/state.ts
+++ b/internal/cloudcp/portal/frontend/src/state.ts
@@ -3,6 +3,7 @@ import type {
PortalAccountState,
PortalAccountSummary,
PortalAccountUIEntry,
+ PortalBootstrapData,
PortalLoginState,
PortalShellState,
PortalBillingFlowID,
@@ -13,6 +14,7 @@ import type {
PortalAccessMember,
VerificationFlowState,
} from './types';
+import { preferredPortalShellSection } from './shell_section';
export function emptyStatus(): BillingStatus {
return {
@@ -51,9 +53,11 @@ export function createPortalAccountState(): PortalAccountState {
};
}
-export function createPortalShellState(): PortalShellState {
+export function createPortalShellState(
+ initialBootstrap: Pick<PortalBootstrapData, 'authenticated' | 'has_self_hosted_commercial' | 'accounts'>
+): PortalShellState {
return {
- activeSection: 'overview',
+ activeSection: preferredPortalShellSection(initialBootstrap),
};
}
diff --git a/internal/cloudcp/portal/frontend/src/store.test.ts b/internal/cloudcp/portal/frontend/src/store.test.ts
index 25083cbd34..50361b9454 100644
--- a/internal/cloudcp/portal/frontend/src/store.test.ts
+++ b/internal/cloudcp/portal/frontend/src/store.test.ts
@@ -54,6 +54,39 @@ describe('portal store', function() {
expect(bootstrap.portal_path).toBe('/portal');
});
+ it('defaults authenticated hosted accounts to the workspaces section', function() {
+ var store = createPortalStore(bootstrapDefaults, {
+ authenticated: true,
+ email: '[email protected]',
+ accounts: [
+ {
+ id: 'acct_1',
+ name: 'Acme MSP',
+ kind: 'msp',
+ kind_label: 'MSP',
+ role: 'owner',
+ can_manage: true,
+ has_billing: true,
+ members: [],
+ workspaces: [],
+ },
+ ],
+ });
+
+ expect(store.getShellState().activeSection).toBe('workspaces');
+ });
+
+ it('defaults authenticated self-hosted-only accounts to the billing section', function() {
+ var store = createPortalStore(bootstrapDefaults, {
+ authenticated: true,
+ email: '[email protected]',
+ has_self_hosted_commercial: true,
+ accounts: [],
+ });
+
+ expect(store.getShellState().activeSection).toBe('billing');
+ });
+
it('publishes bootstrap changes through a subscription boundary', function() {
var store = createPortalStore(bootstrapDefaults, null);
var listener = vi.fn();
diff --git a/internal/cloudcp/portal/frontend/src/store.ts b/internal/cloudcp/portal/frontend/src/store.ts
index 1cd0eb8aae..941da8c2fb 100644
--- a/internal/cloudcp/portal/frontend/src/store.ts
+++ b/internal/cloudcp/portal/frontend/src/store.ts
@@ -69,7 +69,7 @@ export function createPortalStore(
var accountState = createPortalAccountState();
syncPortalAccountStateBootstrap(accountState, bootstrapState.accounts || []);
var loginState = createPortalLoginState();
- var shellState = createPortalShellState();
+ var shellState = createPortalShellState(bootstrapState);
var billingState = createPortalBillingState();
syncLoginStateBootstrapEmail(loginState, bootstrapState.email || '');
syncBillingStateBootstrapEmail(billingState, bootstrapState.email || '');