1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-05-31 01:16:01 +02:00

feat: add authentication as a table filter (#3206)

Adds `auth` as a table filter.
Also fixes the hook to correctly fetch the events based on the new
return type.

<img width="1046" alt="image"
src="https://user-images.githubusercontent.com/14320932/221603312-a40055a8-4c23-4f1f-9a87-7fbd03e7b49e.png">
This commit is contained in:
Nuno Góis 2023-02-28 08:32:21 +00:00 committed by GitHub
parent 8e79820783
commit c0124371ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -79,6 +79,7 @@ export const SignOnLogTable = () => {
maxWidth: 150, maxWidth: 150,
Cell: HighlightCell, Cell: HighlightCell,
searchable: true, searchable: true,
filterName: 'auth',
}, },
{ {
Header: 'IP address', Header: 'IP address',
@ -87,11 +88,11 @@ export const SignOnLogTable = () => {
searchable: true, searchable: true,
}, },
{ {
Header: 'Successful', Header: 'Success',
accessor: 'successful', accessor: 'successful',
align: 'center', align: 'center',
Cell: SignOnLogSuccessfulCell, Cell: SignOnLogSuccessfulCell,
filterName: 'successful', filterName: 'success',
filterParsing: (value: boolean) => value.toString(), filterParsing: (value: boolean) => value.toString(),
}, },
{ {

View File

@ -12,14 +12,14 @@ export const useSignOnLog = () => {
const { data, error, mutate } = useConditionalSWR( const { data, error, mutate } = useConditionalSWR(
signOnLog && isEnterprise(), signOnLog && isEnterprise(),
[], { events: [] },
formatApiPath(`api/admin/signons`), formatApiPath(`api/admin/signons`),
fetcher fetcher
); );
return useMemo( return useMemo(
() => ({ () => ({
events: (data ?? []) as ISignOnEvent[], events: (data?.events ?? []) as ISignOnEvent[],
loading: !error && !data, loading: !error && !data,
refetch: () => mutate(), refetch: () => mutate(),
error, error,