This commit is contained in:
@@ -1198,7 +1198,7 @@ internal sealed class ManagementStore
|
|||||||
using var connection = OpenConnection();
|
using var connection = OpenConnection();
|
||||||
using var command = connection.CreateCommand();
|
using var command = connection.CreateCommand();
|
||||||
command.CommandText = """
|
command.CommandText = """
|
||||||
SELECT g.name, gm.client_id, gm.client_pattern
|
SELECT g.id, gm.client_id, gm.client_pattern
|
||||||
FROM group_members gm
|
FROM group_members gm
|
||||||
INNER JOIN groups g ON gm.group_id = g.id
|
INNER JOIN groups g ON gm.group_id = g.id
|
||||||
""";
|
""";
|
||||||
@@ -1206,14 +1206,14 @@ internal sealed class ManagementStore
|
|||||||
using var reader = command.ExecuteReader();
|
using var reader = command.ExecuteReader();
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
{
|
{
|
||||||
var groupName = reader.GetString(0);
|
var groupId = reader.GetString(0);
|
||||||
var explicitClientId = reader.IsDBNull(1) ? null : reader.GetString(1);
|
var explicitClientId = reader.IsDBNull(1) ? null : reader.GetString(1);
|
||||||
var pattern = reader.IsDBNull(2) ? null : reader.GetString(2);
|
var pattern = reader.IsDBNull(2) ? null : reader.GetString(2);
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(explicitClientId)
|
if (!string.IsNullOrWhiteSpace(explicitClientId)
|
||||||
&& result.TryGetValue(explicitClientId, out var explicitGroups))
|
&& result.TryGetValue(explicitClientId, out var explicitGroups))
|
||||||
{
|
{
|
||||||
explicitGroups.Add(groupName);
|
explicitGroups.Add(groupId);
|
||||||
}
|
}
|
||||||
else if (!string.IsNullOrWhiteSpace(pattern))
|
else if (!string.IsNullOrWhiteSpace(pattern))
|
||||||
{
|
{
|
||||||
@@ -1231,7 +1231,7 @@ internal sealed class ManagementStore
|
|||||||
{
|
{
|
||||||
if (regex.IsMatch(clientId) && result.TryGetValue(clientId, out var groups))
|
if (regex.IsMatch(clientId) && result.TryGetValue(clientId, out var groups))
|
||||||
{
|
{
|
||||||
groups.Add(groupName);
|
groups.Add(groupId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -483,6 +483,7 @@ function renderClients() {
|
|||||||
|
|
||||||
function clientsTable(clients) {
|
function clientsTable(clients) {
|
||||||
const clientGroups = state.summary?.clientGroups || {};
|
const clientGroups = state.summary?.clientGroups || {};
|
||||||
|
const groupNames = Object.fromEntries((state.summary?.groups || []).map((g) => [g.id, g.name]));
|
||||||
const rows = clients.map((client) => {
|
const rows = clients.map((client) => {
|
||||||
const groups = clientGroups[client.id] || [];
|
const groups = clientGroups[client.id] || [];
|
||||||
return `
|
return `
|
||||||
@@ -507,7 +508,7 @@ function clientsTable(clients) {
|
|||||||
<td>${modelBadges(client.activeModels)}</td>
|
<td>${modelBadges(client.activeModels)}</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="badge-row">
|
<div class="badge-row">
|
||||||
${groups.length ? groups.map((g) => `<a class="badge" href="#groups/${encodeURIComponent(g)}">${escapeHtml(g)}</a>`).join("") : `<span class="cell-sub">None</span>`}
|
${groups.length ? groups.map((g) => `<a class="badge" href="#groups/${encodeURIComponent(g)}">${escapeHtml(groupNames[g] || g)}</a>`).join("") : `<span class="cell-sub">None</span>`}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
Reference in New Issue
Block a user