fix: hide all instances list from non root user
This commit is contained in:
parent
fb0b5053d7
commit
77ada7394e
@ -264,6 +264,21 @@ function Immersion() {
|
||||
</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
|
||||
href={ji.pdfLink}
|
||||
target="_blank"
|
||||
@ -279,122 +294,109 @@ function Immersion() {
|
||||
<ArrowDownTrayIcon className="size-6" />
|
||||
</div>
|
||||
</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>
|
||||
|
||||
{/* Section inférieure : Tableau des instances sur toute la largeur */}
|
||||
<div className="px-4 mt-8">
|
||||
<div className="bg-base-200 shadow-lg rounded-lg p-6">
|
||||
<div className="flex justify-between items-center mb-4">
|
||||
<h2 className="text-2xl font-bold text-blue-600">
|
||||
All Instances
|
||||
</h2>
|
||||
<div className="flex gap-2">
|
||||
<button
|
||||
onClick={handleCreateContainers}
|
||||
className="btn btn-success"
|
||||
>
|
||||
Create All Containers
|
||||
</button>
|
||||
<button
|
||||
onClick={handleStartAllContainers}
|
||||
className="btn btn-primary"
|
||||
>
|
||||
Start All
|
||||
</button>
|
||||
<button
|
||||
onClick={handleStopAllContainers}
|
||||
className="btn btn-error"
|
||||
>
|
||||
Stop All
|
||||
</button>
|
||||
{/* Section inférieure : Tableau des instances sur toute la largeur */}
|
||||
{username === "root" && (
|
||||
<div className="px-4 mt-8">
|
||||
<div className="bg-base-200 shadow-lg rounded-lg p-6">
|
||||
<div className="flex justify-between items-center mb-4">
|
||||
<h2 className="text-2xl font-bold text-blue-600">
|
||||
All Instances
|
||||
</h2>
|
||||
<div className="flex gap-2">
|
||||
<button
|
||||
onClick={handleCreateContainers}
|
||||
className="btn btn-success"
|
||||
>
|
||||
Create All Containers
|
||||
</button>
|
||||
<button
|
||||
onClick={handleStartAllContainers}
|
||||
className="btn btn-primary"
|
||||
>
|
||||
Start All
|
||||
</button>
|
||||
<button
|
||||
onClick={handleStopAllContainers}
|
||||
className="btn btn-error"
|
||||
>
|
||||
Stop All
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="overflow-x-auto">
|
||||
<table className="table w-full">
|
||||
<thead>
|
||||
<tr>
|
||||
<th className="p-4">#</th>
|
||||
<th className="p-4">Name</th>
|
||||
<th className="p-4">Port</th>
|
||||
<th className="p-4">Username</th>
|
||||
<th className="p-4">Password</th>
|
||||
<th className="p-4">Status</th>
|
||||
<th className="p-4">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{allInstances.length > 0 ? (
|
||||
allInstances.map((inst: Instance, index: number) => (
|
||||
<tr key={inst.id || index} className="hover:bg-base-300">
|
||||
<td className="p-4">{index + 1}</td>
|
||||
<td className="p-4">{inst.name}</td>
|
||||
<td className="p-4">{inst.port}</td>
|
||||
<td className="p-4">
|
||||
<span className="badge badge-primary">
|
||||
{instancesOwner[inst.id] || "Loading..."}
|
||||
</span>
|
||||
</td>
|
||||
<td className="p-4">
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="font-mono">{inst.password}</span>
|
||||
<button
|
||||
onClick={() => copyText(inst.password)}
|
||||
className="btn btn-sm btn-ghost"
|
||||
>
|
||||
<ClipboardIcon className="size-4" />
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
<td className="p-4">
|
||||
<span className="badge badge-primary">
|
||||
{instancesStatus[inst.id] || "Loading..."}
|
||||
</span>
|
||||
</td>
|
||||
<td className="p-4">
|
||||
<div className="flex gap-2">
|
||||
<button
|
||||
className="btn btn-sm btn-primary"
|
||||
onClick={() => copyText(`ssh -p ${inst.port} ${instancesOwner[inst.id] || "Loading..."}@la-banquise.fr`)}
|
||||
>
|
||||
Copy SSH
|
||||
</button>
|
||||
<button
|
||||
className="btn btn-sm btn-error"
|
||||
onClick={() => handleDeleteContainer(inst.id)}
|
||||
>
|
||||
Delete Container
|
||||
</button>
|
||||
</div>
|
||||
<div className="overflow-x-auto">
|
||||
<table className="table w-full">
|
||||
<thead>
|
||||
<tr>
|
||||
<th className="p-4">#</th>
|
||||
<th className="p-4">Name</th>
|
||||
<th className="p-4">Port</th>
|
||||
<th className="p-4">Username</th>
|
||||
<th className="p-4">Password</th>
|
||||
<th className="p-4">Status</th>
|
||||
<th className="p-4">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{allInstances.length > 0 ? (
|
||||
allInstances.map((inst: Instance, index: number) => (
|
||||
<tr key={inst.id || index} className="hover:bg-base-300">
|
||||
<td className="p-4">{index + 1}</td>
|
||||
<td className="p-4">{inst.name}</td>
|
||||
<td className="p-4">{inst.port}</td>
|
||||
<td className="p-4">
|
||||
<span className="badge badge-primary">
|
||||
{instancesOwner[inst.id] || "Loading..."}
|
||||
</span>
|
||||
</td>
|
||||
<td className="p-4">
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="font-mono">{inst.password}</span>
|
||||
<button
|
||||
onClick={() => copyText(inst.password)}
|
||||
className="btn btn-sm btn-ghost"
|
||||
>
|
||||
<ClipboardIcon className="size-4" />
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
<td className="p-4">
|
||||
<span className="badge badge-primary">
|
||||
{instancesStatus[inst.id] || "Loading..."}
|
||||
</span>
|
||||
</td>
|
||||
<td className="p-4">
|
||||
<div className="flex gap-2">
|
||||
<button
|
||||
className="btn btn-sm btn-primary"
|
||||
onClick={() => copyText(`ssh -p ${inst.port} ${instancesOwner[inst.id] || "Loading..."}@la-banquise.fr`)}
|
||||
>
|
||||
Copy SSH
|
||||
</button>
|
||||
<button
|
||||
className="btn btn-sm btn-error"
|
||||
onClick={() => handleDeleteContainer(inst.id)}
|
||||
>
|
||||
Delete Container
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
) : (
|
||||
<tr>
|
||||
<td colSpan={7} className="text-center p-8 text-gray-500">
|
||||
No instances found
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
) : (
|
||||
<tr>
|
||||
<td colSpan={7} className="text-center p-8 text-gray-500">
|
||||
No instances found
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user