From 18601a2ee77a001b45c8ba051df197710908f3d3 Mon Sep 17 00:00:00 2001 From: Ivan <8611739+IRBorisov@users.noreply.github.com> Date: Tue, 19 Nov 2024 22:58:43 +0300 Subject: [PATCH] M: Add warning when deleting constituents with children --- .../frontend/src/dialogs/DlgDeleteCst/DlgDeleteCst.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/rsconcept/frontend/src/dialogs/DlgDeleteCst/DlgDeleteCst.tsx b/rsconcept/frontend/src/dialogs/DlgDeleteCst/DlgDeleteCst.tsx index 2e23ef69..372eb6b0 100644 --- a/rsconcept/frontend/src/dialogs/DlgDeleteCst/DlgDeleteCst.tsx +++ b/rsconcept/frontend/src/dialogs/DlgDeleteCst/DlgDeleteCst.tsx @@ -22,6 +22,10 @@ function DlgDeleteCst({ hideWindow, selected, schema, onDelete }: DlgDeleteCstPr () => schema.graph.expandAllOutputs(selected), // prettier: split-lines [selected, schema.graph] ); + const hasInherited = useMemo( + () => selected.some(id => schema.inheritance.find(item => item.parent === id), [selected, schema.inheritance]), + [selected, schema.inheritance] + ); function handleSubmit() { hideWindow(); @@ -50,10 +54,13 @@ function DlgDeleteCst({ hideWindow, selected, schema, onDelete }: DlgDeleteCstPr /> setExpandOut(value)} /> + {hasInherited ? ( +

Внимание! Выбранные конституенты имеют наследников в ОСС

+ ) : null} ); }