From 87e21e243ec2dccd1506bd109c67faf5add24213 Mon Sep 17 00:00:00 2001 From: Shaun Arman Date: Fri, 12 Jun 2026 21:52:05 -0500 Subject: [PATCH] fix: persist Proxmox settings via localStorage; fix Remotes add/refresh flow - ProxmoxSettings: load all six settings from localStorage on mount via useEffect, wire Save button to write values and show a 2s confirmation, wire Reset button to clear keys and restore defaults - RemotesPage: attach loadRemotes() to the header Refresh button onClick and replace the no-op onRefresh prop passed to RemotesList - EditRemoteForm: add password field to RemoteConfig interface and form so handleEditRemote receives a complete config; use DialogFooter for consistent button layout --- src/components/Proxmox/EditRemoteForm.tsx | 22 +++++++- src/pages/Proxmox/RemotesPage.tsx | 4 +- src/pages/Settings/Proxmox.tsx | 61 +++++++++++++++++++---- 3 files changed, 73 insertions(+), 14 deletions(-) diff --git a/src/components/Proxmox/EditRemoteForm.tsx b/src/components/Proxmox/EditRemoteForm.tsx index ce8dd72b..e31dbec0 100644 --- a/src/components/Proxmox/EditRemoteForm.tsx +++ b/src/components/Proxmox/EditRemoteForm.tsx @@ -3,12 +3,14 @@ import { Button } from '@/components/ui/index'; import { Input } from '@/components/ui/index'; import { Label } from '@/components/ui/index'; import { Alert, AlertDescription, AlertTitle } from '@/components/ui/index'; +import { DialogFooter } from '@/components/ui/index'; interface RemoteConfig { id: string; name: string; url: string; username: string; + password?: string; type: 'pve' | 'pbs'; status: string; } @@ -25,6 +27,7 @@ export function EditRemoteForm({ remote, onSave, onCancel }: EditRemoteFormProps name: remote.name, url: remote.url, username: remote.username, + password: '', type: remote.type, status: remote.status, }); @@ -98,6 +101,21 @@ export function EditRemoteForm({ remote, onSave, onCancel }: EditRemoteFormProps /> +
+ + setConfig({ ...config, password: e.target.value })} + placeholder="Enter new password (leave blank to keep existing)" + disabled={loading} + /> +

+ Leave blank to keep the existing password +

+
+
-
+ -
+ ); diff --git a/src/pages/Proxmox/RemotesPage.tsx b/src/pages/Proxmox/RemotesPage.tsx index f345dbed..816c07ec 100644 --- a/src/pages/Proxmox/RemotesPage.tsx +++ b/src/pages/Proxmox/RemotesPage.tsx @@ -117,7 +117,7 @@ export function ProxmoxRemotesPage() {

Manage Proxmox VE and Backup Server connections

- @@ -130,7 +130,7 @@ export function ProxmoxRemotesPage() { {}} + onRefresh={() => { void loadRemotes(); }} onEdit={(remote) => { setEditingRemote(remote as RemoteInfo | null); }} diff --git a/src/pages/Settings/Proxmox.tsx b/src/pages/Settings/Proxmox.tsx index b605143a..7abdd2e9 100644 --- a/src/pages/Settings/Proxmox.tsx +++ b/src/pages/Settings/Proxmox.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useEffect, useState } from 'react'; import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '@/components/ui/index'; import { Label } from '@/components/ui/index'; import { Switch } from '@/components/ui/index'; @@ -6,12 +6,22 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@ import { Button } from '@/components/ui/index'; export function ProxmoxSettings() { - const [defaultPort, setDefaultPort] = React.useState('8006'); - const [connectionTimeout, setConnectionTimeout] = React.useState('30'); - const [retryAttempts, setRetryAttempts] = React.useState('3'); - const [verifyCertificates, setVerifyCertificates] = React.useState(true); - const [enableCaching, setEnableCaching] = React.useState(true); - const [enableDebug, setEnableDebug] = React.useState(false); + const [defaultPort, setDefaultPort] = useState('8006'); + const [connectionTimeout, setConnectionTimeout] = useState('30'); + const [retryAttempts, setRetryAttempts] = useState('3'); + const [verifyCertificates, setVerifyCertificates] = useState(true); + const [enableCaching, setEnableCaching] = useState(true); + const [enableDebug, setEnableDebug] = useState(false); + const [saved, setSaved] = useState(false); + + useEffect(() => { + setDefaultPort(localStorage.getItem('proxmox_default_port') ?? '8006'); + setConnectionTimeout(localStorage.getItem('proxmox_connection_timeout') ?? '30'); + setRetryAttempts(localStorage.getItem('proxmox_retry_attempts') ?? '3'); + setVerifyCertificates((localStorage.getItem('proxmox_verify_certificates') ?? 'true') === 'true'); + setEnableCaching((localStorage.getItem('proxmox_enable_caching') ?? 'true') === 'true'); + setEnableDebug((localStorage.getItem('proxmox_enable_debug') ?? 'false') === 'true'); + }, []); return (
@@ -114,9 +124,40 @@ export function ProxmoxSettings() { -
- - +
+ + + {saved && ( + Settings saved + )}
);