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.

Reveal mobile workspace jobs

rcourtman81bcaa076b49
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 9aafd4be04..42fba7e7c3 100644
--- a/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md
+++ b/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md
@@ -149,7 +149,8 @@ Core rules:
level, not force the user to scan badges one card at a time.
13. Workspace lifecycle actions must open in an explicit management surface
with the selected workspace context visible, not inside a hidden overflow
- menu or a blind confirm-first interaction.
+ menu or a blind confirm-first interaction. When that management surface or
+ the create-workspace form opens below the fold, the shell must reveal it.
14. Access management must be a visible roster and invite surface, not a table
or control hidden behind unrelated account copy.
15. Support must remain an escalation path, not a peer destination competing
@@ -174,6 +175,9 @@ Core rules:
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.
+23. On phone-width layouts, opening a lower workspace job such as
+ `Lifecycle` or `Create workspace` must reveal that job surface instead of
+ leaving the user at the top of the workspace list.
## 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 9c6475cda8..689fe8af5c 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -274,7 +274,10 @@ 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.
+account-context payload or task-specific DOM contract. When that shared shell
+opens a lower workspace job surface such as lifecycle review or the
+create-workspace form, the runtime must reveal the opened surface instead of
+leaving the user at the top of the list.
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 1649b1b920..5f29abc307 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -830,7 +830,8 @@ 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 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.
+of repeating a desktop-sized intro block ahead of every task, and lower
+workspace job surfaces such as lifecycle review or create-workspace forms must
+be revealed when the user opens them. 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 043449ea87..617cbd42a2 100644
--- a/internal/cloudcp/portal/dist/build_manifest.json
+++ b/internal/cloudcp/portal/dist/build_manifest.json
@@ -1,5 +1,5 @@
{
- "source_hash": "3690b79424d3a69414153e2956cba926223ccf39dac75d744fc83f8a09a68712",
+ "source_hash": "4ca884433efebcd920cfe6345fe269d8b264d66e05544c42e761eaffed854a3c",
"build_inputs": [
"package.json",
"tsconfig.json",
diff --git a/internal/cloudcp/portal/dist/portal_app.css b/internal/cloudcp/portal/dist/portal_app.css
index 88f2ba7650..f61a1e3c29 100644
--- a/internal/cloudcp/portal/dist/portal_app.css
+++ b/internal/cloudcp/portal/dist/portal_app.css
@@ -3008,6 +3008,14 @@ header .logout-btn:hover,
.portal-account-context-stat strong {
font-size: 11px;
}
+ .workspace-operations-shell-selected .workspace-operations-detail,
+ .workspace-operations-shell-form-open .workspace-operations-detail {
+ order: 1;
+ }
+ .workspace-operations-shell-selected .workspace-operations-main,
+ .workspace-operations-shell-form-open .workspace-operations-main {
+ order: 2;
+ }
.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 9b6edfcd9c..62461fd853 100644
--- a/internal/cloudcp/portal/dist/portal_app.js
+++ b/internal/cloudcp/portal/dist/portal_app.js
@@ -123,6 +123,7 @@
if (shell) {
shell.classList.toggle("workspace-operations-shell-selected", hasSelection);
shell.classList.toggle("workspace-operations-shell-idle", !hasSelection);
+ shell.classList.toggle("workspace-operations-shell-form-open", entry.addWorkspaceOpen);
}
if (detail) {
detail.classList.toggle("workspace-operations-detail-selected", hasSelection);
@@ -783,6 +784,29 @@
var getPortalPath = function() {
return deps.store.getBootstrap().portal_path;
};
+ var revealElementIfNeeded = function(element) {
+ if (!element) return;
+ var viewportHeight = window.innerHeight || document.documentElement.clientHeight || 0;
+ if (!viewportHeight) return;
+ var rect = element.getBoundingClientRect();
+ if (rect.top >= 0 && rect.top <= viewportHeight - 72 && rect.bottom > 0) {
+ return;
+ }
+ if (typeof element.scrollIntoView === "function") {
+ element.scrollIntoView({ block: "start", inline: "nearest" });
+ }
+ };
+ var revealElementWhenReady = function(elementID, callback) {
+ var reveal = function() {
+ revealElementIfNeeded(getElement(elementID));
+ if (callback) callback();
+ };
+ if (typeof window.requestAnimationFrame === "function") {
+ window.requestAnimationFrame(reveal);
+ return;
+ }
+ reveal();
+ };
var refreshOrRedirect = async function() {
if (!await deps.refreshBootstrap()) {
window.location.href = getPortalPath();
@@ -841,10 +865,13 @@
shouldFocus = entry.addWorkspaceOpen;
});
if (shouldFocus) {
- focusElement("ws-name-" + accountID);
+ revealElementWhenReady("workspace-management-" + accountID, function() {
+ focusElement("ws-name-" + accountID);
+ });
}
};
var selectWorkspace = function(accountID, workspaceID) {
+ var selectedWorkspaceID = "";
deps.store.updateAccountState(function(accountState) {
var entry = ensurePortalAccountUIEntry(accountState, accountID);
entry.selectedWorkspaceID = entry.selectedWorkspaceID === workspaceID ? "" : workspaceID;
@@ -852,7 +879,11 @@
entry.accessVisible = false;
entry.addWorkspaceOpen = false;
}
+ selectedWorkspaceID = entry.selectedWorkspaceID;
});
+ if (selectedWorkspaceID) {
+ revealElementWhenReady("workspace-management-" + accountID);
+ }
};
var clearWorkspaceSelection = function(accountID) {
deps.store.updateAccountState(function(accountState) {
diff --git a/internal/cloudcp/portal/frontend/src/account_runtime.test.ts b/internal/cloudcp/portal/frontend/src/account_runtime.test.ts
index 3a40686cd2..0f766a3959 100644
--- a/internal/cloudcp/portal/frontend/src/account_runtime.test.ts
+++ b/internal/cloudcp/portal/frontend/src/account_runtime.test.ts
@@ -188,6 +188,144 @@ describe('account runtime', function() {
expect(deps.store.getAccountState().byAccountID.acct_1.selectedWorkspaceID).toBe('');
});
+ it('reveals the lifecycle panel when a workspace job opens below the viewport', function() {
+ deps.store.setBootstrap({
+ 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: [{
+ id: 'ws_2',
+ display_name: 'Alpha Workspace',
+ state: 'active',
+ healthy: true,
+ health_status: 'healthy',
+ }],
+ }],
+ });
+
+ document.body.innerHTML =
+ '<div id="workspace-operations-shell-acct_1" class="workspace-operations-shell workspace-operations-shell-idle">' +
+ '<div id="workspace-operations-detail-acct_1" class="workspace-operations-detail workspace-operations-detail-idle">' +
+ '<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>' +
+ '</div>';
+
+ var panel = document.getElementById('workspace-management-acct_1') as HTMLElement | null;
+ expect(panel).not.toBeNull();
+ if (!panel) return;
+ var scrollIntoView = vi.fn();
+ var requestAnimationFrame = vi.fn(function(callback: FrameRequestCallback) {
+ callback(0);
+ return 1;
+ });
+ Object.defineProperty(window, 'innerHeight', { configurable: true, value: 664 });
+ Object.defineProperty(window, 'requestAnimationFrame', { configurable: true, value: requestAnimationFrame });
+ Object.defineProperty(panel, 'scrollIntoView', { configurable: true, value: scrollIntoView });
+ Object.defineProperty(panel, 'getBoundingClientRect', {
+ configurable: true,
+ value: function() {
+ return {
+ top: 764,
+ bottom: 1433,
+ left: 0,
+ right: 320,
+ width: 320,
+ height: 669,
+ x: 0,
+ y: 764,
+ toJSON: function() { return {}; },
+ };
+ },
+ });
+
+ runtime.selectWorkspace('acct_1', 'ws_2');
+
+ expect(requestAnimationFrame).toHaveBeenCalledTimes(1);
+ expect(scrollIntoView).toHaveBeenCalledWith({ block: 'start', inline: 'nearest' });
+ expect(deps.store.getAccountState().byAccountID.acct_1.selectedWorkspaceID).toBe('ws_2');
+ });
+
+ it('reveals the create workspace form when it opens below the viewport', function() {
+ document.body.innerHTML =
+ '<div id="workspace-operations-shell-acct_1" class="workspace-operations-shell workspace-operations-shell-idle">' +
+ '<div id="workspace-operations-detail-acct_1" class="workspace-operations-detail workspace-operations-detail-idle">' +
+ '<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 id="add-ws-form-acct_1" class="add-workspace-form">' +
+ '<input id="ws-name-acct_1" value="">' +
+ '</div>' +
+ '</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>' +
+ '</div>';
+
+ var panel = document.getElementById('workspace-management-acct_1') as HTMLElement | null;
+ var shell = document.getElementById('workspace-operations-shell-acct_1') as HTMLElement | null;
+ expect(panel).not.toBeNull();
+ if (!panel || !shell) return;
+ var scrollIntoView = vi.fn();
+ var requestAnimationFrame = vi.fn(function(callback: FrameRequestCallback) {
+ callback(0);
+ return 1;
+ });
+ Object.defineProperty(window, 'innerHeight', { configurable: true, value: 664 });
+ Object.defineProperty(window, 'requestAnimationFrame', { configurable: true, value: requestAnimationFrame });
+ Object.defineProperty(panel, 'scrollIntoView', { configurable: true, value: scrollIntoView });
+ Object.defineProperty(panel, 'getBoundingClientRect', {
+ configurable: true,
+ value: function() {
+ return {
+ top: 1324,
+ bottom: 1517,
+ left: 0,
+ right: 320,
+ width: 320,
+ height: 193,
+ x: 0,
+ y: 1324,
+ toJSON: function() { return {}; },
+ };
+ },
+ });
+
+ runtime.toggleAddWorkspace('acct_1');
+
+ expect(requestAnimationFrame).toHaveBeenCalledTimes(1);
+ expect(scrollIntoView).toHaveBeenCalledWith({ block: 'start', inline: 'nearest' });
+ expect(deps.store.getAccountState().byAccountID.acct_1.addWorkspaceOpen).toBe(true);
+ });
+
it('loads and updates team membership from runtime actions', async function() {
vi.stubGlobal(
'fetch',
diff --git a/internal/cloudcp/portal/frontend/src/account_runtime.ts b/internal/cloudcp/portal/frontend/src/account_runtime.ts
index e048f04bac..b30081ff57 100644
--- a/internal/cloudcp/portal/frontend/src/account_runtime.ts
+++ b/internal/cloudcp/portal/frontend/src/account_runtime.ts
@@ -32,6 +32,31 @@ export function installAccountRuntime(deps: AccountRuntimeDeps): AccountRuntime
return deps.store.getBootstrap().portal_path;
};
+ var revealElementIfNeeded = function(element: HTMLElement | null): void {
+ if (!element) return;
+ var viewportHeight = window.innerHeight || document.documentElement.clientHeight || 0;
+ if (!viewportHeight) return;
+ var rect = element.getBoundingClientRect();
+ if (rect.top >= 0 && rect.top <= viewportHeight - 72 && rect.bottom > 0) {
+ return;
+ }
+ if (typeof element.scrollIntoView === 'function') {
+ element.scrollIntoView({ block: 'start', inline: 'nearest' });
+ }
+ };
+
+ var revealElementWhenReady = function(elementID: string, callback?: () => void): void {
+ var reveal = function(): void {
+ revealElementIfNeeded(getElement<HTMLElement>(elementID));
+ if (callback) callback();
+ };
+ if (typeof window.requestAnimationFrame === 'function') {
+ window.requestAnimationFrame(reveal);
+ return;
+ }
+ reveal();
+ };
+
var refreshOrRedirect = async function(): Promise<boolean> {
if (!await deps.refreshBootstrap()) {
window.location.href = getPortalPath();
@@ -94,11 +119,14 @@ export function installAccountRuntime(deps: AccountRuntimeDeps): AccountRuntime
shouldFocus = entry.addWorkspaceOpen;
});
if (shouldFocus) {
- focusElement('ws-name-' + accountID);
+ revealElementWhenReady('workspace-management-' + accountID, function() {
+ focusElement('ws-name-' + accountID);
+ });
}
};
var selectWorkspace = function(accountID: string, workspaceID: string): void {
+ var selectedWorkspaceID = '';
deps.store.updateAccountState(function(accountState) {
var entry = ensurePortalAccountUIEntry(accountState, accountID);
entry.selectedWorkspaceID = entry.selectedWorkspaceID === workspaceID ? '' : workspaceID;
@@ -106,7 +134,11 @@ export function installAccountRuntime(deps: AccountRuntimeDeps): AccountRuntime
entry.accessVisible = false;
entry.addWorkspaceOpen = false;
}
+ selectedWorkspaceID = entry.selectedWorkspaceID;
});
+ if (selectedWorkspaceID) {
+ revealElementWhenReady('workspace-management-' + accountID);
+ }
};
var clearWorkspaceSelection = function(accountID: string): void {
diff --git a/internal/cloudcp/portal/frontend/src/account_view.ts b/internal/cloudcp/portal/frontend/src/account_view.ts
index 6ce30e9554..0b0a37c47b 100644
--- a/internal/cloudcp/portal/frontend/src/account_view.ts
+++ b/internal/cloudcp/portal/frontend/src/account_view.ts
@@ -145,6 +145,7 @@ export function renderWorkspaceManagement(account: PortalAccountSummary, entry:
if (shell) {
shell.classList.toggle('workspace-operations-shell-selected', hasSelection);
shell.classList.toggle('workspace-operations-shell-idle', !hasSelection);
+ shell.classList.toggle('workspace-operations-shell-form-open', entry.addWorkspaceOpen);
}
if (detail) {
detail.classList.toggle('workspace-operations-detail-selected', hasSelection);
diff --git a/internal/cloudcp/portal/frontend/src/styles.css b/internal/cloudcp/portal/frontend/src/styles.css
index e530aae17e..63ce93d2a9 100644
--- a/internal/cloudcp/portal/frontend/src/styles.css
+++ b/internal/cloudcp/portal/frontend/src/styles.css
@@ -3322,6 +3322,16 @@ header .logout-btn:hover,
font-size: 11px;
}
+ .workspace-operations-shell-selected .workspace-operations-detail,
+ .workspace-operations-shell-form-open .workspace-operations-detail {
+ order: 1;
+ }
+
+ .workspace-operations-shell-selected .workspace-operations-main,
+ .workspace-operations-shell-form-open .workspace-operations-main {
+ order: 2;
+ }
+
.workspace-management-header,
.access-management-header,
.billing-header,