From 6b533b7606c9aecdc9c2c569b004209795dd6004 Mon Sep 17 00:00:00 2001 From: BOUTIER Charly Date: Mon, 6 Oct 2025 16:53:25 +0200 Subject: [PATCH 1/2] Reuse the same SLD when navigating in the VLs, or use CTRL to open a new SLD. Signed-off-by: BOUTIER Charly --- .../cards/diagrams/diagram-card.tsx | 27 ++++++++++++++++--- .../single-line-diagram-content.tsx | 2 +- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/components/grid-layout/cards/diagrams/diagram-card.tsx b/src/components/grid-layout/cards/diagrams/diagram-card.tsx index 82c59c3934..e36840bb36 100644 --- a/src/components/grid-layout/cards/diagrams/diagram-card.tsx +++ b/src/components/grid-layout/cards/diagrams/diagram-card.tsx @@ -171,7 +171,7 @@ export const DiagramCard = forwardRef((props: DiagramCardProps, ref: Ref { createDiagram({ diagramUuid: v4() as UUID, @@ -183,6 +183,27 @@ export const DiagramCard = forwardRef((props: DiagramCardProps, ref: Ref { + if (event.ctrlKey) { + createDiagram({ + diagramUuid: v4() as UUID, + type: DiagramType.VOLTAGE_LEVEL, + voltageLevelId: vlId, + name: '', + }); + } else { + updateDiagram({ + ...diagram, + type: DiagramType.VOLTAGE_LEVEL, + voltageLevelId: vlId, + name: '', + }); + } + }, + [diagram, createDiagram, updateDiagram] + ); + const cardTitle = useMemo((): string => { if (loading) { return intl.formatMessage({ id: 'loadingOptions' }); @@ -214,7 +235,7 @@ export const DiagramCard = forwardRef((props: DiagramCardProps, ref: Ref )} {diagram.type === DiagramType.NETWORK_AREA_DIAGRAM && ( @@ -245,7 +266,7 @@ export const DiagramCard = forwardRef((props: DiagramCardProps, ref: Ref )} diff --git a/src/components/grid-layout/cards/diagrams/singleLineDiagram/single-line-diagram-content.tsx b/src/components/grid-layout/cards/diagrams/singleLineDiagram/single-line-diagram-content.tsx index 0a8da71792..92e40e40ca 100644 --- a/src/components/grid-layout/cards/diagrams/singleLineDiagram/single-line-diagram-content.tsx +++ b/src/components/grid-layout/cards/diagrams/singleLineDiagram/single-line-diagram-content.tsx @@ -53,7 +53,7 @@ interface SingleLineDiagramContentProps { readonly diagramSizeSetter: (id: UUID, type: DiagramType, width: number, height: number) => void; readonly diagramId: UUID; readonly visible: boolean; - readonly onNextVoltageLevelClick: (voltageLevelId: string) => void; + readonly onNextVoltageLevelClick: (voltageLevelId: string, event: MouseEvent) => void; } type BusMenuState = { From c2aa898ab41ad20f023dc88022ce01914621e7a9 Mon Sep 17 00:00:00 2001 From: BOUTIER Charly Date: Tue, 7 Oct 2025 16:30:51 +0200 Subject: [PATCH 2/2] PR Review Signed-off-by: BOUTIER Charly --- .../singleLineDiagram/single-line-diagram-content.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/grid-layout/cards/diagrams/singleLineDiagram/single-line-diagram-content.tsx b/src/components/grid-layout/cards/diagrams/singleLineDiagram/single-line-diagram-content.tsx index 92e40e40ca..504ab97a89 100644 --- a/src/components/grid-layout/cards/diagrams/singleLineDiagram/single-line-diagram-content.tsx +++ b/src/components/grid-layout/cards/diagrams/singleLineDiagram/single-line-diagram-content.tsx @@ -20,7 +20,12 @@ import { } from '../diagram-utils'; import { styles } from '../diagram-styles'; import { MapEquipment } from '../../../../menus/base-equipment-menu'; -import { OnBreakerCallbackType, SingleLineDiagramViewer, SLDMetadata } from '@powsybl/network-viewer'; +import { + OnBreakerCallbackType, + OnNextVoltageCallbackType, + SingleLineDiagramViewer, + SLDMetadata, +} from '@powsybl/network-viewer'; import { isNodeReadOnly } from '../../../../graph/util/model-functions'; import { useIsAnyNodeBuilding } from '../../../../utils/is-any-node-building-hook'; import Alert from '@mui/material/Alert'; @@ -53,7 +58,7 @@ interface SingleLineDiagramContentProps { readonly diagramSizeSetter: (id: UUID, type: DiagramType, width: number, height: number) => void; readonly diagramId: UUID; readonly visible: boolean; - readonly onNextVoltageLevelClick: (voltageLevelId: string, event: MouseEvent) => void; + readonly onNextVoltageLevelClick: OnNextVoltageCallbackType; } type BusMenuState = {