WIP: update: adaptations to use the new backend #1
@ -155,6 +155,26 @@ function Immersion() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleDeleteContainer = (instanceId: number) => {
|
||||||
|
axios.delete(`/api/ji/${id}/container/${instanceId}`).then((res) => {
|
||||||
|
if (res.status === 200) {
|
||||||
|
toast.success("Container deleted successfully!", {
|
||||||
|
draggable: true,
|
||||||
|
theme: localStorage.getItem("theme") || "dark",
|
||||||
|
});
|
||||||
|
// Recharger les instances pour mettre à jour la liste
|
||||||
|
axios.get(`/api/ji/${id}/all-instances`).then((res) => {
|
||||||
|
setAllInstances(res.data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
toast.error("Failed to delete container", {
|
||||||
|
draggable: true,
|
||||||
|
theme: localStorage.getItem("theme") || "dark",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{ji && (
|
{ji && (
|
||||||
@ -210,9 +230,9 @@ function Immersion() {
|
|||||||
<span>Password:</span>
|
<span>Password:</span>
|
||||||
<div
|
<div
|
||||||
className="flex gap-2 items-center cursor-pointer"
|
className="flex gap-2 items-center cursor-pointer"
|
||||||
onClick={() => copyText(instance.pwd)}
|
onClick={() => copyText(instance.password)}
|
||||||
>
|
>
|
||||||
<span className="font-normal">{instance.pwd}</span>
|
<span className="font-normal">{instance.password}</span>
|
||||||
<div className="h-8 w-8 hover:bg-base-100 align-middle cursor-pointer flex items-center justify-center rounded">
|
<div className="h-8 w-8 hover:bg-base-100 align-middle cursor-pointer flex items-center justify-center rounded">
|
||||||
<ClipboardIcon className="size-6" />
|
<ClipboardIcon className="size-6" />
|
||||||
</div>
|
</div>
|
||||||
@ -253,7 +273,7 @@ function Immersion() {
|
|||||||
</h2>
|
</h2>
|
||||||
<iframe
|
<iframe
|
||||||
src="https://tp.la-banquise.fr"
|
src="https://tp.la-banquise.fr"
|
||||||
className="w-full h-[600px] rounded-lg border-2 border-base-300"
|
className="w-full h-[800px] rounded-lg border-2 border-base-300"
|
||||||
title="Subject Document"
|
title="Subject Document"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -326,12 +346,20 @@ function Immersion() {
|
|||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td className="p-4">
|
<td className="p-4">
|
||||||
<button
|
<div className="flex gap-2">
|
||||||
className="btn btn-sm btn-primary"
|
<button
|
||||||
onClick={() => copyText(`ssh -p ${inst.port} ${username}@la-banquise.fr`)}
|
className="btn btn-sm btn-primary"
|
||||||
>
|
onClick={() => copyText(`ssh -p ${inst.port} ${username}@la-banquise.fr`)}
|
||||||
Copy SSH
|
>
|
||||||
</button>
|
Copy SSH
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className="btn btn-sm btn-error"
|
||||||
|
onClick={() => handleDeleteContainer(inst.id)}
|
||||||
|
>
|
||||||
|
Delete Container
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
))
|
))
|
||||||
|
|||||||
@ -77,7 +77,17 @@ function BulkUsers() {
|
|||||||
navigate('/admin/users');
|
navigate('/admin/users');
|
||||||
}
|
}
|
||||||
if (response.status === 202)
|
if (response.status === 202)
|
||||||
alert(`Couldn't create some users`);
|
{ const url = window.URL.createObjectURL(new Blob([response.data]));
|
||||||
|
const link = document.createElement('a');
|
||||||
|
link.href = url;
|
||||||
|
link.setAttribute('download', `created_users_${new Date().toISOString().split('T')[0]}.csv`);
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
link.remove();
|
||||||
|
window.URL.revokeObjectURL(url);
|
||||||
|
|
||||||
|
|
||||||
|
alert(`Couldn't create some users`);}
|
||||||
if (response.status === 500)
|
if (response.status === 500)
|
||||||
alert(`Couldn't create ANY users`);
|
alert(`Couldn't create ANY users`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user