WIP: update: adaptations to use the new backend #1

Draft
arthur.wambst wants to merge 21 commits from dev into master
Showing only changes of commit 77ada7394e - Show all commits

View File

@ -264,6 +264,21 @@ function Immersion() {
</div> </div>
)} )}
</div>
{/* Colonne droite - iframe du sujet */}
<div className="lg:w-2/3 px-4">
<div className="bg-base-200 shadow-lg rounded-lg p-6 mt-4 h-full">
<h2 className="text-2xl font-bold text-blue-600 mb-4">
Subject
</h2>
<iframe
src="https://tp.la-banquise.fr/Sujet_1_Banquise.pdf"
className="w-full h-[800px] rounded-lg border-2 border-base-300"
title="Subject Document"
/>
</div>
<a <a
href={ji.pdfLink} href={ji.pdfLink}
target="_blank" target="_blank"
@ -279,122 +294,109 @@ function Immersion() {
<ArrowDownTrayIcon className="size-6" /> <ArrowDownTrayIcon className="size-6" />
</div> </div>
</a> </a>
</div>
{/* Colonne droite - iframe du sujet */}
<div className="lg:w-2/3 px-4">
<div className="bg-base-200 shadow-lg rounded-lg p-6 mt-4 h-full">
<h2 className="text-2xl font-bold text-blue-600 mb-4">
Subject
</h2>
<iframe
src="https://tp.la-banquise.fr/Sujet_1_Banquise.pdf"
className="w-full h-[800px] rounded-lg border-2 border-base-300"
title="Subject Document"
/>
</div> </div>
</div>
</div> </div>
{/* Section inférieure : Tableau des instances sur toute la largeur */}
{/* Section inférieure : Tableau des instances sur toute la largeur */} {username === "root" && (
<div className="px-4 mt-8"> <div className="px-4 mt-8">
<div className="bg-base-200 shadow-lg rounded-lg p-6"> <div className="bg-base-200 shadow-lg rounded-lg p-6">
<div className="flex justify-between items-center mb-4"> <div className="flex justify-between items-center mb-4">
<h2 className="text-2xl font-bold text-blue-600"> <h2 className="text-2xl font-bold text-blue-600">
All Instances All Instances
</h2> </h2>
<div className="flex gap-2"> <div className="flex gap-2">
<button <button
onClick={handleCreateContainers} onClick={handleCreateContainers}
className="btn btn-success" className="btn btn-success"
> >
Create All Containers Create All Containers
</button> </button>
<button <button
onClick={handleStartAllContainers} onClick={handleStartAllContainers}
className="btn btn-primary" className="btn btn-primary"
> >
Start All Start All
</button> </button>
<button <button
onClick={handleStopAllContainers} onClick={handleStopAllContainers}
className="btn btn-error" className="btn btn-error"
> >
Stop All Stop All
</button> </button>
</div>
</div> </div>
</div> <div className="overflow-x-auto">
<div className="overflow-x-auto"> <table className="table w-full">
<table className="table w-full"> <thead>
<thead> <tr>
<tr> <th className="p-4">#</th>
<th className="p-4">#</th> <th className="p-4">Name</th>
<th className="p-4">Name</th> <th className="p-4">Port</th>
<th className="p-4">Port</th> <th className="p-4">Username</th>
<th className="p-4">Username</th> <th className="p-4">Password</th>
<th className="p-4">Password</th> <th className="p-4">Status</th>
<th className="p-4">Status</th> <th className="p-4">Actions</th>
<th className="p-4">Actions</th> </tr>
</tr> </thead>
</thead> <tbody>
<tbody> {allInstances.length > 0 ? (
{allInstances.length > 0 ? ( allInstances.map((inst: Instance, index: number) => (
allInstances.map((inst: Instance, index: number) => ( <tr key={inst.id || index} className="hover:bg-base-300">
<tr key={inst.id || index} className="hover:bg-base-300"> <td className="p-4">{index + 1}</td>
<td className="p-4">{index + 1}</td> <td className="p-4">{inst.name}</td>
<td className="p-4">{inst.name}</td> <td className="p-4">{inst.port}</td>
<td className="p-4">{inst.port}</td> <td className="p-4">
<td className="p-4"> <span className="badge badge-primary">
<span className="badge badge-primary"> {instancesOwner[inst.id] || "Loading..."}
{instancesOwner[inst.id] || "Loading..."} </span>
</span> </td>
</td> <td className="p-4">
<td className="p-4"> <div className="flex items-center gap-2">
<div className="flex items-center gap-2"> <span className="font-mono">{inst.password}</span>
<span className="font-mono">{inst.password}</span> <button
<button onClick={() => copyText(inst.password)}
onClick={() => copyText(inst.password)} className="btn btn-sm btn-ghost"
className="btn btn-sm btn-ghost" >
> <ClipboardIcon className="size-4" />
<ClipboardIcon className="size-4" /> </button>
</button> </div>
</div> </td>
</td> <td className="p-4">
<td className="p-4"> <span className="badge badge-primary">
<span className="badge badge-primary"> {instancesStatus[inst.id] || "Loading..."}
{instancesStatus[inst.id] || "Loading..."} </span>
</span> </td>
</td> <td className="p-4">
<td className="p-4"> <div className="flex gap-2">
<div className="flex gap-2"> <button
<button className="btn btn-sm btn-primary"
className="btn btn-sm btn-primary" onClick={() => copyText(`ssh -p ${inst.port} ${instancesOwner[inst.id] || "Loading..."}@la-banquise.fr`)}
onClick={() => copyText(`ssh -p ${inst.port} ${instancesOwner[inst.id] || "Loading..."}@la-banquise.fr`)} >
> Copy SSH
Copy SSH </button>
</button> <button
<button className="btn btn-sm btn-error"
className="btn btn-sm btn-error" onClick={() => handleDeleteContainer(inst.id)}
onClick={() => handleDeleteContainer(inst.id)} >
> Delete Container
Delete Container </button>
</button> </div>
</div> </td>
</tr>
))
) : (
<tr>
<td colSpan={7} className="text-center p-8 text-gray-500">
No instances found
</td> </td>
</tr> </tr>
)) )}
) : ( </tbody>
<tr> </table>
<td colSpan={7} className="text-center p-8 text-gray-500"> </div>
No instances found
</td>
</tr>
)}
</tbody>
</table>
</div> </div>
</div> </div>
</div> )}
</div> </div>
</> </>
)} )}