fix: enhance logic

This commit is contained in:
yassinedorbozgithub 2025-01-21 08:25:24 +01:00
parent 3b2f070128
commit ca065c29d2
5 changed files with 15 additions and 15 deletions

View File

@ -123,7 +123,7 @@ export const Categories = () => {
actionColumns,
];
const handleSelectionChange = (selection: GridRowSelectionModel) =>
deleteDialogCtl.saveData?.(selection as string[]);
deleteDialogCtl.setData?.(selection as string[]);
return (
<Grid container gap={3} flexDirection="column">
@ -158,7 +158,7 @@ export const Categories = () => {
</Button>
</Grid>
) : null}
{deleteDialogCtl?.data?.length && (
{deleteDialogCtl.data?.length ? (
<Grid item>
<Button
startIcon={<DeleteIcon />}
@ -169,7 +169,7 @@ export const Categories = () => {
{t("button.delete")}
</Button>
</Grid>
)}
) : null}
</Grid>
</PageHeader>
</Grid>

View File

@ -158,7 +158,7 @@ export const ContextVars = () => {
actionColumns,
];
const handleSelectionChange = (selection: GridRowSelectionModel) =>
deleteDialogCtl.saveData?.(selection as string[]);
deleteDialogCtl.setData?.(selection as string[]);
return (
<Grid container gap={3} flexDirection="column">
@ -193,7 +193,7 @@ export const ContextVars = () => {
</Button>
</Grid>
) : null}
{deleteDialogCtl?.data?.length && (
{deleteDialogCtl.data?.length ? (
<Grid item>
<Button
startIcon={<DeleteIcon />}
@ -204,7 +204,7 @@ export const ContextVars = () => {
{t("button.delete")}
</Button>
</Grid>
)}
) : null}
</Grid>
</PageHeader>
<Grid item xs={12}>

View File

@ -170,7 +170,7 @@ const NlpEntity = () => {
actionEntityColumns,
];
const handleSelectionChange = (selection: GridRowSelectionModel) =>
deleteDialogCtl.saveData?.(selection as string[]);
deleteDialogCtl.setData?.(selection as string[]);
return (
<Grid item xs={12}>
@ -202,7 +202,7 @@ const NlpEntity = () => {
</Button>
</Grid>
) : null}
{deleteDialogCtl?.data?.length && (
{deleteDialogCtl.data?.length ? (
<Grid item>
<Button
startIcon={<DeleteIcon />}
@ -213,7 +213,7 @@ const NlpEntity = () => {
{t("button.delete")}
</Button>
</Grid>
)}
) : null}
</Grid>
<Grid mt={3}>
<DataGrid

View File

@ -291,7 +291,7 @@ export default function NlpSample() {
actionColumns,
];
const handleSelectionChange = (selection: GridRowSelectionModel) =>
deleteDialogCtl.saveData?.(selection as string[]);
deleteDialogCtl.setData?.(selection as string[]);
const handleImportChange = async (file: File) => {
await importDataset(file);
};
@ -396,7 +396,7 @@ export default function NlpSample() {
{t("button.export")}
</Button>
) : null}
{deleteDialogCtl.data && (
{deleteDialogCtl.data?.length ? (
<Grid item>
<Button
startIcon={<DeleteIcon />}
@ -407,7 +407,7 @@ export default function NlpSample() {
{t("button.delete")}
</Button>
</Grid>
)}
) : null}
</ButtonGroup>
</Grid>
</Grid>

View File

@ -151,7 +151,7 @@ export const NlpValues = ({ entityId }: { entityId: string }) => {
const canHaveSynonyms = nlpEntity?.lookups?.[0] === NlpLookups.keywords;
const handleSelectionChange = (selection: GridRowSelectionModel) =>
deleteDialogCtl.saveData?.(selection as string[]);
deleteDialogCtl.setData?.(selection as string[]);
return (
<Grid container gap={2} flexDirection="column">
@ -202,7 +202,7 @@ export const NlpValues = ({ entityId }: { entityId: string }) => {
{t("button.add")}
</Button>
) : null}
{deleteDialogCtl?.data?.length && (
{deleteDialogCtl.data?.length ? (
<Grid item>
<Button
startIcon={<DeleteIcon />}
@ -213,7 +213,7 @@ export const NlpValues = ({ entityId }: { entityId: string }) => {
{t("button.delete")}
</Button>
</Grid>
)}
) : null}
</ButtonGroup>
</Grid>
</PageHeader>