(null);
const loadProfiles = useCallback(async () => {
try {
@@ -123,6 +124,8 @@ export const ConnectionSection = (): React.JSX.Element => {
);
}, [host, sshConfigHosts]);
+ const clearProfileSelection = (): void => setSelectedProfileId(null);
+
const handleSelectConfigHost = (entry: SshConfigHostEntry): void => {
setHost(entry.alias);
if (entry.port) setPort(String(entry.port));
@@ -130,6 +133,7 @@ export const ConnectionSection = (): React.JSX.Element => {
setAuthMethod('auto');
setShowDropdown(false);
setTestResult(null);
+ clearProfileSelection();
};
const handleSelectProfile = (profile: SshConnectionProfile): void => {
@@ -140,6 +144,7 @@ export const ConnectionSection = (): React.JSX.Element => {
if (profile.privateKeyPath) setPrivateKeyPath(profile.privateKeyPath);
setPassword('');
setTestResult(null);
+ setSelectedProfileId(profile.id);
};
const buildConfig = (): SshConnectionConfig => ({
@@ -241,24 +246,33 @@ export const ConnectionSection = (): React.JSX.Element => {
Saved Profiles
- {savedProfiles.map((profile) => (
-
- ))}
+ {savedProfiles.map((profile) => {
+ const isSelected = selectedProfileId === profile.id;
+ return (
+
+ );
+ })}
)}
@@ -284,6 +298,7 @@ export const ConnectionSection = (): React.JSX.Element => {
setHost(e.target.value);
setShowDropdown(true);
setTestResult(null);
+ clearProfileSelection();
}}
onFocus={() => setShowDropdown(true)}
placeholder="hostname or ssh config alias"
@@ -348,7 +363,10 @@ export const ConnectionSection = (): React.JSX.Element => {
setUsername(e.target.value)}
+ onChange={(e) => {
+ setUsername(e.target.value);
+ clearProfileSelection();
+ }}
placeholder="user"
className={inputClass}
style={inputStyle}
diff --git a/src/renderer/components/settings/sections/WorkspaceSection.tsx b/src/renderer/components/settings/sections/WorkspaceSection.tsx
index 9ba78ad8..5959e0f5 100644
--- a/src/renderer/components/settings/sections/WorkspaceSection.tsx
+++ b/src/renderer/components/settings/sections/WorkspaceSection.tsx
@@ -13,6 +13,7 @@
import { useCallback, useEffect, useState } from 'react';
import { api } from '@renderer/api';
+import { confirm } from '@renderer/components/common/ConfirmDialog';
import { useStore } from '@renderer/store';
import { Edit2, Loader2, Plus, Save, Server, Trash2, X } from 'lucide-react';
@@ -143,7 +144,12 @@ export const WorkspaceSection = (): React.JSX.Element => {
const profile = profiles.find((p) => p.id === id);
if (!profile) return;
- const confirmed = window.confirm(`Delete profile "${profile.name}"?`);
+ const confirmed = await confirm({
+ title: 'Delete Profile',
+ message: `Are you sure you want to delete "${profile.name}"? This cannot be undone.`,
+ confirmLabel: 'Delete',
+ variant: 'danger',
+ });
if (!confirmed) return;
const filtered = profiles.filter((p) => p.id !== id);