mirror of
https://github.com/inventree/InvenTree.git
synced 2026-06-11 19:27:02 +00:00
[UI] User Filters (#12143)
* Enforce min width for drop-down filters * Pass active filter to owner column * Fix filter name * Add active filter to UserFilter by default
This commit is contained in:
@@ -374,11 +374,13 @@ export function ProjectCodeFilter(): TableFilter {
|
||||
export function OwnerFilter({
|
||||
name,
|
||||
label,
|
||||
description
|
||||
description,
|
||||
apiFilter
|
||||
}: {
|
||||
name: string;
|
||||
label: string;
|
||||
description: string;
|
||||
apiFilter?: Record<string, any>;
|
||||
}): TableFilter {
|
||||
return {
|
||||
name: name,
|
||||
@@ -386,6 +388,7 @@ export function OwnerFilter({
|
||||
description: description,
|
||||
type: 'api',
|
||||
apiUrl: apiUrl(ApiEndpoints.owner_list),
|
||||
apiFilter: { is_active: true, ...apiFilter },
|
||||
model: ModelType.owner,
|
||||
modelRenderer: (instance: any) => instance.name
|
||||
};
|
||||
@@ -425,11 +428,13 @@ export function TagsFilter({
|
||||
export function UserFilter({
|
||||
name,
|
||||
label,
|
||||
description
|
||||
description,
|
||||
apiFilter
|
||||
}: {
|
||||
name?: string;
|
||||
label?: string;
|
||||
description?: string;
|
||||
apiFilter?: Record<string, any>;
|
||||
}): TableFilter {
|
||||
return {
|
||||
name: name ?? 'user',
|
||||
@@ -437,6 +442,7 @@ export function UserFilter({
|
||||
description: description ?? t`Filter by user`,
|
||||
type: 'api',
|
||||
apiUrl: apiUrl(ApiEndpoints.user_list),
|
||||
apiFilter: { is_active: true, ...apiFilter },
|
||||
model: ModelType.user,
|
||||
modelRenderer: (instance: any) => instance.username
|
||||
};
|
||||
|
||||
@@ -585,7 +585,7 @@ export function ColumnFilterPopover({
|
||||
const closeOnApply = filters.length === 1;
|
||||
|
||||
return (
|
||||
<Stack gap={5} p={3}>
|
||||
<Stack gap={5} p={3} miw={250}>
|
||||
{filters.map((filter, index) => (
|
||||
<Stack gap='xs' key={filter.name}>
|
||||
{index > 0 && <Divider />}
|
||||
|
||||
@@ -120,6 +120,7 @@ export function BuildOrderTable({
|
||||
UserColumn({
|
||||
accessor: 'issued_by_detail',
|
||||
ordering: 'issued_by',
|
||||
filter: 'issued_by',
|
||||
title: t`Issued By`
|
||||
}),
|
||||
ResponsibleColumn({}),
|
||||
|
||||
Reference in New Issue
Block a user