Fixed Account Log filter
This commit is contained in:
@@ -12,16 +12,20 @@ export const AccountLog = ({ sameIPLogs, userId }: { sameIPLogs: Log[]; userId:
|
|||||||
const tableRef = useRef<PaginatedTableRef>(null);
|
const tableRef = useRef<PaginatedTableRef>(null);
|
||||||
return (
|
return (
|
||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
<div className="card-title flex justify-between">
|
|
||||||
<h2 className="flex items-center gap-2">
|
|
||||||
<Printer className="h-5 w-5" /> Account Log
|
|
||||||
</h2>
|
|
||||||
<p className="text-end text-sm text-gray-500">
|
|
||||||
Hier werden Logs angezeigt, die dem Nutzer zugeordnet sind oder von der selben IP stammen.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<PaginatedTable
|
<PaginatedTable
|
||||||
ref={tableRef}
|
ref={tableRef}
|
||||||
|
showSearch
|
||||||
|
leftOfSearch={
|
||||||
|
<div className="card-title flex justify-between">
|
||||||
|
<h2 className="flex items-center gap-2">
|
||||||
|
<Printer className="h-5 w-5" /> Account Log
|
||||||
|
</h2>
|
||||||
|
<p className="text-end text-sm text-gray-500">
|
||||||
|
Hier werden Logs angezeigt, die dem Nutzer zugeordnet sind oder von der selben IP
|
||||||
|
stammen.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
rightOfPagination={
|
rightOfPagination={
|
||||||
<div className="ml-4 flex items-center gap-2">
|
<div className="ml-4 flex items-center gap-2">
|
||||||
<input
|
<input
|
||||||
@@ -45,8 +49,15 @@ export const AccountLog = ({ sameIPLogs, userId }: { sameIPLogs: Log[]; userId:
|
|||||||
getFilter={(searchTerm) => {
|
getFilter={(searchTerm) => {
|
||||||
return {
|
return {
|
||||||
AND: [
|
AND: [
|
||||||
|
onlyImportant
|
||||||
|
? {
|
||||||
|
type: {
|
||||||
|
in: ["REGISTER", "PROFILE_CHANGE"],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: {},
|
||||||
{
|
{
|
||||||
OR: [
|
AND: [
|
||||||
{ ip: { contains: searchTerm } },
|
{ ip: { contains: searchTerm } },
|
||||||
{ browser: { contains: searchTerm } },
|
{ browser: { contains: searchTerm } },
|
||||||
{
|
{
|
||||||
@@ -58,24 +69,6 @@ export const AccountLog = ({ sameIPLogs, userId }: { sameIPLogs: Log[]; userId:
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
onlyImportant
|
|
||||||
? {
|
|
||||||
OR: [
|
|
||||||
{
|
|
||||||
id: {
|
|
||||||
in: sameIPLogs
|
|
||||||
.filter((log) => log.id.toString().includes(searchTerm))
|
|
||||||
.map((log) => log.id),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: {
|
|
||||||
in: ["REGISTER", "PROFILE_CHANGE"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
: {},
|
|
||||||
],
|
],
|
||||||
} as Prisma.LogWhereInput;
|
} as Prisma.LogWhereInput;
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user