diff --git a/frontend/src/component/loginHistory/LoginHistoryTable/LoginHistoryDeleteDialog/LoginHistoryDeleteDialog.tsx b/frontend/src/component/loginHistory/LoginHistoryTable/LoginHistoryDeleteDialog/LoginHistoryDeleteDialog.tsx deleted file mode 100644 index 4fea356c97..0000000000 --- a/frontend/src/component/loginHistory/LoginHistoryTable/LoginHistoryDeleteDialog/LoginHistoryDeleteDialog.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { Dialogue } from 'component/common/Dialogue/Dialogue'; -import { ILoginEvent } from 'interfaces/loginEvent'; - -interface ILoginHistoryDeleteDialogProps { - event?: ILoginEvent; - open: boolean; - setOpen: React.Dispatch>; - onConfirm: (event: ILoginEvent) => void; -} - -export const LoginHistoryDeleteDialog = ({ - event, - open, - setOpen, - onConfirm, -}: ILoginHistoryDeleteDialogProps) => ( - onConfirm(event!)} - onClose={() => { - setOpen(false); - }} - > - You are about to delete event: #{event?.id} - -); diff --git a/frontend/src/component/loginHistory/LoginHistoryTable/LoginHistoryTable.tsx b/frontend/src/component/loginHistory/LoginHistoryTable/LoginHistoryTable.tsx index 17906b85a5..14c30a0323 100644 --- a/frontend/src/component/loginHistory/LoginHistoryTable/LoginHistoryTable.tsx +++ b/frontend/src/component/loginHistory/LoginHistoryTable/LoginHistoryTable.tsx @@ -19,8 +19,6 @@ import { TimeAgoCell } from 'component/common/Table/cells/TimeAgoCell/TimeAgoCel import { useLoginHistory } from 'hooks/api/getters/useLoginHistory/useLoginHistory'; import { LoginHistorySuccessfulCell } from './LoginHistorySuccessfulCell/LoginHistorySuccessfulCell'; import { ILoginEvent } from 'interfaces/loginEvent'; -import { LoginHistoryActionsCell } from './LoginHistoryActionsCell/LoginHistoryActionsCell'; -import { LoginHistoryDeleteDialog } from './LoginHistoryDeleteDialog/LoginHistoryDeleteDialog'; import { useLoginHistoryApi } from 'hooks/api/actions/useLoginHistoryApi/useLoginHistoryApi'; import { formatDateYMDHMS } from 'utils/formatDate'; import { useSearchParams } from 'react-router-dom'; @@ -50,7 +48,7 @@ export const LoginHistoryTable = () => { const { setToastData, setToastApiError } = useToast(); const { events, loading, refetch } = useLoginHistory(); - const { removeEvent, removeAllEvents, downloadCSV } = useLoginHistoryApi(); + const { removeAllEvents, downloadCSV } = useLoginHistoryApi(); const [searchParams, setSearchParams] = useSearchParams(); const [initialState] = useState(() => ({ @@ -67,24 +65,8 @@ export const LoginHistoryTable = () => { })); const [searchValue, setSearchValue] = useState(initialState.globalFilter); - const [selectedEvent, setSelectedEvent] = useState(); - const [deleteOpen, setDeleteOpen] = useState(false); const [deleteAllOpen, setDeleteAllOpen] = useState(false); - const onDeleteConfirm = async (event: ILoginEvent) => { - try { - await removeEvent(event.id); - setToastData({ - title: `Event has been deleted`, - type: 'success', - }); - refetch(); - setDeleteOpen(false); - } catch (error: unknown) { - setToastApiError(formatUnknownError(error)); - } - }; - const onDeleteAllConfirm = async () => { try { await removeAllEvents(); @@ -144,21 +126,6 @@ export const LoginHistoryTable = () => { filterName: 'success', filterParsing: (value: boolean) => value.toString(), }, - { - Header: 'Actions', - id: 'Actions', - align: 'center', - Cell: ({ row: { original: event } }: any) => ( - { - setSelectedEvent(event); - setDeleteOpen(true); - }} - /> - ), - width: 150, - disableSortBy: true, - }, // Always hidden -- for search { accessor: 'failure_reason', @@ -327,12 +294,6 @@ export const LoginHistoryTable = () => { /> } /> - { window.location.assign(url); }; - const removeEvent = async (eventId: number) => { - const requestId = 'removeEvent'; - const req = createRequest( - `api/admin/logins/${eventId}`, - { method: 'DELETE' }, - requestId - ); - - await makeRequest(req.caller, req.id); - }; - const removeAllEvents = async () => { const requestId = 'removeAllEvents'; const req = createRequest( @@ -46,7 +35,6 @@ export const useLoginHistoryApi = () => { return { downloadCSV, - removeEvent, removeAllEvents, errors, loading,