[PUI] Test table tweaks (#7231)

* Adjust table columns

* Tweak for FilterSelectDrawer
This commit is contained in:
Oliver 2024-05-15 14:12:55 +10:00 committed by GitHub
parent f8ef12f7bc
commit 516466bc50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 22 deletions

View File

@ -82,17 +82,19 @@ function FilterAddGroup({
tableState: TableState;
availableFilters: TableFilter[];
}) {
const filterOptions = useMemo(() => {
const filterOptions: TableFilterChoice[] = useMemo(() => {
let activeFilterNames =
tableState.activeFilters?.map((flt) => flt.name) ?? [];
return availableFilters
.filter((flt) => !activeFilterNames.includes(flt.name))
.map((flt) => ({
value: flt.name,
label: flt.label,
description: flt.description
}));
return (
availableFilters
?.filter((flt) => !activeFilterNames.includes(flt.name))
?.map((flt) => ({
value: flt.name,
label: flt.label,
description: flt.description
})) ?? []
);
}, [tableState.activeFilters, availableFilters]);
const [selectedFilter, setSelectedFilter] = useState<string | null>(null);

View File

@ -28,7 +28,7 @@ import { useTable } from '../../hooks/UseTable';
import { apiUrl } from '../../states/ApiState';
import { useUserState } from '../../states/UserState';
import { TableColumn } from '../Column';
import { DescriptionColumn, NoteColumn } from '../ColumnRenderers';
import { DateColumn, DescriptionColumn, NoteColumn } from '../ColumnRenderers';
import { TableFilter } from '../Filter';
import { InvenTreeTable } from '../InvenTreeTable';
import { RowActions, RowDeleteAction, RowEditAction } from '../RowActions';
@ -188,20 +188,13 @@ export default function StockItemTestResultTable({
record.attachment && <AttachmentLink attachment={record.attachment} />
},
NoteColumn(),
DateColumn({}),
{
accessor: 'date',
sortable: true,
title: t`Date`,
render: (record: any) => {
return (
<Group justify="space-between">
{renderDate(record.date)}
{record.user_detail && (
<RenderUser instance={record.user_detail} />
)}
</Group>
);
}
accessor: 'user',
title: t`User`,
sortable: false,
render: (record: any) =>
record.user_detail && <RenderUser instance={record.user_detail} />
},
{
accessor: 'test_station',