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({
|
export function OwnerFilter({
|
||||||
name,
|
name,
|
||||||
label,
|
label,
|
||||||
description
|
description,
|
||||||
|
apiFilter
|
||||||
}: {
|
}: {
|
||||||
name: string;
|
name: string;
|
||||||
label: string;
|
label: string;
|
||||||
description: string;
|
description: string;
|
||||||
|
apiFilter?: Record<string, any>;
|
||||||
}): TableFilter {
|
}): TableFilter {
|
||||||
return {
|
return {
|
||||||
name: name,
|
name: name,
|
||||||
@@ -386,6 +388,7 @@ export function OwnerFilter({
|
|||||||
description: description,
|
description: description,
|
||||||
type: 'api',
|
type: 'api',
|
||||||
apiUrl: apiUrl(ApiEndpoints.owner_list),
|
apiUrl: apiUrl(ApiEndpoints.owner_list),
|
||||||
|
apiFilter: { is_active: true, ...apiFilter },
|
||||||
model: ModelType.owner,
|
model: ModelType.owner,
|
||||||
modelRenderer: (instance: any) => instance.name
|
modelRenderer: (instance: any) => instance.name
|
||||||
};
|
};
|
||||||
@@ -425,11 +428,13 @@ export function TagsFilter({
|
|||||||
export function UserFilter({
|
export function UserFilter({
|
||||||
name,
|
name,
|
||||||
label,
|
label,
|
||||||
description
|
description,
|
||||||
|
apiFilter
|
||||||
}: {
|
}: {
|
||||||
name?: string;
|
name?: string;
|
||||||
label?: string;
|
label?: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
|
apiFilter?: Record<string, any>;
|
||||||
}): TableFilter {
|
}): TableFilter {
|
||||||
return {
|
return {
|
||||||
name: name ?? 'user',
|
name: name ?? 'user',
|
||||||
@@ -437,6 +442,7 @@ export function UserFilter({
|
|||||||
description: description ?? t`Filter by user`,
|
description: description ?? t`Filter by user`,
|
||||||
type: 'api',
|
type: 'api',
|
||||||
apiUrl: apiUrl(ApiEndpoints.user_list),
|
apiUrl: apiUrl(ApiEndpoints.user_list),
|
||||||
|
apiFilter: { is_active: true, ...apiFilter },
|
||||||
model: ModelType.user,
|
model: ModelType.user,
|
||||||
modelRenderer: (instance: any) => instance.username
|
modelRenderer: (instance: any) => instance.username
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -585,7 +585,7 @@ export function ColumnFilterPopover({
|
|||||||
const closeOnApply = filters.length === 1;
|
const closeOnApply = filters.length === 1;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack gap={5} p={3}>
|
<Stack gap={5} p={3} miw={250}>
|
||||||
{filters.map((filter, index) => (
|
{filters.map((filter, index) => (
|
||||||
<Stack gap='xs' key={filter.name}>
|
<Stack gap='xs' key={filter.name}>
|
||||||
{index > 0 && <Divider />}
|
{index > 0 && <Divider />}
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ export function BuildOrderTable({
|
|||||||
UserColumn({
|
UserColumn({
|
||||||
accessor: 'issued_by_detail',
|
accessor: 'issued_by_detail',
|
||||||
ordering: 'issued_by',
|
ordering: 'issued_by',
|
||||||
|
filter: 'issued_by',
|
||||||
title: t`Issued By`
|
title: t`Issued By`
|
||||||
}),
|
}),
|
||||||
ResponsibleColumn({}),
|
ResponsibleColumn({}),
|
||||||
|
|||||||
Reference in New Issue
Block a user