ajoute le stock chaud, la correction automatique et les nouveaux essais de création de stack
Stock de stacks prêtes par lab dans Redis (prise atomique en Lua, ménage par comparaison avec Heat, disjoncteur), files gérées par Horizon, séances planifiables. Correcteur Go sur l'hyperviseur : socket Unix, commandes lues dans le lab.yaml uniquement, exécution par l'agent invité QEMU. Une création de stack ratée est supprimée et réessayée deux fois, puis la session passe en échec, visible du prof. Corrige aussi trois défauts des étapes précédentes : la console se coupait à la première frappe d'un navigateur (trames texte), l'élève ne pouvait pas rejoindre une séance, la déconnexion n'avait pas de jeton CSRF. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ca2f6f3b7a
commit
80b6c0722d
71 changed files with 2959 additions and 170 deletions
|
|
@ -15,6 +15,23 @@
|
|||
<a href="{{ route('labs.essai') }}" class="inline-flex items-center gap-4 border border-[#e3e5e8] rounded-2xl bg-black px-6 py-4 text-lg font-extrabold text-white transition-transform hover:bg-[#ec3013].5.5 active:shadow-none">Reprendre mon TP <span class="font-mono" aria-hidden="true">→</span></a>
|
||||
</div>
|
||||
</section>
|
||||
@php($seancesOuvertes = $eleve->classe->seances()->whereIn('statut', [\App\Models\Seance::SALLE_ATTENTE, \App\Models\Seance::EN_COURS])->with('lab')->get())
|
||||
@if ($seancesOuvertes->isNotEmpty())
|
||||
<section class="mx-auto max-w-7xl px-5 pt-10 lg:px-10" aria-labelledby="t-seance-ouverte">
|
||||
<h2 id="t-seance-ouverte" class="text-2xl font-extrabold">Séance en cours</h2>
|
||||
<ul class="mt-4 grid gap-3">
|
||||
@foreach ($seancesOuvertes as $seance)
|
||||
<li class="flex flex-wrap items-center justify-between gap-4 rounded-2xl border border-[#e3e5e8] bg-[#e6f4ea] p-5">
|
||||
<span class="text-xl font-extrabold">{{ $seance->lab->titre }}</span>
|
||||
<form action="{{ route('seances.rejoindre', $seance) }}" method="post">
|
||||
@csrf
|
||||
<button type="submit" class="inline-flex h-11 items-center rounded-full bg-black px-5 font-bold text-white">Rejoindre la séance</button>
|
||||
</form>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</section>
|
||||
@endif
|
||||
<div class="mx-auto grid max-w-7xl gap-12 px-5 py-14 lg:grid-cols-12 lg:px-10">
|
||||
<section class="lg:col-span-7" aria-labelledby="t-afaire">
|
||||
<h2 id="t-afaire" class="text-4xl font-extrabold tracking-tight">À faire</h2>
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@
|
|||
<div style="display:flex;align-items:center;gap:20px">
|
||||
@auth('web')
|
||||
<a href="{{ route('mes-classes.index') }}" style="font-size:15px;font-weight:600;color:#0b1220;text-decoration:none" class="hover:text-[#0b57d0]">Mes classes</a>
|
||||
<form action="{{ route('deconnexion') }}" method="post" style="margin:0"><button type="submit" style="display:inline-flex;align-items:center;height:40px;padding:0 20px;border:0;border-radius:999px;background:#0b57d0;color:#fff;font-size:15px;font-weight:700;cursor:pointer">Se déconnecter</button></form>
|
||||
<form action="{{ route('deconnexion') }}" method="post" style="margin:0">@csrf<button type="submit" style="display:inline-flex;align-items:center;height:40px;padding:0 20px;border:0;border-radius:999px;background:#0b57d0;color:#fff;font-size:15px;font-weight:700;cursor:pointer">Se déconnecter</button></form>
|
||||
@elseif (auth('eleve')->check())
|
||||
<a href="{{ route('eleve') }}" style="font-size:15px;font-weight:600;color:#0b1220;text-decoration:none" class="hover:text-[#0b57d0]">Mon espace</a>
|
||||
<form action="{{ route('deconnexion') }}" method="post" style="margin:0"><button type="submit" style="display:inline-flex;align-items:center;height:40px;padding:0 20px;border:0;border-radius:999px;background:#0b57d0;color:#fff;font-size:15px;font-weight:700;cursor:pointer">Se déconnecter</button></form>
|
||||
<form action="{{ route('deconnexion') }}" method="post" style="margin:0">@csrf<button type="submit" style="display:inline-flex;align-items:center;height:40px;padding:0 20px;border:0;border-radius:999px;background:#0b57d0;color:#fff;font-size:15px;font-weight:700;cursor:pointer">Se déconnecter</button></form>
|
||||
@else
|
||||
<a href="{{ route('login') }}" style="font-size:15px;font-weight:600;color:#0b1220;text-decoration:none" class="hover:text-[#0b57d0]">Se connecter</a>
|
||||
<a href="{{ route('register') }}" style="display:inline-flex;align-items:center;height:40px;padding:0 20px;border-radius:999px;background:#0b57d0;color:#fff;font-size:15px;font-weight:700;text-decoration:none">Créer une classe</a>
|
||||
|
|
|
|||
|
|
@ -97,8 +97,11 @@
|
|||
</section>
|
||||
|
||||
<section class="mt-10 border border-[#e3e5e8] rounded-2xl bg-white p-6" aria-labelledby="t-seance">
|
||||
<h2 id="t-seance" class="text-2xl font-extrabold">Lancer une séance</h2>
|
||||
<p class="mt-2 font-semibold">Les élèves qui rejoignent patientent dans la salle d'attente jusqu'à ce que tu les admettes.</p>
|
||||
<h2 id="t-seance" class="text-2xl font-extrabold">Lancer ou planifier une séance</h2>
|
||||
<p class="mt-2 font-semibold">Les élèves qui rejoignent patientent dans la salle d'attente jusqu'à ce que tu les admettes. Si tu planifies la séance, les machines de toute la classe sont préparées 10 minutes avant : elles s'ouvrent alors en quelques secondes.</p>
|
||||
@if (session('seance_planifiee'))
|
||||
<p class="mt-4 rounded-2xl border border-[#e3e5e8] bg-[#e6f4ea] p-4 font-semibold">Séance planifiée.</p>
|
||||
@endif
|
||||
<form action="{{ route('mes-classes.seances.store', $classe) }}" method="post" class="mt-4 flex flex-wrap items-end gap-3">
|
||||
@csrf
|
||||
<label class="grid gap-1 font-bold">Lab<select name="lab_id" required class="rounded-xl border border-[#c4c7c5] bg-white px-3 py-2 font-semibold">
|
||||
|
|
@ -106,8 +109,28 @@
|
|||
<option value="{{ $lab->id }}">{{ $lab->titre }}</option>
|
||||
@endforeach
|
||||
</select></label>
|
||||
<button type="submit" class="inline-flex h-11 items-center justify-center rounded-full bg-black px-5 font-bold text-white">Ouvrir la salle d'attente</button>
|
||||
<label class="grid gap-1 font-bold">Date et heure (facultatif)<input type="datetime-local" name="prevue_a" value="{{ old('prevue_a') }}" class="rounded-xl border border-[#c4c7c5] bg-white px-3 py-2 font-semibold"></label>
|
||||
<button type="submit" class="inline-flex h-11 items-center justify-center rounded-full bg-black px-5 font-bold text-white">Ouvrir ou planifier</button>
|
||||
</form>
|
||||
@error('prevue_a')
|
||||
<p class="mt-2 font-semibold text-[#A63D2A]">{{ $message }}</p>
|
||||
@enderror
|
||||
|
||||
@php($planifiees = $classe->seances()->where('statut', \App\Models\Seance::PLANIFIEE)->with('lab')->orderBy('prevue_a')->get())
|
||||
@if ($planifiees->isNotEmpty())
|
||||
<h3 class="mt-6 text-lg font-extrabold">Séances planifiées</h3>
|
||||
<ul class="mt-2 grid gap-2">
|
||||
@foreach ($planifiees as $planifiee)
|
||||
<li class="flex flex-wrap items-center justify-between gap-3 rounded-xl border border-[#e3e5e8] p-3">
|
||||
<span><span class="font-mono font-bold">{{ $planifiee->prevue_a->timezone(config('app.fuseau_utilisateurs'))->translatedFormat('d/m/Y H:i') }}</span> · <span class="font-bold">{{ $planifiee->lab->titre }}</span></span>
|
||||
<form action="{{ route('seances.ouvrir', $planifiee) }}" method="post">
|
||||
@csrf
|
||||
<button type="submit" class="font-bold underline underline-offset-4">Ouvrir la salle d'attente</button>
|
||||
</form>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
</section>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
|
|||
|
|
@ -2,24 +2,27 @@
|
|||
|
||||
@section('titre', "Salle d'attente")
|
||||
|
||||
@php($etats = \App\Models\LabSession::class)
|
||||
|
||||
@section('contenu')
|
||||
@if ($labSession->etat === \App\Models\LabSession::EN_ATTENTE)
|
||||
<meta http-equiv="refresh" content="5">
|
||||
@endif
|
||||
<div class="mx-auto max-w-5xl px-5 py-14 lg:px-10">
|
||||
<p class="font-mono text-sm font-semibold">{{ $seance->lab->titre }}</p>
|
||||
@if ($labSession->etat === \App\Models\LabSession::EN_ATTENTE)
|
||||
@if ($labSession->etat === $etats::EN_ATTENTE)
|
||||
<div class="py-20 text-center">
|
||||
<h1 class="text-4xl font-extrabold tracking-tight">En attente que le prof t'admette…</h1>
|
||||
<p class="mt-4 font-semibold">Cette page se rafraîchit toute seule.</p>
|
||||
<p class="mt-4 font-semibold">Tes machines s'ouvriront ici dès qu'il t'aura admis.</p>
|
||||
</div>
|
||||
@elseif ($labSession->etat === \App\Models\LabSession::ADMIS)
|
||||
<meta http-equiv="refresh" content="4">
|
||||
@elseif ($labSession->etat === $etats::ADMIS)
|
||||
<div class="py-20 text-center">
|
||||
<h1 class="text-4xl font-extrabold tracking-tight">Préparation de tes VM…</h1>
|
||||
<p class="mt-4 font-semibold">Ça prend généralement moins d'une minute.</p>
|
||||
</div>
|
||||
@elseif ($labSession->machines->isNotEmpty())
|
||||
@elseif ($labSession->etat === $etats::ECHEC)
|
||||
<div class="py-20 text-center">
|
||||
<h1 class="text-4xl font-extrabold tracking-tight">Tes machines n'ont pas pu être préparées</h1>
|
||||
<p class="mt-4 font-semibold">Ton prof le voit et peut relancer. Cette page se mettra à jour toute seule.</p>
|
||||
</div>
|
||||
@elseif ($labSession->etat === $etats::ACTIF && $labSession->machines->isNotEmpty())
|
||||
<h1 class="mt-2 text-3xl font-extrabold tracking-tight">Tes machines</h1>
|
||||
<div class="mt-4 flex gap-2" role="tablist">
|
||||
@foreach ($labSession->machines as $i => $machine)
|
||||
|
|
@ -31,12 +34,43 @@
|
|||
<div id="terminal-{{ $machine->id }}" class="h-full"></div>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
<section class="mt-6 rounded-2xl border border-[#e3e5e8] bg-white p-6" aria-labelledby="t-verification">
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<h2 id="t-verification" class="text-2xl font-extrabold">Vérification</h2>
|
||||
<form action="{{ route('lab-sessions.corriger', $labSession) }}" method="post" id="form-verifier">
|
||||
@csrf
|
||||
<button type="submit" class="inline-flex h-11 items-center rounded-full bg-black px-5 font-bold text-white">Vérifier mon travail</button>
|
||||
</form>
|
||||
</div>
|
||||
@if (session('correction_indisponible'))
|
||||
<p class="mt-4 rounded-xl bg-[#fce8e6] p-3 font-semibold">La vérification est indisponible pour le moment. Réessaie dans une minute.</p>
|
||||
@endif
|
||||
@if ($correction = $labSession->derniereCorrection)
|
||||
<p class="mt-4 text-lg font-extrabold">
|
||||
{{ $correction->reussi ? 'Réussi' : 'Pas encore réussi' }}
|
||||
<span class="font-mono">· {{ $correction->note }}/{{ $correction->note_max }}</span>
|
||||
</p>
|
||||
<ul class="mt-3 grid gap-2">
|
||||
@foreach ($correction->details as $detail)
|
||||
<li class="rounded-xl border border-[#e3e5e8] p-3">
|
||||
<span class="font-mono font-bold">{{ $detail['reussi'] ? '✓' : '✗' }}</span>
|
||||
<span class="font-bold">{{ $detail['titre'] }}</span>
|
||||
<span class="font-mono text-sm">({{ $detail['points'] }} pt{{ $detail['points'] > 1 ? 's' : '' }})</span>
|
||||
@if ($detail['message'])
|
||||
<p class="mt-1 font-semibold text-[#A63D2A]">{{ $detail['message'] }}</p>
|
||||
@endif
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
</section>
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@xterm/xterm@5.5.0/css/xterm.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/@xterm/xterm@5.5.0/lib/xterm.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/@xterm/addon-fit@0.10.0/lib/addon-fit.min.js"></script>
|
||||
<script src="{{ asset('js/console-reelle.js') }}"></script>
|
||||
<script>
|
||||
var monte = {};
|
||||
document.querySelectorAll('.onglet-machine').forEach(function (bouton) {
|
||||
bouton.addEventListener('click', function () {
|
||||
var id = bouton.dataset.onglet;
|
||||
|
|
@ -44,20 +78,39 @@
|
|||
document.querySelectorAll('[data-panneau]').forEach(function (p) { p.hidden = p.dataset.panneau !== id; });
|
||||
});
|
||||
});
|
||||
document.getElementById('form-verifier').addEventListener('submit', function (e) {
|
||||
var bouton = e.target.querySelector('button');
|
||||
bouton.disabled = true;
|
||||
bouton.textContent = 'Vérification en cours…';
|
||||
});
|
||||
@foreach ($labSession->machines as $machine)
|
||||
fetch('{{ route('console.eleve', [$labSession, $machine]) }}', {
|
||||
method: 'POST',
|
||||
headers: { 'X-CSRF-TOKEN': '{{ csrf_token() }}' },
|
||||
}).then(function (r) { return r.json(); }).then(function (d) {
|
||||
window.SyllabusConsoleReelle.mount(document.getElementById('terminal-{{ $machine->id }}'), { jeton: d.jeton, lectureSeule: false });
|
||||
window.SyllabusConsoleReelle.mount(document.getElementById('terminal-{{ $machine->id }}'), { jeton: d.jeton, lectureSeule: false, reveil: true });
|
||||
});
|
||||
@endforeach
|
||||
</script>
|
||||
@else
|
||||
<div class="py-20 text-center">
|
||||
<h1 class="text-4xl font-extrabold tracking-tight">La préparation a échoué</h1>
|
||||
<p class="mt-4 font-semibold">Préviens ton prof.</p>
|
||||
<h1 class="text-4xl font-extrabold tracking-tight">Cette séance est terminée pour toi</h1>
|
||||
<p class="mt-4 font-semibold">Tes machines ont été supprimées.</p>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@if (in_array($labSession->etat, [$etats::EN_ATTENTE, $etats::ADMIS, $etats::ECHEC], true))
|
||||
<script>
|
||||
(function () {
|
||||
var etatAffiche = @json($labSession->etat);
|
||||
setInterval(function () {
|
||||
fetch('{{ route('seances.eleve.etat', $seance) }}', { headers: { 'Accept': 'application/json' } })
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function (d) { if (d.etat !== etatAffiche) location.reload(); })
|
||||
.catch(function () {});
|
||||
}, 1000);
|
||||
})();
|
||||
</script>
|
||||
@endif
|
||||
@endsection
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
@section('titre', "Salle d'attente")
|
||||
|
||||
@php($etats = \App\Models\LabSession::class)
|
||||
|
||||
@section('contenu')
|
||||
<meta http-equiv="refresh" content="10">
|
||||
<div class="mx-auto max-w-4xl px-5 py-14 lg:px-10">
|
||||
|
|
@ -14,20 +16,41 @@
|
|||
@else
|
||||
<ul class="mt-8 grid gap-3">
|
||||
@foreach ($seance->labSessions as $labSession)
|
||||
<li class="flex items-center justify-between gap-4 border border-[#e3e5e8] rounded-2xl bg-white p-4">
|
||||
<li class="flex flex-wrap items-center justify-between gap-4 rounded-2xl border border-[#e3e5e8] bg-white p-4">
|
||||
<span class="font-extrabold">{{ $labSession->eleve->nomAffiche() }}</span>
|
||||
@if ($labSession->etat === \App\Models\LabSession::EN_ATTENTE)
|
||||
<form action="{{ route('seances.admettre', [$seance, $labSession]) }}" method="post">
|
||||
@csrf
|
||||
<button type="submit" class="inline-flex h-10 items-center rounded-full bg-[#0b57d0] px-4 font-bold text-white">Admettre</button>
|
||||
</form>
|
||||
@else
|
||||
<span class="flex items-center gap-3">
|
||||
<span class="rounded-lg border border-[#dadce0] bg-[#e6f4ea] px-3 py-1 font-mono text-sm font-bold">Admis</span>
|
||||
@if ($labSession->machines->isNotEmpty())
|
||||
<span class="flex flex-wrap items-center gap-3">
|
||||
@switch($labSession->etat)
|
||||
@case($etats::EN_ATTENTE)
|
||||
<form action="{{ route('seances.admettre', [$seance, $labSession]) }}" method="post">
|
||||
@csrf
|
||||
<button type="submit" class="inline-flex h-10 items-center rounded-full bg-[#0b57d0] px-4 font-bold text-white">Admettre</button>
|
||||
</form>
|
||||
@break
|
||||
@case($etats::ADMIS)
|
||||
<span class="rounded-lg border border-[#dadce0] bg-[#fef7e0] px-3 py-1 font-mono text-sm font-bold">Préparation des VM…</span>
|
||||
@break
|
||||
@case($etats::ACTIF)
|
||||
<span class="rounded-lg border border-[#dadce0] bg-[#e6f4ea] px-3 py-1 font-mono text-sm font-bold">Admis</span>
|
||||
@if ($labSession->derniereCorrection)
|
||||
<span class="font-mono text-sm font-bold">
|
||||
{{ $labSession->derniereCorrection->reussi ? 'Réussi' : 'En cours' }} · {{ $labSession->derniereCorrection->note }}/{{ $labSession->derniereCorrection->note_max }}
|
||||
</span>
|
||||
@endif
|
||||
<a href="{{ route('seances.console.prof.page', [$seance, $labSession]) }}" class="font-bold underline underline-offset-4">Voir sa console</a>
|
||||
@endif
|
||||
</span>
|
||||
@break
|
||||
@case($etats::ECHEC)
|
||||
<span class="rounded-lg border border-[#A63D2A] bg-[#fce8e6] px-3 py-1 font-mono text-sm font-bold" title="{{ $labSession->raison_echec }}">Échec du lancement (3 essais)</span>
|
||||
<form action="{{ route('seances.admettre', [$seance, $labSession]) }}" method="post">
|
||||
@csrf
|
||||
<button type="submit" class="inline-flex h-10 items-center rounded-full bg-black px-4 font-bold text-white">Réessayer</button>
|
||||
</form>
|
||||
@break
|
||||
@default
|
||||
<span class="rounded-lg border border-[#dadce0] px-3 py-1 font-mono text-sm font-bold">Terminé</span>
|
||||
@endswitch
|
||||
</span>
|
||||
@if ($labSession->etat === $etats::ECHEC && $labSession->raison_echec)
|
||||
<p class="w-full font-mono text-xs text-[#5f6368]">{{ $labSession->raison_echec }}</p>
|
||||
@endif
|
||||
</li>
|
||||
@endforeach
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue