[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
This commit is contained in:
Oliver 2024-03-19 13:41:53 +11:00 committed by GitHub
parent 6a7ea919e1
commit 303cbb6864
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 6 deletions

View File

@ -132,7 +132,6 @@ export default function SystemSettings() {
<GlobalSettingList <GlobalSettingList
keys={['CURRENCY_UPDATE_PLUGIN', 'CURRENCY_UPDATE_INTERVAL']} keys={['CURRENCY_UPDATE_PLUGIN', 'CURRENCY_UPDATE_INTERVAL']}
/> />
<StylishText size="xl">{t`Exchange Rates`}</StylishText>
</> </>
) )
}, },

View File

@ -133,9 +133,10 @@ export function InvenTreeTable<T = any>({
// Request OPTIONS data from the API, before we load the table // Request OPTIONS data from the API, before we load the table
const tableOptionQuery = useQuery({ const tableOptionQuery = useQuery({
enabled: false, enabled: true,
queryKey: ['options', url, tableState.tableKey], queryKey: ['options', url, tableState.tableKey],
retry: 3, retry: 3,
refetchOnMount: true,
queryFn: async () => { queryFn: async () => {
return api return api
.options(url, { .options(url, {

View File

@ -4,6 +4,7 @@ import { useMemo } from 'react';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { api } from '../../App'; import { api } from '../../App';
import { YesNoButton } from '../../components/items/YesNoButton';
import { ApiEndpoints } from '../../enums/ApiEndpoints'; import { ApiEndpoints } from '../../enums/ApiEndpoints';
import { ModelType } from '../../enums/ModelType'; import { ModelType } from '../../enums/ModelType';
import { getDetailUrl } from '../../functions/urls'; import { getDetailUrl } from '../../functions/urls';
@ -73,9 +74,15 @@ export default function ParametricPartTable({
extra.push(`${parameter.data_numeric} [${template.units}]`); extra.push(`${parameter.data_numeric} [${template.units}]`);
} }
let value: any = parameter.data;
if (template?.checkbox) {
value = <YesNoButton value={parameter.data} />;
}
return ( return (
<TableHoverCard <TableHoverCard
value={parameter.data} value={value}
extra={extra} extra={extra}
title={t`Internal Units`} title={t`Internal Units`}
/> />

View File

@ -14,7 +14,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 } from '../ColumnRenderers'; import { BooleanColumn, DescriptionColumn } from '../ColumnRenderers';
import { TableFilter } from '../Filter'; import { TableFilter } from '../Filter';
import { InvenTreeTable } from '../InvenTreeTable'; import { InvenTreeTable } from '../InvenTreeTable';
import { RowDeleteAction, RowEditAction } from '../RowActions'; import { RowDeleteAction, RowEditAction } from '../RowActions';
@ -61,9 +61,9 @@ export default function PartParameterTemplateTable() {
sortable: true sortable: true
}, },
DescriptionColumn({}), DescriptionColumn({}),
{ BooleanColumn({
accessor: 'checkbox' accessor: 'checkbox'
}, }),
{ {
accessor: 'choices' accessor: 'choices'
} }