fix: config checkbox selection in the admin panel

pull/147/head
Boaz Poolman 2024-10-12 19:44:39 +02:00
parent 00da5012d8
commit b14ee74c36
2 changed files with 8 additions and 12 deletions

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { Tr, Td, Checkbox, Typography } from '@strapi/design-system'; import { Tr, Td, Checkbox, Typography, Box } from '@strapi/design-system';
const CustomRow = ({ row, checked, updateValue, ...props }) => { const CustomRow = ({ row, checked, updateValue, ...props }) => {
const { configName, configType, state, onClick } = row; const { configName, configType, state, onClick } = row;
@ -39,26 +39,23 @@ const CustomRow = ({ row, checked, updateValue, ...props }) => {
if (e.target.type !== 'checkbox') { if (e.target.type !== 'checkbox') {
onClick(configType, configName); onClick(configType, configName);
} }
if (props.onClick) {
props.onClick(e);
}
}} }}
style={{ cursor: 'pointer' }} style={{ cursor: 'pointer' }}
> >
<Td> <Td>
<Checkbox <Checkbox
aria-label={`Select ${configName}`} aria-label={`Select ${configName}`}
value={checked} checked={checked}
onValueChange={updateValue} onCheckedChange={updateValue}
/> />
</Td> </Td>
<Td> <Td onClick={(e) => props.onClick(e)}>
<Typography variant="omega">{configName}</Typography> <Typography variant="omega">{configName}</Typography>
</Td> </Td>
<Td> <Td onClick={(e) => props.onClick(e)}>
<Typography variant="omega">{configType}</Typography> <Typography variant="omega">{configType}</Typography>
</Td> </Td>
<Td> <Td onClick={(e) => props.onClick(e)}>
<Typography variant="omega" style={stateStyle(state)}>{state}</Typography> <Typography variant="omega" style={stateStyle(state)}>{state}</Typography>
</Td> </Td>
</Tr> </Tr>

View File

@ -123,9 +123,8 @@ const ConfigList = ({ diff, isLoading }) => {
<Th> <Th>
<Checkbox <Checkbox
aria-label={formatMessage({ id: 'config-sync.ConfigList.SelectAll' })} aria-label={formatMessage({ id: 'config-sync.ConfigList.SelectAll' })}
indeterminate={isIndeterminate} checked={isIndeterminate ? "indeterminate" : allChecked}
onValueChange={(value) => setCheckedItems(checkedItems.map(() => value))} onCheckedChange={(value) => setCheckedItems(checkedItems.map(() => value))}
value={allChecked}
/> />
</Th> </Th>
<Th> <Th>