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