fix: remove 18 unused variables across 4 files
- HostManagerViewer.tsx: remove 9 unused error variables and parameters - HostManagerEditor.tsx: remove WidgetType import, hosts/loading states, error variable - CredentialViewer.tsx: remove 3 unused error variables - Server.tsx: remove 2 unused error variables 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -70,7 +70,7 @@ const CredentialViewer: React.FC<CredentialViewerProps> = ({
|
|||||||
try {
|
try {
|
||||||
const response = await getCredentialDetails(credential.id);
|
const response = await getCredentialDetails(credential.id);
|
||||||
setCredentialDetails(response);
|
setCredentialDetails(response);
|
||||||
} catch (error) {
|
} catch {
|
||||||
toast.error(t("credentials.failedToFetchCredentialDetails"));
|
toast.error(t("credentials.failedToFetchCredentialDetails"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -79,7 +79,7 @@ const CredentialViewer: React.FC<CredentialViewerProps> = ({
|
|||||||
try {
|
try {
|
||||||
const response = await getCredentialHosts(credential.id);
|
const response = await getCredentialHosts(credential.id);
|
||||||
setHostsUsing(response);
|
setHostsUsing(response);
|
||||||
} catch (error) {
|
} catch {
|
||||||
toast.error(t("credentials.failedToFetchHostsUsing"));
|
toast.error(t("credentials.failedToFetchHostsUsing"));
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
@@ -97,7 +97,7 @@ const CredentialViewer: React.FC<CredentialViewerProps> = ({
|
|||||||
try {
|
try {
|
||||||
await navigator.clipboard.writeText(text);
|
await navigator.clipboard.writeText(text);
|
||||||
toast.success(t("copiedToClipboard", { field: fieldName }));
|
toast.success(t("copiedToClipboard", { field: fieldName }));
|
||||||
} catch (error) {
|
} catch {
|
||||||
toast.error(t("credentials.failedToCopy"));
|
toast.error(t("credentials.failedToCopy"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ import { CredentialSelector } from "@/ui/Desktop/Apps/Credentials/CredentialSele
|
|||||||
import CodeMirror from "@uiw/react-codemirror";
|
import CodeMirror from "@uiw/react-codemirror";
|
||||||
import { oneDark } from "@codemirror/theme-one-dark";
|
import { oneDark } from "@codemirror/theme-one-dark";
|
||||||
import { EditorView } from "@codemirror/view";
|
import { EditorView } from "@codemirror/view";
|
||||||
import type { StatsConfig, WidgetType } from "@/types/stats-widgets";
|
import type { StatsConfig } from "@/types/stats-widgets";
|
||||||
import { DEFAULT_STATS_CONFIG } from "@/types/stats-widgets";
|
import { DEFAULT_STATS_CONFIG } from "@/types/stats-widgets";
|
||||||
import { Checkbox } from "@/components/ui/checkbox.tsx";
|
import { Checkbox } from "@/components/ui/checkbox.tsx";
|
||||||
|
|
||||||
@@ -77,11 +77,9 @@ export function HostManagerEditor({
|
|||||||
onFormSubmit,
|
onFormSubmit,
|
||||||
}: SSHManagerHostEditorProps) {
|
}: SSHManagerHostEditorProps) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [hosts, setHosts] = useState<SSHHost[]>([]);
|
|
||||||
const [folders, setFolders] = useState<string[]>([]);
|
const [folders, setFolders] = useState<string[]>([]);
|
||||||
const [sshConfigurations, setSshConfigurations] = useState<string[]>([]);
|
const [sshConfigurations, setSshConfigurations] = useState<string[]>([]);
|
||||||
const [credentials, setCredentials] = useState<any[]>([]);
|
const [credentials, setCredentials] = useState<any[]>([]);
|
||||||
const [loading, setLoading] = useState(true);
|
|
||||||
|
|
||||||
const [authTab, setAuthTab] = useState<"password" | "key" | "credential">(
|
const [authTab, setAuthTab] = useState<"password" | "key" | "credential">(
|
||||||
"password",
|
"password",
|
||||||
@@ -96,12 +94,10 @@ export function HostManagerEditor({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
|
||||||
const [hostsData, credentialsData] = await Promise.all([
|
const [hostsData, credentialsData] = await Promise.all([
|
||||||
getSSHHosts(),
|
getSSHHosts(),
|
||||||
getCredentials(),
|
getCredentials(),
|
||||||
]);
|
]);
|
||||||
setHosts(hostsData);
|
|
||||||
setCredentials(credentialsData);
|
setCredentials(credentialsData);
|
||||||
|
|
||||||
const uniqueFolders = [
|
const uniqueFolders = [
|
||||||
@@ -124,8 +120,6 @@ export function HostManagerEditor({
|
|||||||
setSshConfigurations(uniqueConfigurations);
|
setSshConfigurations(uniqueConfigurations);
|
||||||
} catch {
|
} catch {
|
||||||
// Failed to load hosts data
|
// Failed to load hosts data
|
||||||
} finally {
|
|
||||||
setLoading(false);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -135,9 +129,7 @@ export function HostManagerEditor({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleCredentialChange = async () => {
|
const handleCredentialChange = async () => {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
|
||||||
const hostsData = await getSSHHosts();
|
const hostsData = await getSSHHosts();
|
||||||
setHosts(hostsData);
|
|
||||||
|
|
||||||
const uniqueFolders = [
|
const uniqueFolders = [
|
||||||
...new Set(
|
...new Set(
|
||||||
@@ -159,8 +151,6 @@ export function HostManagerEditor({
|
|||||||
setSshConfigurations(uniqueConfigurations);
|
setSshConfigurations(uniqueConfigurations);
|
||||||
} catch {
|
} catch {
|
||||||
// Failed to reload hosts after credential change
|
// Failed to reload hosts after credential change
|
||||||
} finally {
|
|
||||||
setLoading(false);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -533,7 +523,7 @@ export function HostManagerEditor({
|
|||||||
window.dispatchEvent(new CustomEvent("ssh-hosts:changed"));
|
window.dispatchEvent(new CustomEvent("ssh-hosts:changed"));
|
||||||
|
|
||||||
form.reset();
|
form.reset();
|
||||||
} catch (error) {
|
} catch {
|
||||||
toast.error(t("hosts.failedToSaveHost"));
|
toast.error(t("hosts.failedToSaveHost"));
|
||||||
} finally {
|
} finally {
|
||||||
isSubmittingRef.current = false;
|
isSubmittingRef.current = false;
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ export function HostManagerViewer({ onEditHost }: SSHManagerHostViewerProps) {
|
|||||||
|
|
||||||
setHosts(cleanedHosts);
|
setHosts(cleanedHosts);
|
||||||
setError(null);
|
setError(null);
|
||||||
} catch (err) {
|
} catch {
|
||||||
setError(t("hosts.failedToLoadHosts"));
|
setError(t("hosts.failedToLoadHosts"));
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
@@ -122,7 +122,7 @@ export function HostManagerViewer({ onEditHost }: SSHManagerHostViewerProps) {
|
|||||||
toast.success(t("hosts.hostDeletedSuccessfully", { name: hostName }));
|
toast.success(t("hosts.hostDeletedSuccessfully", { name: hostName }));
|
||||||
await fetchHosts();
|
await fetchHosts();
|
||||||
window.dispatchEvent(new CustomEvent("ssh-hosts:changed"));
|
window.dispatchEvent(new CustomEvent("ssh-hosts:changed"));
|
||||||
} catch (err) {
|
} catch {
|
||||||
toast.error(t("hosts.failedToDeleteHost"));
|
toast.error(t("hosts.failedToDeleteHost"));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -143,7 +143,7 @@ export function HostManagerViewer({ onEditHost }: SSHManagerHostViewerProps) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
confirmWithToast(confirmMessage, () => {
|
confirmWithToast(confirmMessage, () => {
|
||||||
performExport(host, actualAuthType);
|
performExport(host);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
} else if (actualAuthType === "password" || actualAuthType === "key") {
|
} else if (actualAuthType === "password" || actualAuthType === "key") {
|
||||||
@@ -152,21 +152,21 @@ export function HostManagerViewer({ onEditHost }: SSHManagerHostViewerProps) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
confirmWithToast(confirmMessage, () => {
|
confirmWithToast(confirmMessage, () => {
|
||||||
performExport(host, actualAuthType);
|
performExport(host);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
performExport(host, actualAuthType);
|
performExport(host);
|
||||||
};
|
};
|
||||||
|
|
||||||
const performExport = async (host: SSHHost, actualAuthType: string) => {
|
const performExport = async (host: SSHHost) => {
|
||||||
try {
|
try {
|
||||||
const decryptedHost = await exportSSHHostWithCredentials(host.id);
|
const decryptedHost = await exportSSHHostWithCredentials(host.id);
|
||||||
|
|
||||||
const cleanExportData = Object.fromEntries(
|
const cleanExportData = Object.fromEntries(
|
||||||
Object.entries(decryptedHost).filter(
|
Object.entries(decryptedHost).filter(
|
||||||
([_, value]) => value !== undefined,
|
([, value]) => value !== undefined,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -185,7 +185,7 @@ export function HostManagerViewer({ onEditHost }: SSHManagerHostViewerProps) {
|
|||||||
toast.success(
|
toast.success(
|
||||||
`Exported host configuration for ${host.name || host.username}@${host.ip}`,
|
`Exported host configuration for ${host.name || host.username}@${host.ip}`,
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch {
|
||||||
toast.error(t("hosts.failedToExportHost"));
|
toast.error(t("hosts.failedToExportHost"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -222,7 +222,7 @@ export function HostManagerViewer({ onEditHost }: SSHManagerHostViewerProps) {
|
|||||||
);
|
);
|
||||||
await fetchHosts();
|
await fetchHosts();
|
||||||
window.dispatchEvent(new CustomEvent("ssh-hosts:changed"));
|
window.dispatchEvent(new CustomEvent("ssh-hosts:changed"));
|
||||||
} catch (err) {
|
} catch {
|
||||||
toast.error(t("hosts.failedToRemoveFromFolder"));
|
toast.error(t("hosts.failedToRemoveFromFolder"));
|
||||||
} finally {
|
} finally {
|
||||||
setOperationLoading(false);
|
setOperationLoading(false);
|
||||||
@@ -251,7 +251,7 @@ export function HostManagerViewer({ onEditHost }: SSHManagerHostViewerProps) {
|
|||||||
window.dispatchEvent(new CustomEvent("ssh-hosts:changed"));
|
window.dispatchEvent(new CustomEvent("ssh-hosts:changed"));
|
||||||
setEditingFolder(null);
|
setEditingFolder(null);
|
||||||
setEditingFolderName("");
|
setEditingFolderName("");
|
||||||
} catch (err) {
|
} catch {
|
||||||
toast.error(t("hosts.failedToRenameFolder"));
|
toast.error(t("hosts.failedToRenameFolder"));
|
||||||
} finally {
|
} finally {
|
||||||
setOperationLoading(false);
|
setOperationLoading(false);
|
||||||
@@ -291,7 +291,7 @@ export function HostManagerViewer({ onEditHost }: SSHManagerHostViewerProps) {
|
|||||||
setDragOverFolder(folderName);
|
setDragOverFolder(folderName);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDragLeave = (e: React.DragEvent) => {
|
const handleDragLeave = () => {
|
||||||
dragCounter.current--;
|
dragCounter.current--;
|
||||||
if (dragCounter.current === 0) {
|
if (dragCounter.current === 0) {
|
||||||
setDragOverFolder(null);
|
setDragOverFolder(null);
|
||||||
@@ -325,7 +325,7 @@ export function HostManagerViewer({ onEditHost }: SSHManagerHostViewerProps) {
|
|||||||
);
|
);
|
||||||
await fetchHosts();
|
await fetchHosts();
|
||||||
window.dispatchEvent(new CustomEvent("ssh-hosts:changed"));
|
window.dispatchEvent(new CustomEvent("ssh-hosts:changed"));
|
||||||
} catch (err) {
|
} catch {
|
||||||
toast.error(t("hosts.failedToMoveToFolder"));
|
toast.error(t("hosts.failedToMoveToFolder"));
|
||||||
} finally {
|
} finally {
|
||||||
setOperationLoading(false);
|
setOperationLoading(false);
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ export function Server({
|
|||||||
if (updatedHost) {
|
if (updatedHost) {
|
||||||
setCurrentHostConfig(updatedHost);
|
setCurrentHostConfig(updatedHost);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch {
|
||||||
toast.error(t("serverStats.failedToFetchHostConfig"));
|
toast.error(t("serverStats.failedToFetchHostConfig"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -165,7 +165,7 @@ export function Server({
|
|||||||
if (updatedHost) {
|
if (updatedHost) {
|
||||||
setCurrentHostConfig(updatedHost);
|
setCurrentHostConfig(updatedHost);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch {
|
||||||
toast.error(t("serverStats.failedToFetchHostConfig"));
|
toast.error(t("serverStats.failedToFetchHostConfig"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user