Show the Authentik groups table as the Users and groups tab opens

Like the users, the groups are read on open instead of behind a Show groups
button, for an Authentik that has the management token. If the read fails the
button stays, as Try again.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-11-01 01:15:04 +01:00
1 parent 43d9ece8bc
commit a15bbf1303
2 files changed
+11 -5

No files matched your search

+9 -3
View File
@@ -1,4 +1,4 @@
import { useState, type FormEvent } from "react";
import { useEffect, useState, type FormEvent } from "react";
import { api, type AuthentikGroupDetail, type AuthentikGroupPerson, type AuthentikInfo } from "../api/client";
import { ErrorNotice, SuccessNotice } from "./Notice";
import { confirmDialog } from "../utils/dialogs";
@@ -74,7 +74,7 @@ function EditGroup({ g, people, self, busy, onSave, onCancel }: { g: AuthentikGr
}
/**
* The groups of an Authentik, for an administrator to make, rename and to put users in and take them out of. Whether a group makes its members administrators is shown, not changed — and a group
* The groups of an Authentik, read when the tab opens, for an administrator to make, rename and to put users in and take them out of. Whether a group makes its members administrators is shown, not changed — and a group
* made here never does. A group that
* decides somebody's role in this app says so, and asks before it is changed.
*/
@@ -89,6 +89,12 @@ export default function AuthentikGroupList({ a }: { a: AuthentikInfo }) {
const [creating, setCreating] = useState(false);
const [newName, setNewName] = useState("");
// Read as the tab opens, like the users. If that fails, the button below tries again.
useEffect(() => {
if (a.canCreateUsers) void load();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [a.id, a.canCreateUsers]);
if (!a.canCreateUsers) return null;
async function create(e: FormEvent) {
@@ -181,7 +187,7 @@ export default function AuthentikGroupList({ a }: { a: AuthentikInfo }) {
)}
{groups === null ? (
<button type="button" className="btn btn-sm btn-outline-secondary mb-2" onClick={() => void load()} disabled={busy !== null}>
{busy === "list" ? "Reading…" : "Show groups"}
{busy === "list" ? "Reading…" : error ? "Try again" : "Show groups"}
</button>
) : (
<>