mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-07-09 16:00:59 +00:00
fix(frontend): hide stale agent prompts in demo mode
This commit is contained in:
parent
c03c3231c1
commit
15856ce760
4 changed files with 41 additions and 1 deletions
|
|
@ -2462,6 +2462,11 @@ payload, but the browser-owned shared primitive is now the resolved
|
|||
monitored-system warning banners, dashboard upsells, Patrol upgrade CTAs,
|
||||
history-lock paywalls, and other public-demo commercial affordances when the
|
||||
browser is rendering a public demo runtime.
|
||||
Platform stale-agent notices are also command-style upgrade affordances:
|
||||
`frontend-modern/src/features/platformPage/PlatformOutdatedAgentNotice.tsx`
|
||||
must stay hidden while the resolved presentation policy marks the session
|
||||
read-only, including public demo mode, even though the same notice remains
|
||||
available for ordinary customer installs that report outdated agents.
|
||||
That same shared settings-shell boundary also owns demo-mode organization
|
||||
suppression. `frontend-modern/src/components/Settings/settingsNavigationModel.ts`,
|
||||
`frontend-modern/src/components/Settings/settingsNavCatalog.ts`,
|
||||
|
|
|
|||
|
|
@ -4833,6 +4833,12 @@ describe('shared primitive guardrails', () => {
|
|||
expect(source).not.toContain('rounded-lg border border-amber-300 bg-amber-50');
|
||||
expect(source).not.toContain('text-amber-900 underline-offset-2');
|
||||
}
|
||||
expect(platformOutdatedAgentNoticeSource).toContain(
|
||||
"import { presentationPolicyIsReadOnly } from '@/stores/sessionPresentationPolicy';",
|
||||
);
|
||||
expect(platformOutdatedAgentNoticeSource).toContain(
|
||||
'const visible = createMemo(() => count() > 0 && !presentationPolicyIsReadOnly());',
|
||||
);
|
||||
});
|
||||
|
||||
it('routes dismissible demo notices through InlineNotice banner primitives', () => {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
import { cleanup, render, screen } from '@solidjs/testing-library';
|
||||
import { afterEach, describe, expect, it } from 'vitest';
|
||||
import { syncSessionPresentationPolicy } from '@/stores/sessionPresentationPolicy';
|
||||
import { PlatformOutdatedAgentNotice } from './PlatformOutdatedAgentNotice';
|
||||
|
||||
afterEach(() => {
|
||||
cleanup();
|
||||
syncSessionPresentationPolicy(null);
|
||||
});
|
||||
|
||||
describe('PlatformOutdatedAgentNotice', () => {
|
||||
|
|
@ -65,6 +67,31 @@ describe('PlatformOutdatedAgentNotice', () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('hides agent upgrade commands when the session presentation policy hides upgrade prompts', () => {
|
||||
syncSessionPresentationPolicy({
|
||||
presentationPolicy: {
|
||||
demoMode: true,
|
||||
readOnly: true,
|
||||
hideCommercial: true,
|
||||
hideUpgrade: true,
|
||||
},
|
||||
});
|
||||
|
||||
render(() => (
|
||||
<PlatformOutdatedAgentNotice
|
||||
hosts={[{ name: 'West Production A', version: 'v5.1.34' }]}
|
||||
targetVersion="v6.0.0-rc.7"
|
||||
missingLabel="agent-contributed Proxmox node detail and command support"
|
||||
copyVariant="latest-detail"
|
||||
actionHref="/settings/infrastructure?agentUpdates=1"
|
||||
actionLabel="Open agent upgrade commands"
|
||||
/>
|
||||
));
|
||||
|
||||
expect(screen.queryByTestId('platform-outdated-agent-notice')).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole('link', { name: 'Open agent upgrade commands' })).toBeNull();
|
||||
});
|
||||
|
||||
it('can describe stale in-guest agents on VMs without host copy', () => {
|
||||
render(() => (
|
||||
<PlatformOutdatedAgentNotice
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { Show, createMemo } from 'solid-js';
|
||||
import { AlertTriangle, ArrowRight } from 'lucide-solid';
|
||||
import { InlineNotice } from '@/components/shared/InlineNotice';
|
||||
import { presentationPolicyIsReadOnly } from '@/stores/sessionPresentationPolicy';
|
||||
import type { OutdatedAgentHost } from './agentVersion';
|
||||
|
||||
type PlatformOutdatedAgentNoticeProps = {
|
||||
|
|
@ -31,6 +32,7 @@ export function PlatformOutdatedAgentNotice(props: PlatformOutdatedAgentNoticePr
|
|||
const actionLabel = createMemo(() => props.actionLabel || 'Open Infrastructure settings');
|
||||
const subjectSingular = createMemo(() => props.subjectSingular || 'host');
|
||||
const subjectPlural = createMemo(() => props.subjectPlural || 'hosts');
|
||||
const visible = createMemo(() => count() > 0 && !presentationPolicyIsReadOnly());
|
||||
|
||||
const message = createMemo(() => {
|
||||
const target = props.targetVersion ? ` to ${props.targetVersion}` : '';
|
||||
|
|
@ -49,7 +51,7 @@ export function PlatformOutdatedAgentNotice(props: PlatformOutdatedAgentNoticePr
|
|||
});
|
||||
|
||||
return (
|
||||
<Show when={count() > 0}>
|
||||
<Show when={visible()}>
|
||||
<InlineNotice
|
||||
role="status"
|
||||
data-testid="platform-outdated-agent-notice"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue