feature: the CA certificates and CRLs are always published over HTTP and HTTPS on the status and Manager ports, the Shell page is an entry of the page menu, and the web interface passes its lint.
Release / release (push) Successful in 26s
Release / release (push) Successful in 26s
This commit is contained in:
1 parent
4b5318c676
commit
0cec95c19b
72 files changed
+910
-861
No files matched your search
+30
-24
@@ -9,7 +9,8 @@ import { useCallback, useEffect, useState } from 'react'
|
||||
import ConfirmDialog, { type ConfirmDialogProps } from './ConfirmDialog.tsx'
|
||||
import GroupDialog from './GroupDialog.tsx'
|
||||
import { Section } from './ServerPanel.tsx'
|
||||
import SearchField, { matches } from './SearchField.tsx'
|
||||
import SearchField from './SearchField.tsx'
|
||||
import { matches } from './search.ts'
|
||||
import Toolbar from './Toolbar.tsx'
|
||||
import { ApiError, GROUPS_SHAPE, GROUP_SHAPE, REMOVED_SHAPE, SERVICE_ACCOUNTS_SHAPE, USERS_SHAPE, request, type Group, type User } from './api.ts'
|
||||
|
||||
@@ -23,37 +24,42 @@ export default function GroupsPanel() {
|
||||
const [users, setUsers] = useState<string[]>([])
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
const [unavailable, setUnavailable] = useState(false)
|
||||
const [busy, setBusy] = useState(false)
|
||||
const [busy, setBusy] = useState(true)
|
||||
const [adding, setAdding] = useState(false)
|
||||
const [editing, setEditing] = useState<Group | null>(null)
|
||||
const [confirm, setConfirm] = useState<ConfirmDialogProps | null>(null)
|
||||
const [search, setSearch] = useState('')
|
||||
|
||||
const refresh = useCallback(async () => {
|
||||
setBusy(true)
|
||||
try {
|
||||
const [found, people, services] = await Promise.all([
|
||||
request<{ groups: Group[] }>('GET', '/groups', GROUPS_SHAPE),
|
||||
request<{ users: User[] }>('GET', '/users', USERS_SHAPE),
|
||||
request<{ service_accounts: User[] }>('GET', '/service-accounts', SERVICE_ACCOUNTS_SHAPE),
|
||||
])
|
||||
setGroups(found.groups)
|
||||
setUsers([...people.users, ...services.service_accounts.filter((account) => !account.internal)].map((user) => user.name).sort())
|
||||
setError(null)
|
||||
setUnavailable(false)
|
||||
} catch (caught) {
|
||||
const failure = caught as ApiError
|
||||
setGroups(null)
|
||||
setUnavailable(failure.status === 404)
|
||||
setError(failure.message)
|
||||
} finally {
|
||||
setBusy(false)
|
||||
}
|
||||
/** Reads the groups with the users and service accounts; the state changes only once the server answers. */
|
||||
const read = useCallback(async () => {
|
||||
await Promise.all([
|
||||
request<{ groups: Group[] }>('GET', '/groups', GROUPS_SHAPE),
|
||||
request<{ users: User[] }>('GET', '/users', USERS_SHAPE),
|
||||
request<{ service_accounts: User[] }>('GET', '/service-accounts', SERVICE_ACCOUNTS_SHAPE),
|
||||
])
|
||||
.then(([found, people, services]) => {
|
||||
setGroups(found.groups)
|
||||
setUsers([...people.users, ...services.service_accounts.filter((account) => !account.internal)].map((user) => user.name).sort())
|
||||
setError(null)
|
||||
setUnavailable(false)
|
||||
}, (caught) => {
|
||||
const failure = caught as ApiError
|
||||
setGroups(null)
|
||||
setUnavailable(failure.status === 404)
|
||||
setError(failure.message)
|
||||
})
|
||||
.finally(() => setBusy(false))
|
||||
}, [])
|
||||
|
||||
/** Reads the groups again, busy until the server answers. */
|
||||
const refresh = useCallback(() => {
|
||||
setBusy(true)
|
||||
return read()
|
||||
}, [read])
|
||||
|
||||
useEffect(() => {
|
||||
void refresh()
|
||||
}, [refresh])
|
||||
void read()
|
||||
}, [read])
|
||||
|
||||
/** Runs a change of a group, then reads the list again; a failure is shown above the list. */
|
||||
async function change(work: () => Promise<unknown>) {
|
||||
|
||||
Reference in new issue
Block a user