mirror of
https://github.com/hexastack/hexabot
synced 2025-02-22 12:28:26 +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) => {
|
||||
setSelectedNlpValues(selection as string[]);
|
||||
};
|
||||
const handleDeleteNlpValues = async () => {
|
||||
const isConfirmed = await dialogs.confirm(ConfirmDialogBody, {
|
||||
mode: "selection",
|
||||
count: selectedNlpValues.length,
|
||||
});
|
||||
|
||||
if (isConfirmed) {
|
||||
deleteNlpValues(selectedNlpValues);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Grid container gap={2} flexDirection="column">
|
||||
@ -209,22 +219,10 @@ export const NlpValues = ({ entityId }: { entityId: string }) => {
|
||||
{selectedNlpValues.length > 0 && (
|
||||
<Grid item>
|
||||
<Button
|
||||
startIcon={<DeleteIcon />}
|
||||
variant="contained"
|
||||
color="error"
|
||||
onClick={async () => {
|
||||
const isConfirmed = await dialogs.confirm(
|
||||
ConfirmDialogBody,
|
||||
{
|
||||
mode: "selection",
|
||||
count: selectedNlpValues.length,
|
||||
},
|
||||
);
|
||||
|
||||
if (isConfirmed) {
|
||||
deleteNlpValues(selectedNlpValues);
|
||||
}
|
||||
}}
|
||||
variant="contained"
|
||||
onClick={handleDeleteNlpValues}
|
||||
startIcon={<DeleteIcon />}
|
||||
>
|
||||
{t("button.delete")}
|
||||
</Button>
|
||||
|
Loading…
Reference in New Issue
Block a user