Skip to content

Commit

Permalink
Merge branch 'main' into keep_sort_when_switching_between_tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
souissimai authored Jul 18, 2024
2 parents 4f5449c + 03c9ed6 commit 0a4b0ec
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/components/diagrams/diagram-pane.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,6 @@ export function DiagramPane({
},
[currentNode]
);

return (
<AutoSizer>
{({ width, height }) => (
Expand Down
7 changes: 5 additions & 2 deletions src/components/map-viewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,12 @@ const MapViewer = ({

const openVoltageLevel = useCallback(
(vlId) => {
openDiagramView(vlId, DiagramType.VOLTAGE_LEVEL);
// don't open the sld if the drawing mode is activated
if (!isInDrawingMode) {
openDiagramView(vlId, DiagramType.VOLTAGE_LEVEL);
}
},
[openDiagramView]
[openDiagramView, isInDrawingMode]
);

function showInSpreadsheet(equipment) {
Expand Down
49 changes: 42 additions & 7 deletions src/components/network/network-map-tab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,20 @@ export const NetworkMapTab = ({
}

const voltageLevelMenuClick = (equipment, x, y) => {
showEquipmentMenu(equipment, x, y, EQUIPMENT_TYPES.VOLTAGE_LEVEL);
// don't display the voltage level menu in drawing mode.
if (!isInDrawingMode) {
showEquipmentMenu(equipment, x, y, EQUIPMENT_TYPES.VOLTAGE_LEVEL);
}
};

const chooseVoltageLevelForSubstation = useCallback(
(idSubstation, x, y) => {
setChoiceVoltageLevelsSubstationId(idSubstation);
setPosition([x, y]);
if (!isInDrawingMode) {
setChoiceVoltageLevelsSubstationId(idSubstation);
setPosition([x, y]);
}
},
[]
[isInDrawingMode]
);

const getEquipmentsNotFoundIds = useCallback(
Expand Down Expand Up @@ -963,6 +968,18 @@ export const NetworkMapTab = ({
);
}

const displayEquipmentMenu = (
equipment,
x,
y,
equipmentType,
isInDrawingMode
) => {
// don't display the equipment menu in drawing mode.
if (!isInDrawingMode) {
showEquipmentMenu(equipment, x, y, equipmentType);
}
};
const renderEquipmentMenu = () => {
if (
disabled ||
Expand Down Expand Up @@ -1040,13 +1057,31 @@ export const NetworkMapTab = ({
chooseVoltageLevelForSubstation
}
onSubstationMenuClick={(equipment, x, y) =>
showEquipmentMenu(equipment, x, y, EQUIPMENT_TYPES.SUBSTATION)
displayEquipmentMenu(
equipment,
x,
y,
EQUIPMENT_TYPES.SUBSTATION,
isInDrawingMode
)
}
onLineMenuClick={(equipment, x, y) =>
showEquipmentMenu(equipment, x, y, EQUIPMENT_TYPES.LINE)
displayEquipmentMenu(
equipment,
x,
y,
EQUIPMENT_TYPES.LINE,
isInDrawingMode
)
}
onHvdcLineMenuClick={(equipment, x, y) =>
showEquipmentMenu(equipment, x, y, EQUIPMENT_TYPES.HVDC_LINE)
displayEquipmentMenu(
equipment,
x,
y,
EQUIPMENT_TYPES.HVDC_LINE,
isInDrawingMode
)
}
onVoltageLevelMenuClick={voltageLevelMenuClick}
mapBoxToken={mapBoxToken}
Expand Down

0 comments on commit 0a4b0ec

Please sign in to comment.