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.

Recover unavailable saved settings inside the infrastructure editor

pulse-triage[bot]53e6b8f8c34e
diff --git a/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx b/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx
index 915e87f15e..f82a0a58fb 100644
--- a/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx
+++ b/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx
@@ -340,6 +340,13 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
}
};
+ const handleRetryInventory = () => {
+ ledger.reload();
+ // The editor reads saved node settings separately from the ledger.
+ // Recover that read too after an outage, without a page reload.
+ if (!readOnly()) eventBus.emit('refresh_nodes');
+ };
+
const handleAddSaved = () => {
ledger.reload();
void props.loadDiscoveredNodes();
@@ -759,12 +766,23 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
<Show
when={findEditableNode(connection)}
fallback={
- <div
- role="alert"
- class="rounded-md border border-rose-300 bg-rose-50 px-4 py-3 text-sm text-rose-800 dark:border-rose-900/25 dark:bg-rose-950/25 dark:text-rose-200"
- >
- Couldn't find the saved configuration for {connection.name}. It may have already
- been removed.
+ <div class="space-y-3">
+ <div
+ role="alert"
+ class="rounded-md border border-amber-300 bg-amber-50 px-4 py-3 text-sm text-amber-900 dark:border-amber-900/25 dark:bg-amber-950/25 dark:text-amber-200"
+ >
+ Saved configuration for {connection.name} is unavailable. Retry to read it again
+ before editing.
+ </div>
+ <Button
+ type="button"
+ variant="secondary"
+ size="mdCompact"
+ disabled={ledger.loading()}
+ onClick={handleRetryInventory}
+ >
+ Retry saved configuration
+ </Button>
</div>
}
>
@@ -990,12 +1008,7 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
rows={rows}
inventoryLoading={!ledger.resolvedOnce() || ledger.loading()}
inventoryError={ledger.error()}
- onRetryInventory={() => {
- ledger.reload();
- // The editor reads saved node settings separately from the ledger.
- // Recover that read too after a cold outage, without a page reload.
- if (!readOnly()) eventBus.emit('refresh_nodes');
- }}
+ onRetryInventory={handleRetryInventory}
discoveredNodes={visibleDiscoveredNodes}
discoveryEnabled={props.discoveryEnabled()}
discoveryScanStatus={props.discoveryScanStatus}
diff --git a/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx b/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx
index 240812b1ed..b7a600ed96 100644
--- a/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/InfrastructureWorkspace.test.tsx
@@ -1212,6 +1212,32 @@ describe('InfrastructureWorkspace', () => {
expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
});
+ it('recovers unavailable saved node settings inside the existing manage dialog', async () => {
+ const [savedNodes, setSavedNodes] = createSignal<any[]>([]);
+ const refresh = vi.fn(() => setSavedNodes([{ name: 'zeus', host: 'https://10.0.0.1:8006' }]));
+ const unsubscribe = eventBus.on('refresh_nodes', refresh);
+ try {
+ renderWorkspace({ pveNodes: savedNodes });
+ fireEvent.click(await screen.findByRole('button', { name: 'Manage' }));
+ const dialog = screen.getByRole('dialog');
+ expect(within(dialog).getByRole('alert')).toHaveTextContent(
+ 'Saved configuration for zeus is unavailable',
+ );
+ expect(dialog).not.toHaveTextContent('removed');
+ expect(within(dialog).queryByTestId('proxmox-section')).toBeNull();
+ fireEvent.click(within(dialog).getByRole('button', { name: 'Retry saved configuration' }));
+ expect(refresh).toHaveBeenCalledTimes(1);
+ expect(ledgerReadState.reload).toHaveBeenCalledTimes(1);
+ await waitFor(() =>
+ expect(within(dialog).getByTestId('proxmox-section')).toBeInTheDocument(),
+ );
+ expect(screen.getByRole('dialog')).toBe(dialog);
+ expect(dialog).toHaveAccessibleName('Manage zeus');
+ } finally {
+ unsubscribe();
+ }
+ });
+
it('opens the manage dialog directly from an existing source card', async () => {
renderWorkspace({
pveNodes: () => [{ name: 'zeus', host: 'https://10.0.0.1:8006' } as any],