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.

feat(cloudcp): tailor Pulse Account for self-hosted users

Richard Courtmana6b4e7903798
diff --git a/internal/cloudcp/portal/dist/build_manifest.json b/internal/cloudcp/portal/dist/build_manifest.json
index 6dd5db5939..29da1b9e25 100644
--- a/internal/cloudcp/portal/dist/build_manifest.json
+++ b/internal/cloudcp/portal/dist/build_manifest.json
@@ -1,5 +1,5 @@
{
- "source_hash": "f6a8fe4433646b19222e045466d685cd413111f5af747e80af1ff31d4cf5d177",
+ "source_hash": "f7ebee392040465797d0eeeae892c4809c1cbdde04e746c84ea4369fde2ae34a",
"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 88c3205440..70fb7d87b8 100644
--- a/internal/cloudcp/portal/dist/portal_app.css
+++ b/internal/cloudcp/portal/dist/portal_app.css
@@ -369,6 +369,39 @@ header .logout-btn:hover {
line-height: 1.6;
max-width: 760px;
}
+.intro-card-self-hosted {
+ background:
+ linear-gradient(
+ 145deg,
+ #fff,
+ #f8fafc 55%,
+ #eef6ff);
+}
+.overview-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
+ gap: 12px;
+ margin-top: 18px;
+}
+.overview-stat {
+ background: rgba(255, 255, 255, .9);
+ border: 1px solid #dbe4f0;
+ border-radius: 12px;
+ padding: 14px 16px;
+}
+.overview-label {
+ display: block;
+ font-size: 12px;
+ color: #64748b;
+ text-transform: uppercase;
+ letter-spacing: .4px;
+ margin-bottom: 6px;
+}
+.overview-stat strong {
+ display: block;
+ font-size: 15px;
+ color: #0f172a;
+}
.service-section {
margin-top: 40px;
}
@@ -593,6 +626,13 @@ header .logout-btn:hover {
.empty-state-spaced {
margin-top: 48px;
}
+.empty-state-self-hosted p + p {
+ margin-top: 12px;
+}
+.empty-state-title {
+ font-weight: 700;
+ color: #0f172a;
+}
.support-copy {
margin-top: 12px;
font-size: 13px;
diff --git a/internal/cloudcp/portal/dist/portal_app.js b/internal/cloudcp/portal/dist/portal_app.js
index 8ecb91a207..320ff5d62c 100644
--- a/internal/cloudcp/portal/dist/portal_app.js
+++ b/internal/cloudcp/portal/dist/portal_app.js
@@ -1367,6 +1367,9 @@
}
// src/shell_view.ts
+ function hasHostedAccounts(bootstrap) {
+ return Array.isArray(bootstrap.accounts) && bootstrap.accounts.length > 0;
+ }
function escapeHTML(value) {
return String(value || "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
}
@@ -1433,14 +1436,21 @@
function renderAccountsHTML(context) {
var safeAccounts = Array.isArray(context.bootstrap.accounts) ? context.bootstrap.accounts : [];
if (safeAccounts.length === 0) {
- return '<div class="empty-state empty-state-spaced"><p>No workspaces found. If you just signed up, check your email for setup instructions.</p><p class="support-copy">Need help? Contact <a href="mailto:' + escapeAttr(context.bootstrap.support_email || "") + '" class="support-link">' + escapeHTML(context.bootstrap.support_email || "") + "</a></p></div>";
+ return '<div class="empty-state empty-state-spaced empty-state-self-hosted"><p class="empty-state-title">No hosted workspaces on this account</p><p>This Pulse Account is still valid for self-hosted billing, license recovery, refunds, and privacy requests. Hosted Cloud or MSP workspaces will appear here when this account owns them.</p><p class="support-copy">Need help? Contact <a href="mailto:' + escapeAttr(context.bootstrap.support_email || "") + '" class="support-link">' + escapeHTML(context.bootstrap.support_email || "") + "</a></p></div>";
}
return safeAccounts.map(function(account) {
return renderAccountSection(account, context.accountAPIBasePath);
}).join("");
}
+ function renderAuthenticatedIntroHTML(context) {
+ if (!hasHostedAccounts(context.bootstrap)) {
+ return '<section class="intro-card intro-card-self-hosted"><h1>Pulse Account</h1><p>This account currently uses Pulse Account for self-hosted commercial services. When you own hosted Cloud workspaces or MSP access, they will appear here in the same account shell.</p><div class="overview-grid"><div class="overview-stat"><span class="overview-label">Signed in as</span><strong>' + escapeHTML(context.bootstrap.email || "") + '</strong></div><div class="overview-stat"><span class="overview-label">Hosted access</span><strong>None on this account</strong></div><div class="overview-stat"><span class="overview-label">Self-hosted services</span><strong>Available below</strong></div></div></section>';
+ }
+ return '<section class="intro-card"><h1>Pulse Account</h1><p>Manage Cloud workspaces, MSP access, and self-hosted commercial account services from one account surface. Hosted workspace lifecycle lives here today, and the self-hosted billing, license recovery, refund, and privacy tools below now share the same Pulse Account shell instead of staying fragmented across public utility pages.</p></section>';
+ }
function renderAuthenticatedPortalHTML(context) {
- return '<section class="intro-card"><h1>Pulse Account</h1><p>Manage Cloud workspaces, MSP access, and self-hosted commercial account services from one account surface. Hosted workspace lifecycle lives here today, and the self-hosted billing, license recovery, refund, and privacy tools below now share the same Pulse Account shell instead of staying fragmented across public utility pages.</p></section><div id="accounts-root">' + renderAccountsHTML(context) + '</div><section class="service-section"><div class="service-header"><h2>Other account services</h2><div class="service-note">Self-hosted commercial account actions now live here. The public utility pages remain as compatibility entry points, not the primary account surface.</div></div><div class="service-grid"><button class="service-card service-card-button" type="button" id="open-manage-service" data-account-service-action="open-service-panel" data-account-service-panel="manage-service-panel" data-account-service-focus="manage-inline-email"><h3>Manage subscriptions</h3><p>Open Stripe billing access for existing self-hosted subscriptions without leaving the Pulse Account shell.</p></button><button class="service-card service-card-button" type="button" id="open-retrieve-service" data-account-service-action="open-service-panel" data-account-service-panel="retrieve-service-panel" data-account-service-focus="retrieve-inline-email"><h3>Retrieve licenses</h3><p>Recover the latest active self-hosted license and invoice link for a commercial email address.</p></button><button class="service-card service-card-button" type="button" id="open-refund-service" data-account-service-action="open-service-panel" data-account-service-panel="refund-service-panel" data-account-service-focus="refund-inline-email"><h3>Refund requests</h3><p>Request an immediate self-serve refund for eligible self-hosted purchases with explicit revocation confirmation.</p></button><button class="service-card service-card-button" type="button" id="open-data-service" data-account-service-action="open-service-panel" data-account-service-panel="data-service-panel" data-account-service-focus="data-export-email"><h3>Data and privacy</h3><p>Request commercial data export or deletion without leaving the account shell.</p></button></div><div class="service-panel" id="manage-service-panel"><div id="manage-service-root"></div></div><div class="service-panel" id="retrieve-service-panel"><div id="retrieve-service-root"></div></div><div class="service-panel" id="refund-service-panel"><div id="refund-service-root"></div></div><div class="service-panel" id="data-service-panel"><h3>Data and privacy</h3><p>Request export or deletion of the commercial data tied to an email address. Payment data held directly by Stripe still requires support handling.</p><div class="subsection"><div id="data-export-root"></div></div><div class="subsection"><div id="data-delete-root"></div></div><div class="helper-text">Payment-card data stays with Stripe. For Stripe deletion support, contact <a href="mailto:' + escapeAttr(context.bootstrap.support_email || "") + '">' + escapeHTML(context.bootstrap.support_email || "") + "</a>.</div></div></section>";
+ var hostedAccounts = hasHostedAccounts(context.bootstrap);
+ return renderAuthenticatedIntroHTML(context) + '<div id="accounts-root">' + renderAccountsHTML(context) + '</div><section class="service-section"><div class="service-header"><h2>' + (hostedAccounts ? "Other account services" : "Self-hosted account services") + '</h2><div class="service-note">' + (hostedAccounts ? "Self-hosted commercial account actions now live here. The public utility pages remain as compatibility entry points, not the primary account surface." : "Use these tools for subscription, license, refund, and privacy actions on self-hosted commercial accounts. The public utility pages remain as compatibility entry points only.") + '</div></div><div class="service-grid"><button class="service-card service-card-button" type="button" id="open-manage-service" data-account-service-action="open-service-panel" data-account-service-panel="manage-service-panel" data-account-service-focus="manage-inline-email"><h3>Manage subscriptions</h3><p>Open Stripe billing access for existing self-hosted subscriptions without leaving the Pulse Account shell.</p></button><button class="service-card service-card-button" type="button" id="open-retrieve-service" data-account-service-action="open-service-panel" data-account-service-panel="retrieve-service-panel" data-account-service-focus="retrieve-inline-email"><h3>Retrieve licenses</h3><p>Recover the latest active self-hosted license and invoice link for a commercial email address.</p></button><button class="service-card service-card-button" type="button" id="open-refund-service" data-account-service-action="open-service-panel" data-account-service-panel="refund-service-panel" data-account-service-focus="refund-inline-email"><h3>Refund requests</h3><p>Request an immediate self-serve refund for eligible self-hosted purchases with explicit revocation confirmation.</p></button><button class="service-card service-card-button" type="button" id="open-data-service" data-account-service-action="open-service-panel" data-account-service-panel="data-service-panel" data-account-service-focus="data-export-email"><h3>Data and privacy</h3><p>Request commercial data export or deletion without leaving the account shell.</p></button></div><div class="service-panel" id="manage-service-panel"><div id="manage-service-root"></div></div><div class="service-panel" id="retrieve-service-panel"><div id="retrieve-service-root"></div></div><div class="service-panel" id="refund-service-panel"><div id="refund-service-root"></div></div><div class="service-panel" id="data-service-panel"><h3>Data and privacy</h3><p>Request export or deletion of the commercial data tied to an email address. Payment data held directly by Stripe still requires support handling.</p><div class="subsection"><div id="data-export-root"></div></div><div class="subsection"><div id="data-delete-root"></div></div><div class="helper-text">Payment-card data stays with Stripe. For Stripe deletion support, contact <a href="mailto:' + escapeAttr(context.bootstrap.support_email || "") + '">' + escapeHTML(context.bootstrap.support_email || "") + "</a>.</div></div></section>";
}
function renderSignedOutPortalHTML(context) {
var statusHTML = "";
diff --git a/internal/cloudcp/portal/frontend/src/shell_view.test.ts b/internal/cloudcp/portal/frontend/src/shell_view.test.ts
index 6e32fc5fd6..6854c94204 100644
--- a/internal/cloudcp/portal/frontend/src/shell_view.test.ts
+++ b/internal/cloudcp/portal/frontend/src/shell_view.test.ts
@@ -75,7 +75,7 @@ describe('shell view', function() {
it('renders empty accounts state with support contact', function() {
var html = renderAccountsHTML(createContext());
- expect(html).toContain('No workspaces found.');
+ expect(html).toContain('No hosted workspaces on this account');
expect(html).toContain('mailto:[email protected]');
expect(html).toContain('[email protected]');
});
@@ -125,6 +125,18 @@ describe('shell view', function() {
expect(html).toContain('id="data-service-panel"');
});
+ it('renders a self-hosted overview when the signed-in account has no hosted workspaces', function() {
+ var html = renderAuthenticatedPortalHTML(createContext());
+
+ expect(html).toContain('This account currently uses Pulse Account for self-hosted commercial services.');
+ expect(html).toContain('Signed in as');
+ expect(html).toContain('[email protected]');
+ expect(html).toContain('Hosted access');
+ expect(html).toContain('None on this account');
+ expect(html).toContain('Self-hosted account services');
+ expect(html).not.toContain('Other account services');
+ });
+
it('renders signed-out portal with error and success login states', function() {
var errorHTML = renderSignedOutPortalHTML(
createContext({
diff --git a/internal/cloudcp/portal/frontend/src/shell_view.ts b/internal/cloudcp/portal/frontend/src/shell_view.ts
index fd771f374b..6f479f9373 100644
--- a/internal/cloudcp/portal/frontend/src/shell_view.ts
+++ b/internal/cloudcp/portal/frontend/src/shell_view.ts
@@ -12,6 +12,10 @@ export interface ShellViewContext {
accountAPIBasePath: string;
}
+function hasHostedAccounts(bootstrap: PortalBootstrapData): boolean {
+ return Array.isArray(bootstrap.accounts) && bootstrap.accounts.length > 0;
+}
+
function escapeHTML(value: unknown): string {
return String(value || '')
.replace(/&/g, '&amp;')
@@ -216,8 +220,9 @@ export function renderAccountsHTML(context: ShellViewContext): string {
var safeAccounts = Array.isArray(context.bootstrap.accounts) ? context.bootstrap.accounts : [];
if (safeAccounts.length === 0) {
return (
- '<div class="empty-state empty-state-spaced">' +
- '<p>No workspaces found. If you just signed up, check your email for setup instructions.</p>' +
+ '<div class="empty-state empty-state-spaced empty-state-self-hosted">' +
+ '<p class="empty-state-title">No hosted workspaces on this account</p>' +
+ '<p>This Pulse Account is still valid for self-hosted billing, license recovery, refunds, and privacy requests. Hosted Cloud or MSP workspaces will appear here when this account owns them.</p>' +
'<p class="support-copy">Need help? Contact <a href="mailto:' +
escapeAttr(context.bootstrap.support_email || '') +
'" class="support-link">' +
@@ -231,17 +236,51 @@ export function renderAccountsHTML(context: ShellViewContext): string {
}).join('');
}
-export function renderAuthenticatedPortalHTML(context: ShellViewContext): string {
+function renderAuthenticatedIntroHTML(context: ShellViewContext): string {
+ if (!hasHostedAccounts(context.bootstrap)) {
+ return (
+ '<section class="intro-card intro-card-self-hosted">' +
+ '<h1>Pulse Account</h1>' +
+ '<p>This account currently uses Pulse Account for self-hosted commercial services. When you own hosted Cloud workspaces or MSP access, they will appear here in the same account shell.</p>' +
+ '<div class="overview-grid">' +
+ '<div class="overview-stat">' +
+ '<span class="overview-label">Signed in as</span>' +
+ '<strong>' + escapeHTML(context.bootstrap.email || '') + '</strong>' +
+ '</div>' +
+ '<div class="overview-stat">' +
+ '<span class="overview-label">Hosted access</span>' +
+ '<strong>None on this account</strong>' +
+ '</div>' +
+ '<div class="overview-stat">' +
+ '<span class="overview-label">Self-hosted services</span>' +
+ '<strong>Available below</strong>' +
+ '</div>' +
+ '</div>' +
+ '</section>'
+ );
+ }
+
return (
'<section class="intro-card">' +
'<h1>Pulse Account</h1>' +
'<p>Manage Cloud workspaces, MSP access, and self-hosted commercial account services from one account surface. Hosted workspace lifecycle lives here today, and the self-hosted billing, license recovery, refund, and privacy tools below now share the same Pulse Account shell instead of staying fragmented across public utility pages.</p>' +
- '</section>' +
+ '</section>'
+ );
+}
+
+export function renderAuthenticatedPortalHTML(context: ShellViewContext): string {
+ var hostedAccounts = hasHostedAccounts(context.bootstrap);
+ return (
+ renderAuthenticatedIntroHTML(context) +
'<div id="accounts-root">' + renderAccountsHTML(context) + '</div>' +
'<section class="service-section">' +
'<div class="service-header">' +
- '<h2>Other account services</h2>' +
- '<div class="service-note">Self-hosted commercial account actions now live here. The public utility pages remain as compatibility entry points, not the primary account surface.</div>' +
+ '<h2>' + (hostedAccounts ? 'Other account services' : 'Self-hosted account services') + '</h2>' +
+ '<div class="service-note">' +
+ (hostedAccounts
+ ? 'Self-hosted commercial account actions now live here. The public utility pages remain as compatibility entry points, not the primary account surface.'
+ : 'Use these tools for subscription, license, refund, and privacy actions on self-hosted commercial accounts. The public utility pages remain as compatibility entry points only.') +
+ '</div>' +
'</div>' +
'<div class="service-grid">' +
'<button class="service-card service-card-button" type="button" id="open-manage-service" data-account-service-action="open-service-panel" data-account-service-panel="manage-service-panel" data-account-service-focus="manage-inline-email">' +
diff --git a/internal/cloudcp/portal/frontend/src/styles.css b/internal/cloudcp/portal/frontend/src/styles.css
index d7cf5dbd4c..cc58eea16c 100644
--- a/internal/cloudcp/portal/frontend/src/styles.css
+++ b/internal/cloudcp/portal/frontend/src/styles.css
@@ -62,6 +62,11 @@
.intro-card { background: linear-gradient(145deg, #fff, #f8fafc); border: 1px solid #dbe4f0; border-radius: 16px; padding: 22px 24px; margin-bottom: 24px; box-shadow: 0 10px 24px rgba(15,23,42,.05); }
.intro-card h1 { margin: 0 0 8px; font-size: 26px; line-height: 1.1; }
.intro-card p { margin: 0; color: #475569; font-size: 15px; line-height: 1.6; max-width: 760px; }
+ .intro-card-self-hosted { background: linear-gradient(145deg, #fff, #f8fafc 55%, #eef6ff); }
+ .overview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 18px; }
+ .overview-stat { background: rgba(255,255,255,.9); border: 1px solid #dbe4f0; border-radius: 12px; padding: 14px 16px; }
+ .overview-label { display: block; font-size: 12px; color: #64748b; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }
+ .overview-stat strong { display: block; font-size: 15px; color: #0f172a; }
.service-section { margin-top: 40px; }
.service-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.service-header h2 { margin: 0; font-size: 20px; font-weight: 700; }
@@ -102,6 +107,8 @@
.empty-state { background: #fff; border: 1px dashed #cbd5e1; border-radius: 10px; padding: 32px; text-align: center; color: #64748b; }
.empty-state p { margin: 0; font-size: 15px; }
.empty-state-spaced { margin-top: 48px; }
+ .empty-state-self-hosted p + p { margin-top: 12px; }
+ .empty-state-title { font-weight: 700; color: #0f172a; }
.support-copy { margin-top: 12px; font-size: 13px; }
.support-link { color: #1d4ed8; }
.badge-role { background: #f1f5f9; color: #64748b; }