From 303cbb68641b42900f6fc9a0e26eb261b896c798 Mon Sep 17 00:00:00 2001 From: Oliver Date: Tue, 19 Mar 2024 13:41:53 +1100 Subject: [PATCH] [PUI] Tweaks (#6750) * Remove extraneous header * Update checkbox column in PartParameterTemplateTable * Render boolean values for checkbox parameter columns * Fix for table column names query - Ensure it always fires --- src/frontend/src/pages/Index/Settings/SystemSettings.tsx | 1 - src/frontend/src/tables/InvenTreeTable.tsx | 3 ++- src/frontend/src/tables/part/ParametricPartTable.tsx | 9 ++++++++- .../src/tables/part/PartParameterTemplateTable.tsx | 6 +++--- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/frontend/src/pages/Index/Settings/SystemSettings.tsx b/src/frontend/src/pages/Index/Settings/SystemSettings.tsx index b2558461aa..02bde95f61 100644 --- a/src/frontend/src/pages/Index/Settings/SystemSettings.tsx +++ b/src/frontend/src/pages/Index/Settings/SystemSettings.tsx @@ -132,7 +132,6 @@ export default function SystemSettings() { - {t`Exchange Rates`} ) }, diff --git a/src/frontend/src/tables/InvenTreeTable.tsx b/src/frontend/src/tables/InvenTreeTable.tsx index 38988674ca..5c60711a6f 100644 --- a/src/frontend/src/tables/InvenTreeTable.tsx +++ b/src/frontend/src/tables/InvenTreeTable.tsx @@ -133,9 +133,10 @@ export function InvenTreeTable({ // Request OPTIONS data from the API, before we load the table const tableOptionQuery = useQuery({ - enabled: false, + enabled: true, queryKey: ['options', url, tableState.tableKey], retry: 3, + refetchOnMount: true, queryFn: async () => { return api .options(url, { diff --git a/src/frontend/src/tables/part/ParametricPartTable.tsx b/src/frontend/src/tables/part/ParametricPartTable.tsx index 1749033972..c3aac52527 100644 --- a/src/frontend/src/tables/part/ParametricPartTable.tsx +++ b/src/frontend/src/tables/part/ParametricPartTable.tsx @@ -4,6 +4,7 @@ import { useMemo } from 'react'; import { useNavigate } from 'react-router-dom'; import { api } from '../../App'; +import { YesNoButton } from '../../components/items/YesNoButton'; import { ApiEndpoints } from '../../enums/ApiEndpoints'; import { ModelType } from '../../enums/ModelType'; import { getDetailUrl } from '../../functions/urls'; @@ -73,9 +74,15 @@ export default function ParametricPartTable({ extra.push(`${parameter.data_numeric} [${template.units}]`); } + let value: any = parameter.data; + + if (template?.checkbox) { + value = ; + } + return ( diff --git a/src/frontend/src/tables/part/PartParameterTemplateTable.tsx b/src/frontend/src/tables/part/PartParameterTemplateTable.tsx index cde98193de..9d4651ae00 100644 --- a/src/frontend/src/tables/part/PartParameterTemplateTable.tsx +++ b/src/frontend/src/tables/part/PartParameterTemplateTable.tsx @@ -14,7 +14,7 @@ import { useTable } from '../../hooks/UseTable'; import { apiUrl } from '../../states/ApiState'; import { useUserState } from '../../states/UserState'; import { TableColumn } from '../Column'; -import { DescriptionColumn } from '../ColumnRenderers'; +import { BooleanColumn, DescriptionColumn } from '../ColumnRenderers'; import { TableFilter } from '../Filter'; import { InvenTreeTable } from '../InvenTreeTable'; import { RowDeleteAction, RowEditAction } from '../RowActions'; @@ -61,9 +61,9 @@ export default function PartParameterTemplateTable() { sortable: true }, DescriptionColumn({}), - { + BooleanColumn({ accessor: 'checkbox' - }, + }), { accessor: 'choices' }