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 mobile portal tasks in view

rcourtman170b1e5a0709
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 0b97cf1ea8..9aafd4be04 100644
--- a/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md
+++ b/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md
@@ -169,7 +169,11 @@ Core rules:
as a handoff path, not a competing task surface.
21. On phone-width layouts, top-level task navigation must collapse into a
compact task strip so the active job stays above the fold instead of being
- buried below a desktop-style sidebar.
+ buried below a desktop-style sidebar, and the strip must auto-reveal the
+ active task when the user changes jobs.
+22. On phone-width layouts, account identity context must collapse into a
+ compact summary strip ahead of the active task instead of repeating a
+ large desktop intro block before every section.
## Screen Model
@@ -212,7 +216,11 @@ Each signed-in state should render:
8. explicit unavailable-state panels for top-level tasks that are not active
for the current account shape
9. a compact narrow-screen task switcher that preserves task-first navigation
- without letting navigation chrome dominate the page before the active task
+ without letting navigation chrome dominate the page before the active task,
+ while keeping the active task visibly in-frame when the strip scrolls
+10. a compact narrow-screen account context strip that keeps account identity,
+ role, workspace count, and billing state visible without pushing the live
+ task below the fold
## Product-Specific Boundaries
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index f719734a40..9c6475cda8 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -270,7 +270,11 @@ sources and the committed embedded bundle cannot drift silently. The maintained
portal source tree now also owns explicit runtime/bootstrap type definitions
and one task-first shell model across desktop and phone widths: narrow-screen
navigation must collapse the same bootstrap-driven task shell into a compact
-task strip, not a second mobile-only route or DOM contract.
+task strip, not a second mobile-only route or DOM contract, and the runtime
+must keep the active task visibly in-frame when that strip scrolls. That same
+shared bootstrap shell must also compress account identity into a compact
+mobile summary strip rather than introducing a second narrow-screen
+account-context payload or task-specific DOM contract.
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 62ee6e9876..1649b1b920 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -828,6 +828,9 @@ permission-honest and roster-led, billing must reduce to one obvious job at a
time with hosted billing first when relevant, support must stay a failed-path
handoff rather than a peer workflow, and phone-width layouts must collapse the
desktop task sidebar into a compact task strip so the active job remains
-primary. 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.
+primary and visibly in-frame when the strip scrolls. The same narrow-screen
+shell must also compress account identity into a compact summary strip instead
+of repeating a desktop-sized intro block ahead of every task. 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.json
index 26145eb175..043449ea87 100644
--- a/internal/cloudcp/portal/dist/build_manifest.json
+++ b/internal/cloudcp/portal/dist/build_manifest.json
@@ -1,5 +1,5 @@
{
- "source_hash": "d476dc57983dfa359bbf680d0b056c99d52bd7af411ea774b33a68aeb136aa1e",
+ "source_hash": "3690b79424d3a69414153e2956cba926223ccf39dac75d744fc83f8a09a68712",
"build_inputs": [
"package.json",
"tsconfig.json",
@@ -28,6 +28,7 @@
"src/index.ts",
"src/runtime.test.ts",
"src/runtime.ts",
+ "src/shell.test.ts",
"src/shell.ts",
"src/shell_view.test.ts",
"src/shell_view.ts",
diff --git a/internal/cloudcp/portal/dist/portal_app.css b/internal/cloudcp/portal/dist/portal_app.css
index d2afab14f2..88f2ba7650 100644
--- a/internal/cloudcp/portal/dist/portal_app.css
+++ b/internal/cloudcp/portal/dist/portal_app.css
@@ -2918,6 +2918,8 @@ header .logout-btn:hover,
padding: 10px 12px 12px;
overflow-x: auto;
overscroll-behavior-x: contain;
+ scroll-padding-inline: 12px;
+ scroll-snap-type: x proximity;
scrollbar-width: none;
}
.portal-shell-nav-group::-webkit-scrollbar {
@@ -2927,6 +2929,7 @@ header .logout-btn:hover,
flex: 0 0 auto;
min-width: 118px;
padding: 10px 10px;
+ scroll-snap-align: start;
}
.portal-shell-nav-row {
align-items: flex-start;
@@ -2952,6 +2955,59 @@ header .logout-btn:hover,
padding-left: 16px;
padding-right: 16px;
}
+ .portal-account-context {
+ gap: 10px;
+ padding-top: 10px;
+ padding-bottom: 10px;
+ }
+ .portal-account-context-copy {
+ gap: 4px;
+ }
+ .portal-account-context-meta,
+ .portal-account-context-copy p {
+ display: none;
+ }
+ .portal-account-context-row {
+ gap: 6px;
+ }
+ .portal-account-context-row h2 {
+ font-size: 18px;
+ line-height: 1.02;
+ }
+ .portal-account-context-chips {
+ gap: 6px;
+ }
+ .account-context-chip {
+ min-height: 20px;
+ padding: 0 7px;
+ font-size: 10px;
+ }
+ .portal-account-context-summary {
+ display: grid;
+ grid-template-columns: repeat(3, minmax(0, 1fr));
+ gap: 8px;
+ width: 100%;
+ padding: 0;
+ border: none;
+ border-radius: 0;
+ background: transparent;
+ box-shadow: none;
+ }
+ .portal-account-context-stat {
+ gap: 2px;
+ padding: 8px 0 0;
+ border-top: 1px solid var(--line);
+ border-radius: 0;
+ }
+ .portal-account-context-stat + .portal-account-context-stat {
+ border-left: none;
+ }
+ .portal-account-context-stat span {
+ font-size: 9px;
+ }
+ .portal-account-context-stat strong {
+ font-size: 11px;
+ }
.workspace-management-header,
.access-management-header,
.billing-header,
diff --git a/internal/cloudcp/portal/dist/portal_app.js b/internal/cloudcp/portal/dist/portal_app.js
index 2ebbd4cc2e..9b6edfcd9c 100644
--- a/internal/cloudcp/portal/dist/portal_app.js
+++ b/internal/cloudcp/portal/dist/portal_app.js
@@ -2109,17 +2109,31 @@
// src/shell.ts
function installShell(deps) {
+ function revealActiveNavLink(activeLink) {
+ if (!activeLink) return;
+ var group = activeLink.closest(".portal-shell-nav-group");
+ if (!group || group.scrollWidth <= group.clientWidth) return;
+ if (typeof activeLink.scrollIntoView === "function") {
+ activeLink.scrollIntoView({ block: "nearest", inline: "center" });
+ }
+ }
function syncShellSection() {
var root = document.querySelector(".portal-shell");
var activeSection = deps.store.getShellState().activeSection;
+ var activeLink = null;
if (root) {
root.setAttribute("data-shell-section", activeSection);
}
var links = document.querySelectorAll('[data-shell-action="activate-section"]');
links.forEach(function(node) {
var button = node;
- button.classList.toggle("active", button.getAttribute("data-shell-section") === activeSection);
+ var isActive = button.getAttribute("data-shell-section") === activeSection;
+ button.classList.toggle("active", isActive);
+ if (isActive && button.classList.contains("portal-shell-nav-link")) {
+ activeLink = button;
+ }
});
+ revealActiveNavLink(activeLink);
}
function renderHeader() {
var userInfo = document.getElementById("portal-user-info");
diff --git a/internal/cloudcp/portal/frontend/src/shell.test.ts b/internal/cloudcp/portal/frontend/src/shell.test.ts
new file mode 100644
index 0000000000..8599e99330
--- /dev/null
+++ b/internal/cloudcp/portal/frontend/src/shell.test.ts
@@ -0,0 +1,79 @@
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { installShell } from './shell';
+import { createPortalStore } from './store';
+import type { PortalBootstrapData } from './types';
+
+const bootstrapDefaults: Omit<PortalBootstrapData, 'authenticated' | 'email' | 'accounts'> = {
+ public_site_url: 'https://pulserelay.pro',
+ support_email: '[email protected]',
+ commercial_api_base_url: '/api/portal/commercial',
+ portal_path: '/portal',
+ bootstrap_path: '/api/portal/bootstrap',
+ magic_link_request_path: '/api/public/magic-link/request',
+ signup_path: '/signup',
+ logout_path: '/auth/logout',
+ account_api_base_path: '/api/accounts',
+ portal_api_base_path: '/api/portal',
+};
+
+describe('shell runtime', function() {
+ beforeEach(function() {
+ document.body.innerHTML = `
+ <div id="portal-user-info"></div>
+ <div id="portal-app-root"></div>
+ `;
+ vi.restoreAllMocks();
+ });
+
+ it('reveals the active task in the compact mobile nav strip when the section changes', 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,
+ workspaces: [],
+ },
+ ],
+ });
+ var scrollIntoView = vi.fn();
+ Object.defineProperty(HTMLElement.prototype, 'scrollIntoView', {
+ configurable: true,
+ value: scrollIntoView,
+ });
+
+ installShell({ store: store });
+
+ var navGroup = document.querySelector('.portal-shell-nav-group') as HTMLElement | null;
+ expect(navGroup).not.toBeNull();
+ if (!navGroup) return;
+
+ Object.defineProperty(navGroup, 'scrollWidth', {
+ configurable: true,
+ get: function() {
+ return 640;
+ },
+ });
+ Object.defineProperty(navGroup, 'clientWidth', {
+ configurable: true,
+ get: function() {
+ return 220;
+ },
+ });
+
+ scrollIntoView.mockClear();
+ store.setActiveShellSection('access');
+
+ var activeLink = document.querySelector('.portal-shell-nav-link.active') as HTMLElement | null;
+ expect(activeLink?.getAttribute('data-shell-section')).toBe('access');
+ expect(scrollIntoView).toHaveBeenCalledTimes(1);
+ expect(scrollIntoView).toHaveBeenCalledWith({ block: 'nearest', inline: 'center' });
+ });
+});
diff --git a/internal/cloudcp/portal/frontend/src/shell.ts b/internal/cloudcp/portal/frontend/src/shell.ts
index 296820edf9..85d81fab98 100644
--- a/internal/cloudcp/portal/frontend/src/shell.ts
+++ b/internal/cloudcp/portal/frontend/src/shell.ts
@@ -12,17 +12,32 @@ export interface ShellDeps {
}
export function installShell(deps: ShellDeps): void {
+ function revealActiveNavLink(activeLink: HTMLElement | null) {
+ if (!activeLink) return;
+ var group = activeLink.closest('.portal-shell-nav-group') as HTMLElement | null;
+ if (!group || group.scrollWidth <= group.clientWidth) return;
+ if (typeof activeLink.scrollIntoView === 'function') {
+ activeLink.scrollIntoView({ block: 'nearest', inline: 'center' });
+ }
+ }
+
function syncShellSection() {
var root = document.querySelector('.portal-shell') as HTMLElement | null;
var activeSection = deps.store.getShellState().activeSection;
+ var activeLink: HTMLElement | null = null;
if (root) {
root.setAttribute('data-shell-section', activeSection);
}
var links = document.querySelectorAll('[data-shell-action="activate-section"]');
links.forEach(function(node) {
var button = node as HTMLElement;
- button.classList.toggle('active', button.getAttribute('data-shell-section') === activeSection);
+ var isActive = button.getAttribute('data-shell-section') === activeSection;
+ button.classList.toggle('active', isActive);
+ if (isActive && button.classList.contains('portal-shell-nav-link')) {
+ activeLink = button;
+ }
});
+ revealActiveNavLink(activeLink);
}
function renderHeader() {
diff --git a/internal/cloudcp/portal/frontend/src/shell_view.test.ts b/internal/cloudcp/portal/frontend/src/shell_view.test.ts
index e81b2c6662..ffd2abd80a 100644
--- a/internal/cloudcp/portal/frontend/src/shell_view.test.ts
+++ b/internal/cloudcp/portal/frontend/src/shell_view.test.ts
@@ -270,6 +270,41 @@ describe('shell view', function() {
expect(html).not.toContain('Services');
});
+ it('renders one compact account context strip with three summary facts', function() {
+ var html = renderAuthenticatedPortalHTML(
+ createContext({
+ bootstrap: createBootstrap({
+ accounts: [
+ {
+ id: 'acct_context',
+ name: 'Context Account',
+ kind: 'cloud',
+ kind_label: 'Cloud',
+ role: 'admin',
+ can_manage: true,
+ has_billing: true,
+ workspaces: [
+ {
+ id: 'ws_context',
+ display_name: 'Context Workspace',
+ state: 'active',
+ healthy: true,
+ health_status: 'healthy',
+ },
+ ],
+ },
+ ],
+ }),
+ })
+ );
+
+ expect((html.match(/portal-account-context\"/g) || []).length).toBe(1);
+ expect((html.match(/portal-account-context-stat/g) || []).length).toBe(3);
+ expect((html.match(/account-context-chip\"/g) || []).length).toBe(3);
+ expect(html).toContain('Admin access');
+ expect(html).toContain('Billing enabled');
+ });
+
it('renders a view-only access surface when the account cannot manage access', function() {
var html = renderAuthenticatedPortalHTML(
createContext({
diff --git a/internal/cloudcp/portal/frontend/src/styles.css b/internal/cloudcp/portal/frontend/src/styles.css
index 3c52dcd674..e530aae17e 100644
--- a/internal/cloudcp/portal/frontend/src/styles.css
+++ b/internal/cloudcp/portal/frontend/src/styles.css
@@ -3211,6 +3211,8 @@ header .logout-btn:hover,
padding: 10px 12px 12px;
overflow-x: auto;
overscroll-behavior-x: contain;
+ scroll-padding-inline: 12px;
+ scroll-snap-type: x proximity;
scrollbar-width: none;
}
@@ -3222,6 +3224,7 @@ header .logout-btn:hover,
flex: 0 0 auto;
min-width: 118px;
padding: 10px 10px;
+ scroll-snap-align: start;
}
.portal-shell-nav-row {
@@ -3254,6 +3257,71 @@ header .logout-btn:hover,
padding-right: 16px;
}
+ .portal-account-context {
+ gap: 10px;
+ padding-top: 10px;
+ padding-bottom: 10px;
+ }
+
+ .portal-account-context-copy {
+ gap: 4px;
+ }
+
+ .portal-account-context-meta,
+ .portal-account-context-copy p {
+ display: none;
+ }
+
+ .portal-account-context-row {
+ gap: 6px;
+ }
+
+ .portal-account-context-row h2 {
+ font-size: 18px;
+ line-height: 1.02;
+ }
+
+ .portal-account-context-chips {
+ gap: 6px;
+ }
+
+ .account-context-chip {
+ min-height: 20px;
+ padding: 0 7px;
+ font-size: 10px;
+ }
+
+ .portal-account-context-summary {
+ display: grid;
+ grid-template-columns: repeat(3, minmax(0, 1fr));
+ gap: 8px;
+ width: 100%;
+ padding: 0;
+ border: none;
+ border-radius: 0;
+ background: transparent;
+ box-shadow: none;
+ }
+
+ .portal-account-context-stat {
+ gap: 2px;
+ padding: 8px 0 0;
+ border-top: 1px solid var(--line);
+ border-radius: 0;
+ }
+
+ .portal-account-context-stat + .portal-account-context-stat {
+ border-left: none;
+ }
+
+ .portal-account-context-stat span {
+ font-size: 9px;
+ }
+
+ .portal-account-context-stat strong {
+ font-size: 11px;
+ }
+
.workspace-management-header,
.access-management-header,
.billing-header,