mirror of
https://github.com/hexastack/hexabot
synced 2025-02-22 20:38:32 +00:00
fix(frontend): add handleDeleteNlpValues function
This commit is contained in:
parent
f755cf672d
commit
71b2c3cf3b
@ -156,6 +156,16 @@ export const NlpValues = ({ entityId }: { entityId: string }) => {
|
|||||||
const handleSelectionChange = (selection: GridRowSelectionModel) => {
|
const handleSelectionChange = (selection: GridRowSelectionModel) => {
|
||||||
setSelectedNlpValues(selection as string[]);
|
setSelectedNlpValues(selection as string[]);
|
||||||
};
|
};
|
||||||
|
const handleDeleteNlpValues = async () => {
|
||||||
|
const isConfirmed = await dialogs.confirm(ConfirmDialogBody, {
|
||||||
|
mode: "selection",
|
||||||
|
count: selectedNlpValues.length,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (isConfirmed) {
|
||||||
|
deleteNlpValues(selectedNlpValues);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid container gap={2} flexDirection="column">
|
<Grid container gap={2} flexDirection="column">
|
||||||
@ -209,22 +219,10 @@ export const NlpValues = ({ entityId }: { entityId: string }) => {
|
|||||||
{selectedNlpValues.length > 0 && (
|
{selectedNlpValues.length > 0 && (
|
||||||
<Grid item>
|
<Grid item>
|
||||||
<Button
|
<Button
|
||||||
startIcon={<DeleteIcon />}
|
|
||||||
variant="contained"
|
|
||||||
color="error"
|
color="error"
|
||||||
onClick={async () => {
|
variant="contained"
|
||||||
const isConfirmed = await dialogs.confirm(
|
onClick={handleDeleteNlpValues}
|
||||||
ConfirmDialogBody,
|
startIcon={<DeleteIcon />}
|
||||||
{
|
|
||||||
mode: "selection",
|
|
||||||
count: selectedNlpValues.length,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
if (isConfirmed) {
|
|
||||||
deleteNlpValues(selectedNlpValues);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{t("button.delete")}
|
{t("button.delete")}
|
||||||
</Button>
|
</Button>
|
||||||
|
Loading…
Reference in New Issue
Block a user