From 767de3f725fbbdc089aa5156fc586977199094c7 Mon Sep 17 00:00:00 2001 From: Varsha Thakur <262733231+thakurvarsha0109-tech@users.noreply.github.com> Date: Sun, 29 Nov 2026 23:36:51 +0530 Subject: [PATCH] Add node summary support and Quick View popup --- src/component/modals/GraphCompDetails.jsx | 20 ++- src/component/modals/NodeDetails.jsx | 62 ++++--- src/graph-builder/graph-core/1-core.js | 153 +++++++++++++++++- src/graph-builder/graph-core/3-component.js | 29 +++- src/graph-builder/graph-core/5-load-save.js | 35 +++- src/graph-builder/graphml/builder/graphML.js | 8 + src/graph-builder/graphml/builder/index.js | 1 + src/graph-builder/graphml/builder/nodeML.js | 8 +- .../graphml/parser/parseProperties.js | 8 +- src/graph-builder/tailored-graph-builder.js | 9 +- src/reducer/reducer.js | 1 + src/toolbarActions/toolbarFunctions.js | 46 +++++- 12 files changed, 337 insertions(+), 43 deletions(-) diff --git a/src/component/modals/GraphCompDetails.jsx b/src/component/modals/GraphCompDetails.jsx index a8316a0c..86b52197 100644 --- a/src/component/modals/GraphCompDetails.jsx +++ b/src/component/modals/GraphCompDetails.jsx @@ -14,7 +14,8 @@ const ModalComp = ({ closeModal, superState, dispatcher }) => { const [createHelpClicked, setCreateHelpClicked] = useState(false); const { modalPayload, ModelOpen } = superState; const { - cb, title, submitText, Children, defaultStyle, defaultLabel, labelAllowed, type, + cb, title, submitText, Children, defaultStyle, defaultLabel, + defaultSummary, labelAllowed, type, } = modalPayload; useEffect(() => { @@ -22,16 +23,24 @@ const ModalComp = ({ closeModal, superState, dispatcher }) => { }, [ModelOpen]); useEffect(() => { - setData({ label: defaultLabel || '', style: defaultStyle }); + setData({ + label: defaultLabel || '', + style: defaultStyle, + summary: defaultSummary || '', + }); setErrorMessage(''); - }, [defaultLabel, defaultStyle]); + }, [defaultLabel, defaultStyle, defaultSummary]); const submit = (e) => { e.preventDefault(); - const message = cb(data.label, data.style); + const message = cb(data.label, data.style, data.summary || ''); if (message.ok) { setErrorMessage(''); - setData({ label: defaultLabel || '', style: defaultStyle }); + setData({ + label: defaultLabel || '', + style: defaultStyle, + summary: defaultSummary || '', + }); closeModal(); } else setErrorMessage(message.err); }; @@ -173,4 +182,5 @@ const ModalComp = ({ closeModal, superState, dispatcher }) => { ); }; + export default ModalComp; diff --git a/src/component/modals/NodeDetails.jsx b/src/component/modals/NodeDetails.jsx index 5bd76bb8..6d12459f 100644 --- a/src/component/modals/NodeDetails.jsx +++ b/src/component/modals/NodeDetails.jsx @@ -18,6 +18,9 @@ const NodeDetails = ({ const indexOfFile = []; indexOfFile.push(0); + const currentLabel = String(data.label || ''); + const currentSummary = String(data.summary || ''); + const setStyle = (prop) => { setData({ ...data, style: { ...data.style, ...prop } }); }; @@ -42,7 +45,7 @@ const NodeDetails = ({ }, [state.fileState]); useEffect(() => { - if (!widthSet) { + if (!widthSet && textRef.current) { setStyle({ width: Math.max(data.style.width, Math.min(500, textRef.current.offsetWidth + 20)), }); @@ -50,8 +53,8 @@ const NodeDetails = ({ }, [!widthSet && data.label]); useEffect(() => { - setLabelName(data.label.split(':')[0]); - }, [data.label]); + setLabelName(currentLabel.split(':')[0]); + }, [currentLabel]); return (