up
This commit is contained in:
@@ -19,6 +19,7 @@ import {
|
||||
import type { profile as profileModels } from '../../wailsjs/go/models';
|
||||
import type { LookupSettingsForm, StationSettingsForm, ListsSettingsForm, ModePresetForm } from '@/types';
|
||||
import type { main as mainModels, cluster as clusterModels } from '../../wailsjs/go/models';
|
||||
import { EventsOn, EventsOff } from '../../wailsjs/runtime/runtime';
|
||||
|
||||
import {
|
||||
Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter, DialogDescription,
|
||||
@@ -275,6 +276,20 @@ export function SettingsModal({ onClose, onSaved, initialSection }: Props) {
|
||||
setClusterStatuses((st ?? []) as ClusterServerStatus[]);
|
||||
} catch (e: any) { setErr(String(e?.message ?? e)); }
|
||||
}
|
||||
|
||||
// Live cluster status updates while Preferences is open — the user can
|
||||
// click Connect/Disconnect inside the modal and see the pills change
|
||||
// without saving + reopening.
|
||||
useEffect(() => {
|
||||
EventsOn('cluster:state', async (st: any) => {
|
||||
setClusterStatuses((st ?? []) as ClusterServerStatus[]);
|
||||
try {
|
||||
const list = await ListClusterServers();
|
||||
setClusterServers((list ?? []) as ClusterServer[]);
|
||||
} catch {}
|
||||
});
|
||||
return () => { EventsOff('cluster:state'); };
|
||||
}, []);
|
||||
const [profiles, setProfiles] = useState<Profile[]>([]);
|
||||
// State for ProfilesPanel — lifted here because PANELS[selected]() calls
|
||||
// the panel as a plain function, not as a JSX element, so any useState
|
||||
|
||||
Reference in New Issue
Block a user