[PUI] Add filters for parameteric part table (#7617)

This commit is contained in:
Oliver 2024-07-11 13:07:49 +10:00 committed by GitHub
parent 2ebe6e0a8e
commit 5e040c4dc4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 1 deletions

View File

@ -22,6 +22,7 @@ export function PassFailButton({
variant="filled"
radius="lg"
size="sm"
style={{ maxWidth: '50px' }}
>
{v ? pass : fail}
</Badge>

View File

@ -22,6 +22,7 @@ import { apiUrl } from '../../states/ApiState';
import { useUserState } from '../../states/UserState';
import { TableColumn } from '../Column';
import { DescriptionColumn, PartColumn } from '../ColumnRenderers';
import { TableFilter } from '../Filter';
import { InvenTreeTable } from '../InvenTreeTable';
import { TableHoverCard } from '../TableHoverCard';
@ -214,6 +215,26 @@ export default function ParametricPartTable({
});
}, [user, categoryParmeters.data]);
const tableFilters: TableFilter[] = useMemo(() => {
return [
{
name: 'active',
label: t`Active`,
description: t`Show active parts`
},
{
name: 'locked',
label: t`Locked`,
description: t`Show locked parts`
},
{
name: 'assembly',
label: t`Assembly`,
description: t`Show assembly parts`
}
];
}, []);
const tableColumns: TableColumn[] = useMemo(() => {
const partColumns: TableColumn[] = [
{
@ -253,7 +274,8 @@ export default function ParametricPartTable({
category_detail: true,
parameters: true
},
modelType: ModelType.part
modelType: ModelType.part,
tableFilters: tableFilters
}}
/>
</>