mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add level and user filters
This commit is contained in:
parent
07bb315bb3
commit
1a939fe473
1 changed files with 17 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
|||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import type { ActivityLogEntry } from '@jellyfin/sdk/lib/generated-client/models/activity-log-entry';
|
||||
import { LogLevel } from '@jellyfin/sdk/lib/generated-client/models/log-level';
|
||||
import type { UserDto } from '@jellyfin/sdk/lib/generated-client/models/user-dto';
|
||||
import Box from '@mui/material/Box';
|
||||
import ToggleButton from '@mui/material/ToggleButton';
|
||||
|
@ -68,7 +69,15 @@ const Activity = () => {
|
|||
[userId]: user
|
||||
};
|
||||
}, {});
|
||||
}, [usersData]);
|
||||
}, [ usersData ]);
|
||||
|
||||
const userNames = useMemo(() => {
|
||||
const names: string[] = [];
|
||||
usersData?.forEach(user => {
|
||||
if (user.Name) names.push(user.Name);
|
||||
});
|
||||
return names;
|
||||
}, [ usersData ]);
|
||||
|
||||
const UserCell = getUserCell(users);
|
||||
|
||||
|
@ -92,8 +101,10 @@ const Activity = () => {
|
|||
enableResizing: false,
|
||||
muiTableBodyCellProps: {
|
||||
align: 'center'
|
||||
}
|
||||
}], [ activityView, users, UserCell ]);
|
||||
},
|
||||
filterVariant: 'multi-select',
|
||||
filterSelectOptions: userNames
|
||||
}], [ activityView, userNames, users, UserCell ]);
|
||||
|
||||
const columns = useMemo<MRT_ColumnDef<ActivityLogEntry>[]>(() => [
|
||||
{
|
||||
|
@ -112,7 +123,9 @@ const Activity = () => {
|
|||
enableResizing: false,
|
||||
muiTableBodyCellProps: {
|
||||
align: 'center'
|
||||
}
|
||||
},
|
||||
filterVariant: 'multi-select',
|
||||
filterSelectOptions: Object.values(LogLevel).map(level => globalize.translate(`LogLevel.${level}`))
|
||||
},
|
||||
...userColumn,
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue