fix: managing container's state

This commit is contained in:
CyberL1 2025-01-16 13:39:06 +01:00
parent 238c5a2cec
commit 03ddc35df0
2 changed files with 10 additions and 4 deletions

View File

@ -22,5 +22,10 @@ export default function ContainerInfo() {
return "Fetching container info...";
}
return (<Typography>Hostname: {info.name}</Typography>);
return (
<>
<Typography>Hostname: {info.name}</Typography>
<Typography>Memory: {info.memory}</Typography>
</>
);
}

View File

@ -19,7 +19,7 @@ export default function ContainerPage() {
<Paper square sx={{ padding: 1 }}>
<Paper sx={{ display: "flex" }} variant="outlined">
<Typography variant="h6" sx={{ flexGrow: 1 }}>
Managing: {container.name}
State: {container.state.Status}
</Typography>
<ButtonGroup>
<Button
@ -48,8 +48,9 @@ export default function ContainerPage() {
async function switchPowerState(state: string) {
setPowerStateLocked(true);
const res = await fetch(`/api/containers/${container.name}/${state}`, {
method: "PUT",
const res = await fetch(`https://api.ssh.surf/${state}`, {
// @ts-ignore
headers: { "x-ssh-auth": localStorage.getItem("key") },
});
if (res.ok) {