Skip to content

Commit

Permalink
dze
Browse files Browse the repository at this point in the history
  • Loading branch information
mwilliot committed Jun 6, 2024
1 parent d5cb88d commit 8b5c7c0
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions website/students/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,26 +93,11 @@ function confirmStopVM(name) {
});
}

function confirmStopVMbis(name) {
function confirmAccessVM(VMname, port, username) {
Swal.fire({
title: 'Confirmation',
text: "Souhaitez-vous vraiment tester la VM : " + name + " ?",
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Oui',
cancelButtonText: 'Non, annuler'
}).then((result) => {
if (result.isConfirmed) {
fetch(`ajax_functions.php?action=stopVM&name=${encodeURIComponent(name)}`)
.then(() => {
showLoadingSwal('Veuillez patienter', 'La VM est en cours d\'arrêt...');
return pollVMStatus(name, 'stopped');
})
.then(() => {
Swal.close();
showSuccessSwal('VM arrêtée !');
});
}
title: 'Voici la commande à exécuter pour vous connecter à la VM :',
text: "ssh -p " + port + " " + username + "@" + VMname + ".eden.telecom-sudparis.eu",
icon: 'info',
});
}

Expand Down Expand Up @@ -271,7 +256,7 @@ function confirmCreateVM(vmName) {
echo "<li class='list-group-item'>";
echo "<b>$vmName</b>";
echo "<p>Statut : $status</p>";
echo "<button class='btn btn-primary boutonVM' onclick=\"confirmStopVMbis('$vmName')\">Allumer</button>";
echo "<button class='btn btn-primary boutonVM' onclick=\"confirmAccessVM('$vmName', '$port', '$suerName')\">Allumer</button>";
echo "<button class='btn btn-success boutonVM' onclick=\"confirmStartVM('$vmName')\">Allumer</button>";
echo "<button class='btn btn-warning boutonVM' onclick=\"confirmStopVM('$vmName')\">Éteindre</button>";
echo "<button class='btn btn-danger boutonVM' onclick=\"confirmDeleteVM('$vmName')\">Supprimer</button>";
Expand Down

0 comments on commit 8b5c7c0

Please sign in to comment.