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 (
|
||||
<>
|
||||
{ji && (
|
||||
@ -210,9 +230,9 @@ function Immersion() {
|
||||
<span>Password:</span>
|
||||
<div
|
||||
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">
|
||||
<ClipboardIcon className="size-6" />
|
||||
</div>
|
||||
@ -253,7 +273,7 @@ function Immersion() {
|
||||
</h2>
|
||||
<iframe
|
||||
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"
|
||||
/>
|
||||
</div>
|
||||
@ -326,12 +346,20 @@ function Immersion() {
|
||||
</span>
|
||||
</td>
|
||||
<td className="p-4">
|
||||
<div className="flex gap-2">
|
||||
<button
|
||||
className="btn btn-sm btn-primary"
|
||||
onClick={() => copyText(`ssh -p ${inst.port} ${username}@la-banquise.fr`)}
|
||||
>
|
||||
Copy SSH
|
||||
</button>
|
||||
<button
|
||||
className="btn btn-sm btn-error"
|
||||
onClick={() => handleDeleteContainer(inst.id)}
|
||||
>
|
||||
Delete Container
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
|
||||
@ -77,7 +77,17 @@ function BulkUsers() {
|
||||
navigate('/admin/users');
|
||||
}
|
||||
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)
|
||||
alert(`Couldn't create ANY users`);
|
||||
} catch (error) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user