Skip to content

Commit 6b114ba

Browse files
authored
Merge branch 'main' into dbraquart/check-write-perm-before-study-opening
2 parents 02f2751 + 92d91a5 commit 6b114ba

33 files changed

+614
-285
lines changed

src/components/dialogs/active-power-control/active-power-control-form.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
66
*/
77

8-
import { percentageTextField } from '../dialog-utils';
98
import { useWatch } from 'react-hook-form';
109
import { DROOP, FREQUENCY_REGULATION } from 'components/utils/field-constants';
1110
import { useMemo } from 'react';
1211
import { FloatInput, SwitchInput } from '@gridsuite/commons-ui';
1312
import { FormattedMessage, useIntl } from 'react-intl';
1413
import CheckboxNullableInput from 'components/utils/rhf-inputs/boolean-nullable-input';
15-
import { Box } from '@mui/material';
14+
import { Box, Tooltip } from '@mui/material';
1615
import GridItem from '../commons/grid-item';
1716
import { ActivePowerControlInfos } from './active-power-control.type';
17+
import { InfoOutlined } from '@mui/icons-material';
1818

1919
export interface ActivePowerControlFormProps {
2020
isEquipmentModification?: boolean;
@@ -60,12 +60,20 @@ export function ActivePowerControlForm({
6060
<FloatInput
6161
name={DROOP}
6262
label={'Droop'}
63-
adornment={percentageTextField}
6463
previousValue={Number.isNaN(previousValues?.droop) ? undefined : (previousValues?.droop ?? undefined)}
6564
clearable={true}
6665
/>
6766
);
6867

68+
const descriptionTooltip = useMemo(
69+
() => (
70+
<Tooltip title={intl.formatMessage({ id: 'activePowerControlTooltip' })}>
71+
<InfoOutlined color="info" fontSize="medium" />
72+
</Tooltip>
73+
),
74+
[intl]
75+
);
76+
6977
return (
7078
<>
7179
{isEquipmentModification ? (
@@ -79,6 +87,7 @@ export function ActivePowerControlForm({
7987
<GridItem size={4}>{frequencyRegulationField}</GridItem>
8088
)}
8189
<GridItem size={4}>{droopField}</GridItem>
90+
<GridItem size={4}>{descriptionTooltip}</GridItem>
8291
</>
8392
);
8493
}

src/components/dialogs/network-modifications/generator/creation/generator-creation-form.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,7 @@ export default function GeneratorCreationForm({
166166

167167
{/* Short Circuit part */}
168168
<GridSection title="ShortCircuit" />
169-
<Grid container spacing={2}>
170-
<ShortCircuitForm />
171-
</Grid>
169+
<ShortCircuitForm />
172170

173171
{/* Cost of start part */}
174172
<GridSection title="GenerationDispatch" />

src/components/grid-layout/cards/diagrams/diagram.type.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ export type DiagramBase = {
4949

5050
export type VoltageLevelDiagram = DiagramBase & {
5151
type: DiagramType.VOLTAGE_LEVEL;
52-
voltageLevelId: string;
52+
diagramId: string;
5353
};
5454
export type SubstationDiagram = DiagramBase & {
5555
type: DiagramType.SUBSTATION;
56-
substationId: string;
56+
diagramId: string;
5757
};
5858
export type NetworkAreaDiagram = DiagramBase & {
5959
type: DiagramType.NETWORK_AREA_DIAGRAM;

src/components/grid-layout/cards/diagrams/networkAreaDiagram/network-area-diagram-content.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ import {
4545
} from '@gridsuite/commons-ui';
4646
import DiagramControls from './diagram-controls';
4747
import { createDiagramConfig, updateDiagramConfig, type DiagramConfigPosition } from 'services/explore';
48-
import { DiagramType, type VoltageLevelDiagramParams } from '../diagram.type';
4948
import NodeContextMenu from './node-context-menu';
5049
import useEquipmentMenu from 'hooks/use-equipment-menu';
5150
import { MapEquipment } from 'components/menus/base-equipment-menu';
@@ -66,7 +65,7 @@ type NetworkAreaDiagramContentProps = {
6665
readonly svgVoltageLevels?: string[];
6766
readonly loadingState: boolean;
6867
readonly visible: boolean;
69-
readonly onVoltageLevelClick: (diagramParams: VoltageLevelDiagramParams) => void;
68+
readonly onVoltageLevelClick: (voltageLevelId: string) => void;
7069
readonly onUpdateVoltageLevels: (params: {
7170
voltageLevelIds: string[];
7271
voltageLevelToExpandIds: string[];
@@ -165,10 +164,7 @@ function NetworkAreaDiagramContent(props: NetworkAreaDiagramContentProps) {
165164
setShouldDisplayMenu(true);
166165
setMenuAnchorPosition(mousePosition ? { mouseX: mousePosition.x, mouseY: mousePosition.y } : null);
167166
} else {
168-
onVoltageLevelClick({
169-
type: DiagramType.VOLTAGE_LEVEL,
170-
voltageLevelId: equipmentId,
171-
});
167+
onVoltageLevelClick(equipmentId);
172168
}
173169
}
174170
},

src/components/grid-layout/cards/diagrams/singleLineDiagram/single-line-diagram-content.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ interface SingleLineDiagramContentProps {
5656
readonly loadingState: boolean;
5757
readonly visible: boolean;
5858
readonly diagramParams: VoltageLevelDiagramParams | SubstationDiagramParams;
59-
readonly onNextVoltageLevelDiagram?: (diagramParams: VoltageLevelDiagramParams) => void;
60-
readonly onNewVoltageLevelDiagram?: (diagramParams: VoltageLevelDiagramParams) => void;
59+
readonly onNextVoltageLevelDiagram?: (voltageLevelId: string) => void;
60+
readonly onNewVoltageLevelDiagram?: (voltageLevelId: string) => void;
6161
}
6262

6363
type BusMenuState = {
@@ -196,15 +196,9 @@ function SingleLineDiagramContent(props: SingleLineDiagramContentProps) {
196196
const handleNextVoltageLevelClick: OnNextVoltageCallbackType = useCallback(
197197
(vlId, event) => {
198198
if (event.ctrlKey) {
199-
onNewVoltageLevelDiagram?.({
200-
type: DiagramType.VOLTAGE_LEVEL,
201-
voltageLevelId: vlId,
202-
});
199+
onNewVoltageLevelDiagram?.(vlId);
203200
} else {
204-
onNextVoltageLevelDiagram?.({
205-
type: DiagramType.VOLTAGE_LEVEL,
206-
voltageLevelId: vlId,
207-
});
201+
onNextVoltageLevelDiagram?.(vlId);
208202
}
209203
},
210204
[onNewVoltageLevelDiagram, onNextVoltageLevelDiagram]

src/components/network-modification-tree-pane.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,9 @@ export const NetworkModificationTreePane = ({ studyUuid, currentRootNetworkUuid
311311
studyUpdatedForce.eventData.headers.updateType === NotificationType.NODE_BUILD_STATUS_UPDATED &&
312312
studyUpdatedForce.eventData.headers.rootNetworkUuid === currentRootNetworkUuidRef.current
313313
) {
314-
updateNodes(studyUpdatedForce.eventData.headers.nodes);
314+
// Note: The actual node updates are now handled globally in study-container.jsx
315+
// to ensure all workspaces open in other browser tabs (including those without tree panel) stay synchronized.
316+
// Here we only handle tree-specific cleanup operations.
315317
if (studyUpdatedForce.eventData.headers.nodes.some((nodeId) => nodeId === currentNodeRef.current?.id)) {
316318
dispatch(removeNotificationByNode([currentNodeRef.current?.id]));
317319
// when the current node is updated, we need to reset the logs filter

src/components/network/network-map-panel.tsx

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import {
4747
import { isNodeBuilt, isNodeEdited, isSameNodeAndBuilt } from '../graph/util/model-functions';
4848
import { resetMapEquipment, setMapDataLoading, setReloadMapNeeded } from '../../redux/actions';
4949
import { openSLD, showInSpreadsheet } from '../../redux/slices/workspace-slice';
50+
import { PanelType } from '../workspace/types/workspace.types';
5051
import GSMapEquipments from './gs-map-equipments';
5152
import { Box, Button, LinearProgress, Tooltip, useTheme } from '@mui/material';
5253
import { EQUIPMENT_TYPES } from '../utils/equipment-types';
@@ -65,7 +66,6 @@ import { CurrentTreeNode } from 'components/graph/tree-node.type';
6566
import { FormattedMessage } from 'react-intl';
6667
import { Search } from '@mui/icons-material';
6768
import { TopBarEquipmentSearchDialog } from 'components/top-bar-equipment-seach-dialog/top-bar-equipment-search-dialog';
68-
import { DiagramType } from 'components/grid-layout/cards/diagrams/diagram.type';
6969
import GuidancePopup from './guidance-popup';
7070
import SelectionCreationPanel from './selection-creation-panel/selection-creation-panel';
7171
import { useEquipmentMenu } from '../../hooks/use-equipment-menu';
@@ -991,21 +991,14 @@ export const NetworkMapPanel = ({
991991
[isInDrawingMode, leaveDrawingMode]
992992
);
993993

994-
const openSLDInTheGrid = useCallback(
995-
(equipmentId: string, diagramType: DiagramType.VOLTAGE_LEVEL | DiagramType.SUBSTATION) => {
996-
dispatch(openSLD({ id: equipmentId, diagramType }));
997-
},
998-
[dispatch]
999-
);
1000-
1001994
const handleOpenVoltageLevel = useCallback(
1002995
(vlId: string) => {
1003996
// don't open the sld if the drawing mode is activated
1004997
if (!isInDrawingMode.value) {
1005-
openSLDInTheGrid(vlId, DiagramType.VOLTAGE_LEVEL);
998+
dispatch(openSLD({ id: vlId, panelType: PanelType.SLD_VOLTAGE_LEVEL }));
1006999
}
10071000
},
1008-
[isInDrawingMode, openSLDInTheGrid]
1001+
[dispatch, isInDrawingMode]
10091002
);
10101003

10111004
const getHvdcExtendedEquipmentType = (hvdcType: string): ExtendedEquipmentType | null => {
@@ -1184,10 +1177,10 @@ export const NetworkMapPanel = ({
11841177
if (!id) {
11851178
return;
11861179
}
1187-
const diagramType = isSubstation ? DiagramType.SUBSTATION : DiagramType.VOLTAGE_LEVEL;
1188-
openSLDInTheGrid(id, diagramType);
1180+
const panelType = isSubstation ? PanelType.SLD_SUBSTATION : PanelType.SLD_VOLTAGE_LEVEL;
1181+
dispatch(openSLD({ id, panelType }));
11891182
},
1190-
[openSLDInTheGrid]
1183+
[dispatch]
11911184
);
11921185

11931186
return (

src/components/results/loadflow/use-load-flow-result-column-actions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import type { UUID } from 'node:crypto';
1414
import { useSnackMessage } from '@gridsuite/commons-ui';
1515
import { useIntl } from 'react-intl';
1616
import { openSLD } from '../../../redux/slices/workspace-slice';
17-
import { DiagramType } from '../../grid-layout/cards/diagrams/diagram.type';
17+
import { PanelType } from '../../workspace/types/workspace.types';
1818
import { useDispatch } from 'react-redux';
1919

2020
type UseLoadFlowResultColumnActionsProps = {
@@ -67,7 +67,7 @@ export const useLoadFlowResultColumnActions = ({
6767
})
6868
.finally(() => {
6969
if (vlId) {
70-
dispatch(openSLD({ id: vlId, diagramType: DiagramType.VOLTAGE_LEVEL }));
70+
dispatch(openSLD({ id: vlId, panelType: PanelType.SLD_VOLTAGE_LEVEL }));
7171
return;
7272
}
7373
snackError({

src/components/results/pccmin/pcc-min-result-table.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { GridReadyEvent, ICellRendererParams, RowDataUpdatedEvent } from 'ag-gri
2323
import { getColumnHeaderDisplayNames } from 'components/utils/column-constant';
2424
import { resultsStyles } from '../common/utils';
2525
import { openSLD } from '../../../redux/slices/workspace-slice';
26-
import { DiagramType } from '../../grid-layout/cards/diagrams/diagram.type';
26+
import { PanelType } from 'components/workspace/types/workspace.types';
2727

2828
const styles = {
2929
gridContainer: { display: 'flex', flexDirection: 'column', height: '100%' },
@@ -49,7 +49,7 @@ const PccMinResultTable: FunctionComponent<PccMinResultTableProps> = ({
4949
const onClick = () => {
5050
const vlId = node?.data?.voltageLevelId;
5151
if (vlId) {
52-
dispatch(openSLD({ id: vlId, diagramType: DiagramType.VOLTAGE_LEVEL }));
52+
dispatch(openSLD({ id: vlId, panelType: PanelType.SLD_VOLTAGE_LEVEL }));
5353
}
5454
};
5555
if (value) {

src/components/results/securityanalysis/use-security-analysis-column-defs.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { AppState } from 'redux/reducer';
2424
import { resultsStyles } from '../common/utils';
2525
import { FilterEnumsType } from '../../custom-aggrid/custom-aggrid-filters/custom-aggrid-filter.type';
2626
import { openSLD } from '../../../redux/slices/workspace-slice';
27-
import { DiagramType } from '../../grid-layout/cards/diagrams/diagram.type';
27+
import { PanelType } from '../../workspace/types/workspace.types';
2828

2929
export interface SecurityAnalysisFilterEnumsType {
3030
n: FilterEnumsType;
@@ -95,7 +95,7 @@ export const useSecurityAnalysisColumnsDefs: UseSecurityAnalysisColumnsDefsProps
9595
})
9696
.finally(() => {
9797
if (vlId) {
98-
dispatch(openSLD({ id: vlId, diagramType: DiagramType.VOLTAGE_LEVEL }));
98+
dispatch(openSLD({ id: vlId, panelType: PanelType.SLD_VOLTAGE_LEVEL }));
9999
return;
100100
}
101101
console.error(`Impossible to open the SLD for equipment ID '${row.subjectId}'`);

0 commit comments

Comments
 (0)