feat(DevWeb): Edit connected user websocket

This commit is contained in:
Lucàs
2024-04-23 15:21:09 +02:00
parent 882a9ee265
commit 8e4624c6de
2 changed files with 27 additions and 27 deletions
@@ -16,7 +16,7 @@ import uppa.project.json.websocket.Message;
@ServerEndpoint(value = "/ws/connected-users")
public class ConnectedUsersWS {
private static final HashMap<Session, User> connections = new HashMap<>();
public static final HashMap<Session, User> connections = new HashMap<>();
@OnOpen
public void onOpen(Session session) {}
@@ -9,11 +9,11 @@
<thead>
<tr>
<th>Utilisateur</th>
<th>Nombre de parties</th>
<th>Victoires (%)</th>
<th>Clics corrects (%)</th>
<th>Clics rapides (%)</th>
<th>Action</th>
<%-- <th>Nombre de parties</th>--%>
<%-- <th>Victoires (%)</th>--%>
<%-- <th>Clics corrects (%)</th>--%>
<%-- <th>Clics rapides (%)</th>--%>
<%-- <th>Action</th>--%>
</tr>
</thead>
<tbody></tbody>
@@ -59,35 +59,35 @@
const trElement = document.createElement('tr');
const tdElement = [
document.createElement('td'),
document.createElement('td'),
document.createElement('td'),
document.createElement('td'),
document.createElement('td'),
document.createElement('td')
// document.createElement('td'),
// document.createElement('td'),
// document.createElement('td'),
// document.createElement('td'),
// document.createElement('td')
];
const buttonElement = document.createElement('button');
// const buttonElement = document.createElement('button');
tdElement[0].textContent = user.username;
tdElement[1].textContent = user.nbPlayedGames;
tdElement[2].textContent = user.WinRate + '%';
tdElement[3].textContent = user.rightClickPercentRate + '%';
tdElement[4].textContent = user.rapidClickPercentRate + '%';
// tdElement[1].textContent = user.nbPlayedGames;
// tdElement[2].textContent = user.WinRate + '%';
// tdElement[3].textContent = user.rightClickPercentRate + '%';
// tdElement[4].textContent = user.rapidClickPercentRate + '%';
// If it's not the current user, we can display the button
if (user.id !== <%= user.getId() %>) {
buttonElement.classList.add('button', 'is-light');
buttonElement.textContent = 'Inviter';
<%--if (user.id !== <%= user.getId() %>) {--%>
<%-- buttonElement.classList.add('button', 'is-light');--%>
<%-- buttonElement.textContent = 'Inviter';--%>
// TODO Ajouter l'événement click
}
<%-- // TODO Ajouter l'événement click--%>
<%--}--%>
tdElement[5].appendChild(buttonElement);
// tdElement[5].appendChild(buttonElement);
trElement.appendChild(tdElement[0]);
trElement.appendChild(tdElement[1]);
trElement.appendChild(tdElement[2]);
trElement.appendChild(tdElement[3]);
trElement.appendChild(tdElement[4]);
trElement.appendChild(tdElement[5]);
// trElement.appendChild(tdElement[1]);
// trElement.appendChild(tdElement[2]);
// trElement.appendChild(tdElement[3]);
// trElement.appendChild(tdElement[4]);
// trElement.appendChild(tdElement[5]);
tbodyElement.appendChild(trElement);
});