improved GUI

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2025-02-26 23:30:14 +01:00
parent 5458e6d015
commit 357439ca96
5 changed files with 28 additions and 9 deletions

View File

@@ -158,7 +158,7 @@ public class ClientController extends Controller {
.stream()
.map(clients::getClient)
.flatMap(Optional::stream)
.sorted(Comparator.comparing(Client::name))
.sorted(Comparator.comparing(Client::name, String.CASE_INSENSITIVE_ORDER))
.map(Client::safeMap)
.toList();
return sendContent(ex, Map.of(AUTHORZED, authorizedClients, NAME, user.realName()));

View File

@@ -42,6 +42,10 @@
<th>Error</th>
<td class="warning">Zugriffs-Token gefunden, ist aber ungültig!</td>
</tr>
<tr id="other_error" style="display: none">
<th>Error</th>
<td class="warning" id="other_error_text">Unbekannter Fehler!</td>
</tr>
<tr>
<td></td>
<td><button id="passBtn" type="button" onClick="updatePass()">Aktualisieren</button></td>

View File

@@ -42,6 +42,11 @@
<th>Error</th>
<td class="warning">I received an access token, but it is invalid!</td>
</tr>
<tr id="other_error" style="display: none">
<th>Error</th>
<td class="warning" id="other_error_text">Unknown error!</td>
</tr>
<tr>
<td></td>
<td><button id="passBtn" type="button" onClick="updatePass()">Update</button></td>

View File

@@ -11,12 +11,18 @@ function handleDash(response){
var clients = data.authorized;
var content = document.getElementById('content');
var any = false;
var lastLetter = null;
for (let id in clients){
var client = clients[id];
if (client.landing_page){
var div = document.createElement("div");
div.innerHTML = `<button onclick="window.location.href='${client.landing_page}';">${client.name}</button>`;
content.append(div);
if (client.landing_page){
var initialLetter = client.name.charAt(0).toUpperCase();
if (initialLetter != lastLetter) {
if (lastLetter) content.append(document.createElement("br"));
lastLetter = initialLetter;
}
var span = document.createElement("span");
span.innerHTML = `<button onclick="window.location.href='${client.landing_page}';">${client.name}</button>`;
content.append(span);
any = true;
}
}

View File

@@ -10,10 +10,14 @@ function handlePasswordResponse(response){
} else {
setText('passBtn', 'Update failed!');
response.text().then(text => {
if (text == 'invalid token') show('invalid_token');
if (text == 'token missing') show('missing_token');
if (text == 'password mismatch') show('password_mismatch');
if (text == 'weak password') show('weak_password');
if (text == 'invalid token') show('invalid_token'); else
if (text == 'token missing') show('missing_token'); else
if (text == 'password mismatch') show('password_mismatch'); else
if (text == 'weak password') show('weak_password'); else {
setText('other_error_text',text);
show('other_error');
}
});
}
enable('passBtn');