Skip to content

Commit

Permalink
Fix bugs in ProxmoxDialog, ServerTabs & Servers component
Browse files Browse the repository at this point in the history
  • Loading branch information
gnmyt committed Sep 1, 2024
1 parent 409bd90 commit bd2b28f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
8 changes: 7 additions & 1 deletion client/src/pages/Servers/Servers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,17 @@ export const Servers = () => {
setEditServerId(null);
};

const closePVEDialog = () => {
setProxmoxDialogOpen(false);
setCurrentFolderId(null);
setEditServerId(null);
}

return (
<div className="server-page">
<ServerDialog open={serverDialogOpen} onClose={closeDialog} currentFolderId={currentFolderId}
editServerId={editServerId} />
<ProxmoxDialog open={proxmoxDialogOpen} onClose={() => setProxmoxDialogOpen(false)}
<ProxmoxDialog open={proxmoxDialogOpen} onClose={closePVEDialog}
currentFolderId={currentFolderId}
editServerId={editServerId} />
<ServerList setServerDialogOpen={() => setServerDialogOpen(true)} connectToServer={connectToServer}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export const ProxmoxDialog = ({ open, onClose, currentFolderId, editServerId })
putRequest("pve-servers", {
name, folderId: currentFolderId, ip, port, username, password,
}).then(async () => {
await postRequest("pve-servers/refresh");
loadServers();
onClose();
loadServers();
await postRequest("pve-servers/refresh");
}).catch(err => console.error(err));
};

Expand All @@ -45,8 +45,14 @@ export const ProxmoxDialog = ({ open, onClose, currentFolderId, editServerId })
setUsername(server.username);
setPassword("********");
}).catch(err => console.error(err));
} else {
setName("");
setIp("");
setPort("8006");
setUsername("");
setPassword("");
}
}, [editServerId]);
}, [editServerId, open]);

const { loadServers } = useContext(ServerContext);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export const ServerTabs = ({activeSessions, setActiveSessionId, activeSessionId,
return (
<div key={session.id} className={"server-tab" + (session.id === activeSessionId ? " server-tab-active" : "")}
onClick={() => setActiveSessionId(session.id)}>
<Icon path={server.icon ? loadIcon(server.icon) : getIconByType(server.type)} />
<h2>{server.name}</h2>
<Icon path={server?.icon ? loadIcon(server.icon) : getIconByType(server?.type)} />
<h2>{server?.name}</h2>
<Icon path={mdiClose} onClick={(e) => {
e.stopPropagation();
disconnectFromServer(session.id);
Expand Down

0 comments on commit bd2b28f

Please sign in to comment.