searches
This commit is contained in:
parent
a196be8c6f
commit
10cf2072dc
@ -79,7 +79,7 @@ export const AuditLogs = ({}) => {
|
||||
const [types, setTypes] = useState<boolean[]>([]);
|
||||
const [pageIndex, setPageIndex] = useState(1);
|
||||
const { data } = useSWR(
|
||||
`/api/admin/audit?page=${pageIndex}&${searchParams.toString()}`
|
||||
`/api/admin/audit?page=${pageIndex}&pageSize=26&${searchParams.toString()}`
|
||||
);
|
||||
const filter = useSWR<string[]>('/api/admin/audit/filter');
|
||||
|
||||
|
@ -390,24 +390,16 @@ const OAuth2ClientCard = ({
|
||||
</div>
|
||||
);
|
||||
|
||||
const OAuth2ClientList = ({
|
||||
pageIndex,
|
||||
searchTerm,
|
||||
isAdmin,
|
||||
setPage,
|
||||
}: {
|
||||
pageIndex: number;
|
||||
searchTerm: string;
|
||||
isAdmin: boolean;
|
||||
setPage: (page: number) => void;
|
||||
}) => {
|
||||
const OAuth2ClientList = ({ isAdmin }: { isAdmin: boolean }) => {
|
||||
const [pageIndex, setPageIndex] = useState(1);
|
||||
const [searchTerm, setSearchTerm] = useState('');
|
||||
const { data, mutate } = useSWR<PaginatedResponse<OAuth2ClientListItem>>(
|
||||
`/api/admin/oauth2/clients?page=${pageIndex}${
|
||||
searchTerm ? `&q=${searchTerm}` : ''
|
||||
}`
|
||||
}&pageSize=8`
|
||||
);
|
||||
|
||||
return data ? (
|
||||
return (
|
||||
<>
|
||||
<div className={styles.header}>
|
||||
<h1>OAuth2 clients</h1>
|
||||
@ -419,6 +411,17 @@ const OAuth2ClientList = ({
|
||||
Create new
|
||||
</Button>
|
||||
</div>
|
||||
<FormWrapper>
|
||||
<FormControl>
|
||||
<input
|
||||
value={searchTerm}
|
||||
onChange={(e) => setSearchTerm(e.target.value)}
|
||||
placeholder="Search titles, descriptions, IDs.."
|
||||
/>
|
||||
</FormControl>
|
||||
</FormWrapper>
|
||||
<br />
|
||||
{data ? (
|
||||
<div className={styles.clientList}>
|
||||
{data.list.map((client) => (
|
||||
<OAuth2ClientCard
|
||||
@ -429,31 +432,28 @@ const OAuth2ClientList = ({
|
||||
/>
|
||||
))}
|
||||
{data?.pagination && (
|
||||
<Paginator setPage={setPage} pagination={data.pagination}></Paginator>
|
||||
<Paginator
|
||||
setPage={setPageIndex}
|
||||
pagination={data.pagination}
|
||||
></Paginator>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<span>Nothing found</span>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export const OAuth2Page = () => {
|
||||
const { user } = useUser({ redirectTo: '/login' });
|
||||
const isAdmin = userHasPrivileges(user, 'admin:oauth2');
|
||||
const [pageIndex, setPageIndex] = useState(1);
|
||||
const [searchTerm, setSearchTerm] = useState('');
|
||||
|
||||
return (
|
||||
<>
|
||||
<Header user={user}></Header>
|
||||
<Container>
|
||||
<OAuth2ClientList
|
||||
pageIndex={pageIndex}
|
||||
searchTerm={searchTerm}
|
||||
isAdmin={isAdmin}
|
||||
setPage={setPageIndex}
|
||||
/>
|
||||
<OAuth2ClientList isAdmin={isAdmin} />
|
||||
</Container>
|
||||
</>
|
||||
);
|
||||
|
@ -407,6 +407,16 @@ export const UsersPage = () => {
|
||||
<Header user={user}></Header>
|
||||
<Container>
|
||||
<h1>Users</h1>
|
||||
<FormWrapper>
|
||||
<FormControl>
|
||||
<input
|
||||
value={searchTerm}
|
||||
onChange={(e) => setSearchTerm(e.target.value)}
|
||||
placeholder="Search usernames, display names, emails, UUIDs.."
|
||||
/>
|
||||
</FormControl>
|
||||
</FormWrapper>
|
||||
<br />
|
||||
<UserList
|
||||
pageIndex={pageIndex}
|
||||
searchTerm={searchTerm}
|
||||
|
Reference in New Issue
Block a user