From c0124371cae108246e5eeef8dd637088a660f054 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20G=C3=B3is?= Date: Tue, 28 Feb 2023 08:32:21 +0000 Subject: [PATCH] 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. image --- .../component/signOnLog/SignOnLogTable/SignOnLogTable.tsx | 5 +++-- frontend/src/hooks/api/getters/useSignOnLog/useSignOnLog.ts | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/src/component/signOnLog/SignOnLogTable/SignOnLogTable.tsx b/frontend/src/component/signOnLog/SignOnLogTable/SignOnLogTable.tsx index 8a498b8a9c..f202255e1c 100644 --- a/frontend/src/component/signOnLog/SignOnLogTable/SignOnLogTable.tsx +++ b/frontend/src/component/signOnLog/SignOnLogTable/SignOnLogTable.tsx @@ -79,6 +79,7 @@ export const SignOnLogTable = () => { maxWidth: 150, Cell: HighlightCell, searchable: true, + filterName: 'auth', }, { Header: 'IP address', @@ -87,11 +88,11 @@ export const SignOnLogTable = () => { searchable: true, }, { - Header: 'Successful', + Header: 'Success', accessor: 'successful', align: 'center', Cell: SignOnLogSuccessfulCell, - filterName: 'successful', + filterName: 'success', filterParsing: (value: boolean) => value.toString(), }, { diff --git a/frontend/src/hooks/api/getters/useSignOnLog/useSignOnLog.ts b/frontend/src/hooks/api/getters/useSignOnLog/useSignOnLog.ts index 53dd3f1d2c..812f078bdd 100644 --- a/frontend/src/hooks/api/getters/useSignOnLog/useSignOnLog.ts +++ b/frontend/src/hooks/api/getters/useSignOnLog/useSignOnLog.ts @@ -12,14 +12,14 @@ export const useSignOnLog = () => { const { data, error, mutate } = useConditionalSWR( signOnLog && isEnterprise(), - [], + { events: [] }, formatApiPath(`api/admin/signons`), fetcher ); return useMemo( () => ({ - events: (data ?? []) as ISignOnEvent[], + events: (data?.events ?? []) as ISignOnEvent[], loading: !error && !data, refetch: () => mutate(), error,