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.

fix(portal): render add workspace form in workspaces desk

rcourtman522e974aecb9
diff --git a/internal/cloudcp/portal/dist/build_manifest.json b/internal/cloudcp/portal/dist/build_manifest.json
index 2f3de09f7f..256492d9f8 100644
--- a/internal/cloudcp/portal/dist/build_manifest.json
+++ b/internal/cloudcp/portal/dist/build_manifest.json
@@ -1,5 +1,5 @@
{
- "source_hash": "701968fdb414b6c491562acad4e2ab401253e3bb5972d65b497de106d9acfaed",
+ "source_hash": "43ec243fc7950b1f9391bb4b28f719f9e02b29e9d3ad095906766983560c8ec3",
"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 31b6ed9cb4..6200e251c1 100644
--- a/internal/cloudcp/portal/dist/portal_app.js
+++ b/internal/cloudcp/portal/dist/portal_app.js
@@ -1826,19 +1826,13 @@
var activeCount = countWorkspacesByState(workspaces, "active");
var postureTitle = unhealthyCount > 0 ? "Hosted posture needs review" : checkingCount > 0 ? "Hosted posture is still settling" : "Hosted posture is stable";
var postureCopy = unhealthyCount > 0 ? "One or more workspaces still need attention before the hosted fleet is trustworthy." : checkingCount > 0 ? "The hosted fleet is mostly healthy, but some workspaces are still waiting on a completed health check." : "The hosted fleet is healthy and ready for routine operator work.";
- var addWorkspaceForm = "";
var nextStepTitle = unhealthyCount > 0 ? "Start in Workspaces" : checkingCount > 0 ? "Review pending checks" : "Fleet is clear";
var nextStepCopy = unhealthyCount > 0 ? "One or more workspaces need review before you treat the hosted fleet as trustworthy." : checkingCount > 0 ? "The fleet is mostly healthy, but there are still workspaces waiting on a completed health check." : "Hosted posture looks stable. Move into team or account services only if you need to change access or billing.";
var nextStepChecklist = unhealthyCount > 0 ? '<div class="overview-next-checklist"><div class="overview-next-check"><strong>1. Review attention items</strong><span>Open the fleet and inspect any workspace marked as checking or needs attention.</span></div><div class="overview-next-check"><strong>2. Resolve operator blockers</strong><span>Use Team if the right people are not already attached to the hosted account.</span></div><div class="overview-next-check"><strong>3. Escalate billing separately</strong><span>Keep account billing or self-hosted license work out of the workspace review flow.</span></div></div>' : checkingCount > 0 ? '<div class="overview-next-checklist"><div class="overview-next-check"><strong>1. Verify pending health checks</strong><span>Open the workspaces still settling and confirm they are safe to operate.</span></div><div class="overview-next-check"><strong>2. Keep the roster lean</strong><span>Review Team only if a pending workspace needs a different operator mix.</span></div><div class="overview-next-check"><strong>3. Leave billing as a separate action</strong><span>Use account services or billing only when the hosted fleet is already understood.</span></div></div>' : '<div class="overview-next-checklist"><div class="overview-next-check"><strong>1. Use Workspaces for the next operational task</strong><span>Open a client workspace directly when you are ready to do hosted work.</span></div><div class="overview-next-check"><strong>2. Use Team for access changes only</strong><span>Keep roster changes explicit instead of mixing them into routine workspace work.</span></div><div class="overview-next-check"><strong>3. Use account services when the task is commercial</strong><span>Licenses, refunds, privacy, and self-hosted billing stay in their own section.</span></div></div>';
var nextStepActions = '<div class="overview-next-actions"><button class="btn-primary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="workspaces">Open workspaces</button><button class="btn-secondary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="' + (account.can_manage ? "team" : "services") + '">' + (account.can_manage ? "Review team access" : "Open account services") + "</button></div>";
- if (account.can_manage) {
- if (account.kind === "msp") {
- addWorkspaceForm = '<div class="add-workspace-form" id="add-ws-form-' + escapeAttr(account.id) + '"><label for="ws-name-' + escapeAttr(account.id) + '">Workspace name (for example, a client name)</label><input type="text" id="ws-name-' + escapeAttr(account.id) + '" placeholder="Acme Corp" maxlength="80" autocomplete="off"><div class="form-actions"><button type="button" class="btn-primary" data-action="create-workspace" data-account-id="' + escapeAttr(account.id) + '">Create workspace</button><button type="button" class="btn-secondary" data-action="toggle-add-workspace" data-account-id="' + escapeAttr(account.id) + '">Cancel</button><div class="spinner" id="ws-spinner-' + escapeAttr(account.id) + '" hidden></div></div></div>';
- }
- }
return '<section class="account-content-panel account-content-panel-overview"><div class="account-stage-header account-stage-header-overview"><div><div class="account-panel-kicker">Overview</div><h3>Hosted posture</h3><p>Start here to judge fleet posture, pick the next operator action, and keep commercial account work separate from hosted operations.</p></div></div><div class="account-command-deck"><div class="account-overview-card"><div class="account-overview-lead"><div class="account-panel-kicker">Fleet posture</div><h3>' + escapeHTML(postureTitle) + "</h3><p>" + escapeHTML(postureCopy) + '</p><div class="account-overview-callout">' + escapeHTML(
account.kind === "msp" ? "Use this console to run client workspaces, account billing, and operator access from one place." : "Use this console to run hosted workspaces, account billing, and operator access from one place."
- ) + '</div></div><div class="account-metric-strip"><div class="account-stat-card account-stat-card-inline"><span class="account-stat-label">Active workspaces</span><span class="account-stat-value">' + String(activeCount) + '</span></div><div class="account-stat-card account-stat-card-inline"><span class="account-stat-label">Healthy</span><span class="account-stat-value account-stat-healthy">' + String(healthyCount) + '</span></div><div class="account-stat-card account-stat-card-inline"><span class="account-stat-label">Checking</span><span class="account-stat-value account-stat-checking">' + String(checkingCount) + '</span></div><div class="account-stat-card account-stat-card-inline"><span class="account-stat-label">Needs attention</span><span class="account-stat-value account-stat-unhealthy">' + String(unhealthyCount) + "</span></div></div></div>" + addWorkspaceForm + '<div class="account-overview-secondary"><div class="overview-side-card overview-side-card-primary"><div class="account-panel-kicker">Next move</div><h4>' + escapeHTML(nextStepTitle) + "</h4><p>" + escapeHTML(nextStepCopy) + "</p>" + nextStepChecklist + nextStepActions + "</div>" + renderAttentionPanel(workspaces) + "</div></div></section>";
+ ) + '</div></div><div class="account-metric-strip"><div class="account-stat-card account-stat-card-inline"><span class="account-stat-label">Active workspaces</span><span class="account-stat-value">' + String(activeCount) + '</span></div><div class="account-stat-card account-stat-card-inline"><span class="account-stat-label">Healthy</span><span class="account-stat-value account-stat-healthy">' + String(healthyCount) + '</span></div><div class="account-stat-card account-stat-card-inline"><span class="account-stat-label">Checking</span><span class="account-stat-value account-stat-checking">' + String(checkingCount) + '</span></div><div class="account-stat-card account-stat-card-inline"><span class="account-stat-label">Needs attention</span><span class="account-stat-value account-stat-unhealthy">' + String(unhealthyCount) + '</span></div></div></div><div class="account-overview-secondary"><div class="overview-side-card overview-side-card-primary"><div class="account-panel-kicker">Next move</div><h4>' + escapeHTML(nextStepTitle) + "</h4><p>" + escapeHTML(nextStepCopy) + "</p>" + nextStepChecklist + nextStepActions + "</div>" + renderAttentionPanel(workspaces) + "</div></div></section>";
}
function renderAccountWorkspaceSection(account, accountAPIBasePath) {
var workspaces = Array.isArray(account.workspaces) ? account.workspaces : [];
@@ -1846,16 +1840,18 @@
var checkingCount = countWorkspacesByHealth(workspaces, "checking");
var unhealthyCount = countWorkspacesByHealth(workspaces, "unhealthy");
var workspaceManagement = "";
+ var addWorkspaceForm = "";
if (account.can_manage) {
var workspaceDeskActions = "";
if (account.kind === "msp") {
workspaceDeskActions += '<button type="button" class="btn-secondary btn-compact" data-action="toggle-add-workspace" data-account-id="' + escapeAttr(account.id) + '">Add workspace</button>';
+ addWorkspaceForm = '<div class="add-workspace-form" id="add-ws-form-' + escapeAttr(account.id) + '"><label for="ws-name-' + escapeAttr(account.id) + '">Workspace name (for example, a client name)</label><input type="text" id="ws-name-' + escapeAttr(account.id) + '" placeholder="Acme Corp" maxlength="80" autocomplete="off"><div class="form-actions"><button type="button" class="btn-primary" data-action="create-workspace" data-account-id="' + escapeAttr(account.id) + '">Create workspace</button><button type="button" class="btn-secondary" data-action="toggle-add-workspace" data-account-id="' + escapeAttr(account.id) + '">Cancel</button><div class="spinner" id="ws-spinner-' + escapeAttr(account.id) + '" hidden></div></div></div>';
}
if (account.has_billing) {
workspaceDeskActions += '<button type="button" class="btn-secondary btn-compact" data-action="open-billing" data-account-id="' + escapeAttr(account.id) + '">Manage billing</button>';
}
workspaceDeskActions += '<button type="button" class="btn-secondary btn-compact" data-action="toggle-team" data-account-id="' + escapeAttr(account.id) + '" data-shell-target="team">Manage team</button>';
- workspaceManagement = '<section class="workspace-management-panel" id="workspace-management-' + escapeAttr(account.id) + '"><div class="workspace-management-header"><div><div class="account-panel-kicker">Workspace management</div><h3>Review one workspace at a time</h3><p>Select a workspace from the fleet to review its lifecycle state and run explicit management actions.</p></div><button type="button" class="btn-secondary btn-compact" id="workspace-management-close-' + escapeAttr(account.id) + '" data-action="clear-workspace-selection" data-account-id="' + escapeAttr(account.id) + '">Done</button></div><div class="workspace-management-empty" id="workspace-management-empty-' + escapeAttr(account.id) + '"><div class="workspace-management-empty-copy">Pick a workspace to open its operator desk.</div><div class="workspace-management-empty-grid"><div class="workspace-management-empty-card"><div class="account-panel-kicker">Account desk</div><h4>Keep account actions close</h4><p>Workspace review happens here while billing, team, and create-workspace actions stay within reach.</p><div class="workspace-management-empty-actions">' + workspaceDeskActions + '</div></div><div class="workspace-management-empty-card workspace-management-empty-card-muted"><div class="account-panel-kicker">Desk flow</div><div class="workspace-management-empty-checklist"><div class="workspace-management-empty-check"><strong>Pick the workspace</strong><span>Select a fleet row to load its health, lifecycle, and next management action.</span></div><div class="workspace-management-empty-check"><strong>Read posture first</strong><span>Treat checking or needs-attention workspaces as review work, not routine operations.</span></div><div class="workspace-management-empty-check"><strong>Escalate account changes separately</strong><span>Billing and team changes stay account-wide even when you are focused on one workspace.</span></div></div></div></div></div><div class="workspace-management-content" id="workspace-management-content-' + escapeAttr(account.id) + '" hidden><div class="workspace-management-meta" id="workspace-management-meta-' + escapeAttr(account.id) + '"></div><h4 id="workspace-management-title-' + escapeAttr(account.id) + '"></h4><p class="workspace-management-summary" id="workspace-management-summary-' + escapeAttr(account.id) + '"></p><div class="workspace-management-facts"><div class="workspace-management-fact"><span>Health</span><strong id="workspace-management-health-' + escapeAttr(account.id) + '"></strong></div><div class="workspace-management-fact"><span>Lifecycle</span><strong id="workspace-management-lifecycle-' + escapeAttr(account.id) + '"></strong></div><div class="workspace-management-fact"><span>Created</span><strong id="workspace-management-created-' + escapeAttr(account.id) + '"></strong></div></div><div class="workspace-management-guidance" id="workspace-management-guidance-' + escapeAttr(account.id) + '"></div><div class="workspace-management-actions"><button type="button" class="btn-danger" id="workspace-management-action-' + escapeAttr(account.id) + '" data-action="workspace-action" data-account-id="' + escapeAttr(account.id) + '">Manage workspace</button></div></div></section>';
+ workspaceManagement = '<section class="workspace-management-panel" id="workspace-management-' + escapeAttr(account.id) + '"><div class="workspace-management-header"><div><div class="account-panel-kicker">Workspace management</div><h3>Review one workspace at a time</h3><p>Select a workspace from the fleet to review its lifecycle state and run explicit management actions.</p></div><button type="button" class="btn-secondary btn-compact" id="workspace-management-close-' + escapeAttr(account.id) + '" data-action="clear-workspace-selection" data-account-id="' + escapeAttr(account.id) + '">Done</button></div><div class="workspace-management-empty" id="workspace-management-empty-' + escapeAttr(account.id) + '"><div class="workspace-management-empty-copy">Pick a workspace to open its operator desk.</div><div class="workspace-management-empty-grid"><div class="workspace-management-empty-card"><div class="account-panel-kicker">Account desk</div><h4>Keep account actions close</h4><p>Workspace review happens here while billing, team, and create-workspace actions stay within reach.</p><div class="workspace-management-empty-actions">' + workspaceDeskActions + "</div>" + addWorkspaceForm + '</div><div class="workspace-management-empty-card workspace-management-empty-card-muted"><div class="account-panel-kicker">Desk flow</div><div class="workspace-management-empty-checklist"><div class="workspace-management-empty-check"><strong>Pick the workspace</strong><span>Select a fleet row to load its health, lifecycle, and next management action.</span></div><div class="workspace-management-empty-check"><strong>Read posture first</strong><span>Treat checking or needs-attention workspaces as review work, not routine operations.</span></div><div class="workspace-management-empty-check"><strong>Escalate account changes separately</strong><span>Billing and team changes stay account-wide even when you are focused on one workspace.</span></div></div></div></div></div><div class="workspace-management-content" id="workspace-management-content-' + escapeAttr(account.id) + '" hidden><div class="workspace-management-meta" id="workspace-management-meta-' + escapeAttr(account.id) + '"></div><h4 id="workspace-management-title-' + escapeAttr(account.id) + '"></h4><p class="workspace-management-summary" id="workspace-management-summary-' + escapeAttr(account.id) + '"></p><div class="workspace-management-facts"><div class="workspace-management-fact"><span>Health</span><strong id="workspace-management-health-' + escapeAttr(account.id) + '"></strong></div><div class="workspace-management-fact"><span>Lifecycle</span><strong id="workspace-management-lifecycle-' + escapeAttr(account.id) + '"></strong></div><div class="workspace-management-fact"><span>Created</span><strong id="workspace-management-created-' + escapeAttr(account.id) + '"></strong></div></div><div class="workspace-management-guidance" id="workspace-management-guidance-' + escapeAttr(account.id) + '"></div><div class="workspace-management-actions"><button type="button" class="btn-danger" id="workspace-management-action-' + escapeAttr(account.id) + '" data-action="workspace-action" data-account-id="' + escapeAttr(account.id) + '">Manage workspace</button></div></div></section>';
}
var workspaceHTML = workspaces.length ? '<div class="workspace-list-wrap"><div class="workspace-list-toolbar"><div class="workspace-list-summary">Review the hosted fleet, open a workspace, and keep lifecycle actions explicit.</div><div class="workspace-list-stats"><span class="workspace-list-stat"><strong>' + String(workspaces.length) + '</strong> total</span><span class="workspace-list-stat"><strong>' + String(healthyCount) + '</strong> healthy</span><span class="workspace-list-stat"><strong>' + String(checkingCount) + '</strong> checking</span><span class="workspace-list-stat workspace-list-stat-attention"><strong>' + String(unhealthyCount) + '</strong> needs attention</span></div></div><div class="workspace-list-head"><span>Workspace</span><span>Health</span><span>Lifecycle</span><span>Actions</span></div><div class="workspace-list">' + workspaces.map(function(workspace) {
return renderWorkspaceCard(account, workspace, accountAPIBasePath);
diff --git a/internal/cloudcp/portal/frontend/src/shell_view.test.ts b/internal/cloudcp/portal/frontend/src/shell_view.test.ts
index 1b1fdc4aba..fb99b1d679 100644
--- a/internal/cloudcp/portal/frontend/src/shell_view.test.ts
+++ b/internal/cloudcp/portal/frontend/src/shell_view.test.ts
@@ -172,6 +172,8 @@ describe('shell view', function() {
expect(html).toContain('Desk flow');
expect(html).toContain('Read posture first');
expect(html).toContain('Escalate account changes separately');
+ 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 account actions close'));
expect(html).toContain('data-action="clear-workspace-selection"');
expect(html).toContain('Team management');
expect(html).toContain('Invite someone new');
diff --git a/internal/cloudcp/portal/frontend/src/shell_view.ts b/internal/cloudcp/portal/frontend/src/shell_view.ts
index 234c7f5f07..b542090187 100644
--- a/internal/cloudcp/portal/frontend/src/shell_view.ts
+++ b/internal/cloudcp/portal/frontend/src/shell_view.ts
@@ -352,7 +352,6 @@ function renderAccountOverviewSection(account: PortalAccountSummary): string {
: checkingCount > 0
? 'The hosted fleet is mostly healthy, but some workspaces are still waiting on a completed health check.'
: 'The hosted fleet is healthy and ready for routine operator work.';
- var addWorkspaceForm = '';
var nextStepTitle = unhealthyCount > 0
? 'Start in Workspaces'
: checkingCount > 0
@@ -392,33 +391,6 @@ function renderAccountOverviewSection(account: PortalAccountSummary): string {
'<button class="btn-secondary btn-compact" type="button" data-shell-action="activate-section" data-shell-section="' + (account.can_manage ? 'team' : 'services') + '">' + (account.can_manage ? 'Review team access' : 'Open account services') + '</button>' +
'</div>';
- if (account.can_manage) {
- if (account.kind === 'msp') {
- addWorkspaceForm =
- '<div class="add-workspace-form" id="add-ws-form-' +
- escapeAttr(account.id) +
- '">' +
- '<label for="ws-name-' +
- escapeAttr(account.id) +
- '">Workspace name (for example, a client name)</label>' +
- '<input type="text" id="ws-name-' +
- escapeAttr(account.id) +
- '" placeholder="Acme Corp" maxlength="80" autocomplete="off">' +
- '<div class="form-actions">' +
- '<button type="button" class="btn-primary" data-action="create-workspace" data-account-id="' +
- escapeAttr(account.id) +
- '">Create workspace</button>' +
- '<button type="button" class="btn-secondary" data-action="toggle-add-workspace" data-account-id="' +
- escapeAttr(account.id) +
- '">Cancel</button>' +
- '<div class="spinner" id="ws-spinner-' +
- escapeAttr(account.id) +
- '" hidden></div>' +
- '</div>' +
- '</div>';
- }
- }
-
return (
'<section class="account-content-panel account-content-panel-overview">' +
'<div class="account-stage-header account-stage-header-overview">' +
@@ -458,7 +430,6 @@ function renderAccountOverviewSection(account: PortalAccountSummary): string {
'</div>' +
'</div>' +
'</div>' +
- addWorkspaceForm +
'<div class="account-overview-secondary">' +
'<div class="overview-side-card overview-side-card-primary">' +
'<div class="account-panel-kicker">Next move</div>' +
@@ -480,6 +451,7 @@ function renderAccountWorkspaceSection(account: PortalAccountSummary, accountAPI
var checkingCount = countWorkspacesByHealth(workspaces, 'checking');
var unhealthyCount = countWorkspacesByHealth(workspaces, 'unhealthy');
var workspaceManagement = '';
+ var addWorkspaceForm = '';
if (account.can_manage) {
var workspaceDeskActions = '';
if (account.kind === 'msp') {
@@ -487,6 +459,28 @@ function renderAccountWorkspaceSection(account: PortalAccountSummary, accountAPI
'<button type="button" class="btn-secondary btn-compact" data-action="toggle-add-workspace" data-account-id="' +
escapeAttr(account.id) +
'">Add workspace</button>';
+ addWorkspaceForm =
+ '<div class="add-workspace-form" id="add-ws-form-' +
+ escapeAttr(account.id) +
+ '">' +
+ '<label for="ws-name-' +
+ escapeAttr(account.id) +
+ '">Workspace name (for example, a client name)</label>' +
+ '<input type="text" id="ws-name-' +
+ escapeAttr(account.id) +
+ '" placeholder="Acme Corp" maxlength="80" autocomplete="off">' +
+ '<div class="form-actions">' +
+ '<button type="button" class="btn-primary" data-action="create-workspace" data-account-id="' +
+ escapeAttr(account.id) +
+ '">Create workspace</button>' +
+ '<button type="button" class="btn-secondary" data-action="toggle-add-workspace" data-account-id="' +
+ escapeAttr(account.id) +
+ '">Cancel</button>' +
+ '<div class="spinner" id="ws-spinner-' +
+ escapeAttr(account.id) +
+ '" hidden></div>' +
+ '</div>' +
+ '</div>';
}
if (account.has_billing) {
workspaceDeskActions +=
@@ -525,6 +519,7 @@ function renderAccountWorkspaceSection(account: PortalAccountSummary, accountAPI
'<h4>Keep account actions close</h4>' +
'<p>Workspace review happens here while billing, team, and create-workspace actions stay within reach.</p>' +
'<div class="workspace-management-empty-actions">' + workspaceDeskActions + '</div>' +
+ addWorkspaceForm +
'</div>' +
'<div class="workspace-management-empty-card workspace-management-empty-card-muted">' +
'<div class="account-panel-kicker">Desk flow</div>' +