[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; tableState: TableState;
availableFilters: TableFilter[]; availableFilters: TableFilter[];
}) { }) {
const filterOptions = useMemo(() => { const filterOptions: TableFilterChoice[] = useMemo(() => {
let activeFilterNames = let activeFilterNames =
tableState.activeFilters?.map((flt) => flt.name) ?? []; tableState.activeFilters?.map((flt) => flt.name) ?? [];
return availableFilters return (
.filter((flt) => !activeFilterNames.includes(flt.name)) availableFilters
.map((flt) => ({ ?.filter((flt) => !activeFilterNames.includes(flt.name))
value: flt.name, ?.map((flt) => ({
label: flt.label, value: flt.name,
description: flt.description label: flt.label,
})); description: flt.description
})) ?? []
);
}, [tableState.activeFilters, availableFilters]); }, [tableState.activeFilters, availableFilters]);
const [selectedFilter, setSelectedFilter] = useState<string | null>(null); const [selectedFilter, setSelectedFilter] = useState<string | null>(null);

View File

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