fix: Mandanten-Nutzerdialog Fehlerhandling + LDAP-Hinweis
- Fehlerstate für Nutzer-Dialog: API-Fehler werden jetzt angezeigt statt silent ignoriert - LDAP-Hinweis: wenn LDAP aktiv aber keine lokalen User da sind, erklärender Text "LDAP ist aktiv — Benutzer erscheinen hier nach ihrem ersten Login" - tenantUsersDialogLdap State: speichert ob Tenant LDAP aktiviert hat Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+19
-3
@@ -242,8 +242,10 @@ export default function AdminPage() {
|
|||||||
// Tenant users dialog
|
// Tenant users dialog
|
||||||
const [tenantUsersDialogId, setTenantUsersDialogId] = useState<number | null>(null);
|
const [tenantUsersDialogId, setTenantUsersDialogId] = useState<number | null>(null);
|
||||||
const [tenantUsersDialogName, setTenantUsersDialogName] = useState("");
|
const [tenantUsersDialogName, setTenantUsersDialogName] = useState("");
|
||||||
|
const [tenantUsersDialogLdap, setTenantUsersDialogLdap] = useState(false);
|
||||||
const [tenantUsers, setTenantUsers] = useState<User[]>([]);
|
const [tenantUsers, setTenantUsers] = useState<User[]>([]);
|
||||||
const [tenantUsersLoading, setTenantUsersLoading] = useState(false);
|
const [tenantUsersLoading, setTenantUsersLoading] = useState(false);
|
||||||
|
const [tenantUsersError, setTenantUsersError] = useState("");
|
||||||
|
|
||||||
// Labels state
|
// Labels state
|
||||||
const [adminLabels, setAdminLabels] = useState<MailLabel[]>([]);
|
const [adminLabels, setAdminLabels] = useState<MailLabel[]>([]);
|
||||||
@@ -757,13 +759,18 @@ export default function AdminPage() {
|
|||||||
async function openUsersDialog(t: Tenant) {
|
async function openUsersDialog(t: Tenant) {
|
||||||
setTenantUsersDialogId(t.id);
|
setTenantUsersDialogId(t.id);
|
||||||
setTenantUsersDialogName(t.name);
|
setTenantUsersDialogName(t.name);
|
||||||
|
setTenantUsersDialogLdap(t.ldap_enabled === true);
|
||||||
setTenantUsersLoading(true);
|
setTenantUsersLoading(true);
|
||||||
setTenantUsers([]);
|
setTenantUsers([]);
|
||||||
|
setTenantUsersError("");
|
||||||
try {
|
try {
|
||||||
const users = await getTenantUsers(t.id);
|
const users = await getTenantUsers(t.id);
|
||||||
setTenantUsers(users || []);
|
setTenantUsers(users || []);
|
||||||
} catch { /* ignore */ }
|
} catch (err: unknown) {
|
||||||
finally { setTenantUsersLoading(false); }
|
setTenantUsersError(err instanceof Error ? err.message : "Nutzer konnten nicht geladen werden.");
|
||||||
|
} finally {
|
||||||
|
setTenantUsersLoading(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleAddDomain() {
|
async function handleAddDomain() {
|
||||||
@@ -2595,8 +2602,17 @@ export default function AdminPage() {
|
|||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
{tenantUsersLoading ? (
|
{tenantUsersLoading ? (
|
||||||
<Skeleton className="h-24 w-full" />
|
<Skeleton className="h-24 w-full" />
|
||||||
|
) : tenantUsersError ? (
|
||||||
|
<Alert variant="destructive">
|
||||||
|
<AlertDescription>{tenantUsersError}</AlertDescription>
|
||||||
|
</Alert>
|
||||||
) : tenantUsers.length === 0 ? (
|
) : tenantUsers.length === 0 ? (
|
||||||
<p className="text-sm text-muted-foreground py-4 text-center">Keine Benutzer diesem Mandanten zugewiesen.</p>
|
<div className="py-4 text-center space-y-2">
|
||||||
|
<p className="text-sm text-muted-foreground">Keine lokalen Benutzer diesem Mandanten zugewiesen.</p>
|
||||||
|
{tenantUsersDialogLdap && (
|
||||||
|
<p className="text-xs text-muted-foreground">LDAP ist aktiv — Benutzer erscheinen hier nach ihrem ersten Login.</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<Table>
|
<Table>
|
||||||
<TableHeader>
|
<TableHeader>
|
||||||
|
|||||||
Reference in New Issue
Block a user