mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-25 04:33:03 +00:00
infrastructure workspace — drop retired ignored-row drawer and stop-monitor dialog
Phase 9 deleted InfrastructureIgnoredRowDetails and InfrastructureStopMonitoringDialog; remove the lingering imports and JSX, collapse the manage-action switch to the single surviving 'connection' kind, stop reaching into useInfrastructureOperationsContext for state hooks that no longer exist, and update the workspace test to drop the now-obsolete reporting-row / ignored-row scaffolding. Contract-neutral: no public-contract delta. The retired surfaces were already deleted in the prior phase-9 commit; this pass only scrubs the compile-time references they left behind.
This commit is contained in:
@@ -1,23 +1,16 @@
|
||||
import { Component, Show, createEffect, createMemo, createSignal } from 'solid-js';
|
||||
import { useLocation, useNavigate } from '@solidjs/router';
|
||||
import { Dialog } from '@/components/shared/Dialog';
|
||||
import { presentationPolicyIsReadOnly } from '@/stores/sessionPresentationPolicy';
|
||||
import { AgentProfilesPanel } from './AgentProfilesPanel';
|
||||
import { ConnectionDetailDrawer } from './ConnectionDetailDrawer';
|
||||
import { ConnectionsTable, type ConnectionsTableHeaderAction } from './ConnectionsTable';
|
||||
import {
|
||||
buildInfrastructureSystemRows,
|
||||
type InfrastructureSystemRow,
|
||||
type SystemManageAction,
|
||||
} from './connectionsTableModel';
|
||||
import type { InfrastructureSystemRow, SystemManageAction } from './connectionsTableModel';
|
||||
import { ConnectionEditor } from './ConnectionEditor/ConnectionEditor';
|
||||
import { NodeCredentialSlot } from './ConnectionEditor/CredentialSlots/NodeCredentialSlot';
|
||||
import { TrueNASCredentialSlot } from './ConnectionEditor/CredentialSlots/TrueNASCredentialSlot';
|
||||
import { VMwareCredentialSlot } from './ConnectionEditor/CredentialSlots/VMwareCredentialSlot';
|
||||
import type { ConnectionType } from '@/api/connections';
|
||||
import { InfrastructureInstallerSection } from './InfrastructureInstallerSection';
|
||||
import { InfrastructureIgnoredRowDetails } from './InfrastructureIgnoredRowDetails';
|
||||
import { InfrastructureStopMonitoringDialog } from './InfrastructureStopMonitoringDialog';
|
||||
import {
|
||||
buildInfrastructureWorkspacePath,
|
||||
deriveAddStepFromLocation,
|
||||
@@ -25,10 +18,7 @@ import {
|
||||
} from './infrastructureWorkspaceModel';
|
||||
import type { InfrastructurePlatformSettingsProps } from './proxmoxSettingsModel';
|
||||
import { useConnectionsLedger } from './useConnectionsLedger';
|
||||
import {
|
||||
InfrastructureOperationsStateProvider,
|
||||
useInfrastructureOperationsContext,
|
||||
} from './useInfrastructureOperationsState';
|
||||
import { InfrastructureOperationsStateProvider } from './useInfrastructureOperationsState';
|
||||
|
||||
export type InfrastructureWorkspaceProps = InfrastructurePlatformSettingsProps;
|
||||
|
||||
@@ -44,7 +34,6 @@ const ADD_STEP_TO_TYPE: Record<InfrastructureAddStep, ConnectionType> = {
|
||||
const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> = (props) => {
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const state = useInfrastructureOperationsContext();
|
||||
const ledger = useConnectionsLedger();
|
||||
|
||||
const [addMode, setAddMode] = createSignal(false);
|
||||
@@ -79,14 +68,6 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
|
||||
setShowAgentProfiles(false);
|
||||
});
|
||||
|
||||
// Auto-open the agent installer when a setup handoff is waiting.
|
||||
createEffect(() => {
|
||||
if (state.setupHandoff?.() && !addMode() && !readOnly()) {
|
||||
setAddMode(true);
|
||||
setInitialAddType('agent');
|
||||
}
|
||||
});
|
||||
|
||||
// Drop add mode in read-only sessions.
|
||||
createEffect(() => {
|
||||
if (readOnly() && addMode()) {
|
||||
@@ -94,13 +75,7 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
|
||||
}
|
||||
});
|
||||
|
||||
const rows = createMemo<InfrastructureSystemRow[]>(() => [
|
||||
...ledger.rows(),
|
||||
...buildInfrastructureSystemRows({
|
||||
activeRows: [],
|
||||
monitoringStoppedRows: state.monitoringStoppedRows(),
|
||||
}),
|
||||
]);
|
||||
const rows = createMemo<InfrastructureSystemRow[]>(() => ledger.rows());
|
||||
|
||||
const headerActions = createMemo<ConnectionsTableHeaderAction[]>(() =>
|
||||
readOnly()
|
||||
@@ -119,20 +94,8 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
|
||||
);
|
||||
|
||||
const handleManageAction = (action: SystemManageAction) => {
|
||||
switch (action.kind) {
|
||||
case 'connection':
|
||||
state.setSelectedIgnoredRowKey(null);
|
||||
setSelectedConnectionId(action.connectionId);
|
||||
return;
|
||||
case 'inventory-ignored':
|
||||
setSelectedConnectionId(null);
|
||||
state.setSelectedIgnoredRowKey(action.rowKey);
|
||||
return;
|
||||
case 'inventory-active':
|
||||
// Legacy active-row path retired; unified rows use the connection drawer.
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
if (action.kind === 'connection') {
|
||||
setSelectedConnectionId(action.connectionId);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -254,21 +217,6 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
|
||||
connection={selectedConnection}
|
||||
onClose={() => setSelectedConnectionId(null)}
|
||||
/>
|
||||
|
||||
{/* Ignored system detail drawer (retires with phase 9). */}
|
||||
<Dialog
|
||||
isOpen={Boolean(state.selectedIgnoredRow())}
|
||||
onClose={() => state.setSelectedIgnoredRowKey(null)}
|
||||
layout="drawer-right"
|
||||
panelClass="max-w-[760px]"
|
||||
ariaLabel="Ignored item details"
|
||||
>
|
||||
<Show when={state.selectedIgnoredRow()}>
|
||||
{(rowAccessor) => <InfrastructureIgnoredRowDetails rowAccessor={rowAccessor} />}
|
||||
</Show>
|
||||
</Dialog>
|
||||
|
||||
<InfrastructureStopMonitoringDialog />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,22 +1,14 @@
|
||||
import { cleanup, fireEvent, render, screen, waitFor } from '@solidjs/testing-library';
|
||||
import { createSignal } from 'solid-js';
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { Connection } from '@/api/connections';
|
||||
import type { UnifiedAgentRow } from '../infrastructureOperationsModel';
|
||||
import { InfrastructureWorkspace } from '../InfrastructureWorkspace';
|
||||
|
||||
let mockPathname = '/settings/infrastructure';
|
||||
let mockSearch = '';
|
||||
const navigateSpy = vi.hoisted(() => vi.fn());
|
||||
const presentationPolicyIsReadOnlyMock = vi.hoisted(() => vi.fn(() => false));
|
||||
const setExpandedRowKeySpy = vi.hoisted(() => vi.fn());
|
||||
const setSelectedIgnoredRowKeySpy = vi.hoisted(() => vi.fn());
|
||||
|
||||
let mockActiveRows: UnifiedAgentRow[] = [];
|
||||
let mockIgnoredRows: UnifiedAgentRow[] = [];
|
||||
let mockConnections: Connection[] = [];
|
||||
const [selectedActiveRowKey, setSelectedActiveRowKey] = createSignal<string | null>(null);
|
||||
const [selectedIgnoredRowKey, setSelectedIgnoredRowKey] = createSignal<string | null>(null);
|
||||
|
||||
vi.mock('@solidjs/router', async () => {
|
||||
const actual = await vi.importActual<typeof import('@solidjs/router')>('@solidjs/router');
|
||||
@@ -33,23 +25,6 @@ vi.mock('@/stores/sessionPresentationPolicy', () => ({
|
||||
|
||||
vi.mock('../useInfrastructureOperationsState', () => ({
|
||||
InfrastructureOperationsStateProvider: (props: { children: unknown }) => <>{props.children}</>,
|
||||
useInfrastructureOperationsContext: () => ({
|
||||
activeRows: () => mockActiveRows,
|
||||
monitoringStoppedRows: () => mockIgnoredRows,
|
||||
selectedActiveRow: () =>
|
||||
mockActiveRows.find((row) => row.rowKey === selectedActiveRowKey()) ?? null,
|
||||
selectedIgnoredRow: () =>
|
||||
mockIgnoredRows.find((row) => row.rowKey === selectedIgnoredRowKey()) ?? null,
|
||||
setExpandedRowKey: (value: string | null) => {
|
||||
setExpandedRowKeySpy(value);
|
||||
setSelectedActiveRowKey(value);
|
||||
},
|
||||
setSelectedIgnoredRowKey: (value: string | null) => {
|
||||
setSelectedIgnoredRowKeySpy(value);
|
||||
setSelectedIgnoredRowKey(value);
|
||||
},
|
||||
setupHandoff: () => null,
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock('../InfrastructureInstallerSection', () => ({
|
||||
@@ -72,14 +47,6 @@ vi.mock('../ConnectionEditor/CredentialSlots/VMwareCredentialSlot', () => ({
|
||||
VMwareCredentialSlot: () => <div data-testid="vmware-section">vmware</div>,
|
||||
}));
|
||||
|
||||
vi.mock('../InfrastructureIgnoredRowDetails', () => ({
|
||||
InfrastructureIgnoredRowDetails: () => <div data-testid="ignored-details">ignored details</div>,
|
||||
}));
|
||||
|
||||
vi.mock('../InfrastructureStopMonitoringDialog', () => ({
|
||||
InfrastructureStopMonitoringDialog: () => <div data-testid="stop-monitoring-dialog" />,
|
||||
}));
|
||||
|
||||
vi.mock('../AgentProfilesPanel', () => ({
|
||||
AgentProfilesPanel: () => <div data-testid="agent-profiles">profiles</div>,
|
||||
}));
|
||||
@@ -112,33 +79,6 @@ const connectionFixture = (overrides: Partial<Connection> = {}): Connection => (
|
||||
...overrides,
|
||||
});
|
||||
|
||||
const reportingRow = (overrides: Partial<UnifiedAgentRow> = {}): UnifiedAgentRow =>
|
||||
({
|
||||
rowKey: 'agent:tower',
|
||||
id: 'tower',
|
||||
name: 'tower',
|
||||
hostname: 'tower.local',
|
||||
capabilities: ['agent'],
|
||||
status: 'active',
|
||||
healthStatus: 'online',
|
||||
lastSeen: Date.now(),
|
||||
upgradePlatform: 'linux',
|
||||
scope: { label: 'Default', category: 'default' },
|
||||
installFlags: [],
|
||||
searchText: 'tower',
|
||||
surfaces: [
|
||||
{
|
||||
key: 'agent',
|
||||
kind: 'agent',
|
||||
label: 'Host telemetry',
|
||||
detail: 'Host telemetry',
|
||||
action: 'stop-monitoring',
|
||||
controlId: 'tower',
|
||||
},
|
||||
],
|
||||
...overrides,
|
||||
}) as UnifiedAgentRow;
|
||||
|
||||
const setShowNodeModalSpy = vi.fn();
|
||||
const setEditingNodeSpy = vi.fn();
|
||||
const setCurrentNodeTypeSpy = vi.fn();
|
||||
@@ -177,19 +117,13 @@ describe('InfrastructureWorkspace', () => {
|
||||
navigateSpy.mockReset();
|
||||
presentationPolicyIsReadOnlyMock.mockReset();
|
||||
presentationPolicyIsReadOnlyMock.mockReturnValue(false);
|
||||
setExpandedRowKeySpy.mockReset();
|
||||
setSelectedIgnoredRowKeySpy.mockReset();
|
||||
setShowNodeModalSpy.mockReset();
|
||||
setEditingNodeSpy.mockReset();
|
||||
setCurrentNodeTypeSpy.mockReset();
|
||||
setModalResetKeySpy.mockReset();
|
||||
mockPathname = '/settings/infrastructure';
|
||||
mockSearch = '';
|
||||
mockActiveRows = [reportingRow()];
|
||||
mockIgnoredRows = [];
|
||||
mockConnections = [connectionFixture()];
|
||||
setSelectedActiveRowKey(null);
|
||||
setSelectedIgnoredRowKey(null);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -322,7 +256,6 @@ describe('InfrastructureWorkspace', () => {
|
||||
fireEvent.click(screen.getByRole('button', { name: 'View details' }));
|
||||
|
||||
expect(screen.getByRole('dialog', { name: 'Connection details' })).toBeInTheDocument();
|
||||
expect(setExpandedRowKeySpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('redirects legacy install deep link and pre-selects the agent credential slot', async () => {
|
||||
|
||||
Reference in New Issue
Block a user