Skip to content

Commit e72d2ef

Browse files
Merge remote-tracking branch 'origin/main' into tabstabs/add-branch-type
2 parents 2306135 + 2bf7d08 commit e72d2ef

File tree

146 files changed

+4913
-2560
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+4913
-2560
lines changed

package-lock.json

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gridstudy-app",
3-
"version": "2.22.0-SNAPSHOT",
3+
"version": "2.23.0-SNAPSHOT",
44
"license": "MPL-2.0",
55
"private": true,
66
"type": "module",
@@ -11,7 +11,7 @@
1111
"dependencies": {
1212
"@emotion/react": "^11.14.0",
1313
"@emotion/styled": "^11.14.0",
14-
"@gridsuite/commons-ui": "0.117.0",
14+
"@gridsuite/commons-ui": "0.120.0",
1515
"@hello-pangea/dnd": "^18.0.1",
1616
"@hookform/resolvers": "^4.0.0",
1717
"@mui/icons-material": "^5.16.14",

src/components/app-wrapper.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ const lightTheme = createTheme({
124124
},
125125
palette: {
126126
mode: 'light',
127+
toolbarBackground: '#EEE',
127128
},
128129
link: {
129130
color: 'blue',
@@ -205,6 +206,7 @@ const darkTheme = createTheme({
205206
palette: {
206207
mode: 'dark',
207208
tabBackground: '#1e1e1e',
209+
toolbarBackground: '#424242',
208210
},
209211
link: {
210212
color: 'green',

src/components/app.jsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,29 @@ import {
1717
AnnouncementNotification,
1818
AuthenticationRouter,
1919
CardErrorBoundary,
20+
COMMON_APP_NAME,
21+
fetchConfigParameter,
22+
fetchConfigParameters,
2023
getPreLoginPath,
2124
initializeAuthenticationProd,
25+
LAST_SELECTED_DIRECTORY,
2226
NotificationsUrlKeys,
2327
useNotificationsListener,
2428
useSnackMessage,
25-
LAST_SELECTED_DIRECTORY,
29+
getComputedLanguage,
2630
} from '@gridsuite/commons-ui';
2731
import PageNotFound from './page-not-found';
2832
import { FormattedMessage } from 'react-intl';
2933
import {
3034
APP_NAME,
31-
COMMON_APP_NAME,
3235
PARAM_DEVELOPER_MODE,
3336
PARAM_FAVORITE_CONTINGENCY_LISTS,
3437
PARAM_LANGUAGE,
3538
PARAM_THEME,
3639
PARAM_USE_NAME,
3740
} from '../utils/config-params';
38-
import { getComputedLanguage } from '../utils/language';
3941
import AppTopBar from './app-top-bar';
4042
import { StudyContainer } from './study-container';
41-
import { fetchConfigParameter, fetchConfigParameters } from '../services/config';
4243
import { fetchDefaultParametersValues, fetchIdpSettings } from '../services/utils';
4344
import { getOptionalServices } from '../services/study/index';
4445
import {
@@ -136,7 +137,7 @@ const App = () => {
136137
(event) => {
137138
let eventData = JSON.parse(event.data);
138139
if (eventData.headers && eventData.headers['parameterName']) {
139-
fetchConfigParameter(eventData.headers['parameterName'])
140+
fetchConfigParameter(APP_NAME, eventData.headers['parameterName'])
140141
.then((param) => {
141142
updateParams([param]);
142143
})

src/components/custom-aggrid/custom-aggrid-filters/custom-aggrid-filter.type.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export enum FILTER_TEXT_COMPARATORS {
2626
}
2727

2828
export enum FILTER_NUMBER_COMPARATORS {
29+
EQUALS = 'equals',
2930
NOT_EQUAL = 'notEqual',
3031
LESS_THAN_OR_EQUAL = 'lessThanOrEqual',
3132
GREATER_THAN_OR_EQUAL = 'greaterThanOrEqual',

src/components/custom-aggrid/custom-aggrid-filters/utils/aggrid-filters-utils.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import { GridApi } from 'ag-grid-community';
99
import { addToleranceToFilter } from './filter-tolerance-utils';
1010
import { FilterConfig } from '../../../../types/custom-aggrid-types';
11-
import { FILTER_DATA_TYPES } from '../custom-aggrid-filter.type';
11+
import { FILTER_DATA_TYPES, FILTER_NUMBER_COMPARATORS } from '../custom-aggrid-filter.type';
1212

1313
export enum BooleanFilterValue {
1414
TRUE = 'true',
@@ -65,12 +65,17 @@ const formatCustomFiltersForAgGrid = (filters: FilterConfig[]): FilterModel => {
6565
filterType: filter.dataType,
6666
filter: filter.dataType === FILTER_DATA_TYPES.NUMBER ? Number(filter.value) : filter.value,
6767
}));
68+
// Determine operator based on filter types
69+
let operator = 'OR';
70+
if (filters.length === 2 && filters.every((f) => f?.originalType === FILTER_NUMBER_COMPARATORS.EQUALS)) {
71+
operator = 'AND'; // For EQUALS with tolerance
72+
}
6873

6974
// Create a combined filter model with 'OR' for all conditions
7075
agGridFilterModel[column] = {
7176
type: filters[0].type,
7277
tolerance: filters[0].tolerance,
73-
operator: 'OR',
78+
operator: operator,
7479
conditions,
7580
};
7681
}

src/components/custom-aggrid/custom-aggrid-filters/utils/filter-tolerance-utils.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,31 @@ export const addToleranceToFilter = (
5757
{
5858
...filter,
5959
type: UNDISPLAYED_FILTER_NUMBER_COMPARATORS.GREATER_THAN,
60+
originalType: filter.type,
6061
value: valueAsNumber + finalTolerance,
6162
},
6263
{
6364
...filter,
6465
type: UNDISPLAYED_FILTER_NUMBER_COMPARATORS.LESS_THAN,
66+
originalType: filter.type,
6567
value: valueAsNumber - finalTolerance,
6668
},
6769
];
70+
case FILTER_NUMBER_COMPARATORS.EQUALS:
71+
return [
72+
{
73+
...filter,
74+
type: FILTER_NUMBER_COMPARATORS.GREATER_THAN_OR_EQUAL,
75+
originalType: filter.type,
76+
value: valueAsNumber - finalTolerance,
77+
},
78+
{
79+
...filter,
80+
type: FILTER_NUMBER_COMPARATORS.LESS_THAN_OR_EQUAL,
81+
originalType: filter.type,
82+
value: valueAsNumber + finalTolerance,
83+
},
84+
];
6885
case FILTER_NUMBER_COMPARATORS.LESS_THAN_OR_EQUAL:
6986
// Adjust the value upwards by the tolerance
7087
return {

src/components/diagrams/diagram-common.ts

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
import { INVALID_LOADFLOW_OPACITY } from '../../utils/colors';
99
import { FEEDER_TYPES, FeederTypes } from 'components/utils/feederType';
1010
import { Theme } from '@mui/material';
11-
import { SLDMetadata, DiagramMetadata } from '@powsybl/network-viewer';
11+
import { DiagramMetadata, SLDMetadata } from '@powsybl/network-viewer';
1212
import { UUID } from 'crypto';
13-
import { EquipmentType } from '@gridsuite/commons-ui';
13+
import { EquipmentType, ExtendedEquipmentType } from '@gridsuite/commons-ui';
1414

1515
export const MIN_WIDTH = 150;
1616
export const MIN_HEIGHT = 150;
@@ -20,7 +20,6 @@ export const MAX_WIDTH_SUBSTATION = 1200;
2020
export const MAX_HEIGHT_SUBSTATION = 700;
2121
export const MAX_WIDTH_NETWORK_AREA_DIAGRAM = 1200;
2222
export const MAX_HEIGHT_NETWORK_AREA_DIAGRAM = 650;
23-
export const MAX_NUMBER_OF_NAD_DIAGRAMS = 3;
2423

2524
// Array of zoom levels used to determine level-of-detail rendering by applying in the network-viewer the
2625
// corresponding css class 'nad-zoom-{level}' to the NAD's SVG.
@@ -116,36 +115,47 @@ export const styles = {
116115
};
117116

118117
// be careful when using this method because there are treatments made on purpose
119-
export function getEquipmentTypeFromFeederType(feederType: FeederTypes | null): EquipmentType | null {
118+
export function getEquipmentTypeFromFeederType(feederType: FeederTypes | null): {
119+
equipmentType: EquipmentType | null;
120+
equipmentSubtype?: ExtendedEquipmentType;
121+
} | null {
120122
switch (feederType) {
121123
case FEEDER_TYPES.LINE:
122-
return EquipmentType.LINE;
124+
return { equipmentType: EquipmentType.LINE };
123125
case FEEDER_TYPES.LOAD:
124-
return EquipmentType.LOAD;
126+
return { equipmentType: EquipmentType.LOAD };
125127
case FEEDER_TYPES.BATTERY:
126-
return EquipmentType.BATTERY;
128+
return { equipmentType: EquipmentType.BATTERY };
127129
case FEEDER_TYPES.TIE_LINE:
128-
return EquipmentType.TIE_LINE;
130+
return { equipmentType: EquipmentType.TIE_LINE };
129131
case FEEDER_TYPES.DANGLING_LINE:
130-
return EquipmentType.DANGLING_LINE;
132+
return { equipmentType: EquipmentType.DANGLING_LINE };
131133
case FEEDER_TYPES.GENERATOR:
132-
return EquipmentType.GENERATOR;
133-
case FEEDER_TYPES.LCC_CONVERTER_STATION: // return EquipmentType.LCC_CONVERTER_STATION; TODO : to be reactivated in the next powsybl version
134-
case FEEDER_TYPES.VSC_CONVERTER_STATION: // return EquipmentType.VSC_CONVERTER_STATION; TODO : to be reactivated in the next powsybl version
134+
return { equipmentType: EquipmentType.GENERATOR };
135+
case FEEDER_TYPES.LCC_CONVERTER_STATION:
136+
return {
137+
equipmentType: EquipmentType.HVDC_LINE,
138+
equipmentSubtype: ExtendedEquipmentType.HVDC_LINE_LCC,
139+
};
140+
case FEEDER_TYPES.VSC_CONVERTER_STATION:
141+
return {
142+
equipmentType: EquipmentType.HVDC_LINE,
143+
equipmentSubtype: ExtendedEquipmentType.HVDC_LINE_VSC,
144+
};
135145
case FEEDER_TYPES.HVDC_LINE:
136-
return EquipmentType.HVDC_LINE;
146+
return { equipmentType: EquipmentType.HVDC_LINE };
137147
case FEEDER_TYPES.CAPACITOR:
138148
case FEEDER_TYPES.INDUCTOR:
139-
return EquipmentType.SHUNT_COMPENSATOR;
149+
return { equipmentType: EquipmentType.SHUNT_COMPENSATOR };
140150
case FEEDER_TYPES.STATIC_VAR_COMPENSATOR:
141-
return EquipmentType.STATIC_VAR_COMPENSATOR;
151+
return { equipmentType: EquipmentType.STATIC_VAR_COMPENSATOR };
142152
case FEEDER_TYPES.TWO_WINDINGS_TRANSFORMER:
143153
case FEEDER_TYPES.TWO_WINDINGS_TRANSFORMER_LEG:
144154
case FEEDER_TYPES.PHASE_SHIFT_TRANSFORMER:
145-
return EquipmentType.TWO_WINDINGS_TRANSFORMER;
155+
return { equipmentType: EquipmentType.TWO_WINDINGS_TRANSFORMER };
146156
case FEEDER_TYPES.THREE_WINDINGS_TRANSFORMER:
147157
case FEEDER_TYPES.THREE_WINDINGS_TRANSFORMER_LEG:
148-
return EquipmentType.THREE_WINDINGS_TRANSFORMER;
158+
return { equipmentType: EquipmentType.THREE_WINDINGS_TRANSFORMER };
149159
default: {
150160
console.log('bad feeder type ', feederType);
151161
return null;

src/components/diagrams/diagram-grid-header.tsx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import {
1919
} from '@gridsuite/commons-ui';
2020
import { TopBarEquipmentSearchDialog } from 'components/top-bar-equipment-seach-dialog/top-bar-equipment-search-dialog';
2121
import { EQUIPMENT_TYPES } from '../utils/equipment-types';
22+
import { useSelector } from 'react-redux';
23+
import { AppState } from 'redux/reducer';
2224

2325
const styles = {
2426
container: {
@@ -35,17 +37,19 @@ const styles = {
3537
interface DiagramGridHeaderProps {
3638
onLoad: (elementUuid: UUID, elementType: ElementType, elementName: string) => void;
3739
onSearch: (element: EquipmentInfos) => void;
40+
onOpenNetworkAreaDiagram?: (elementId?: string) => void;
3841
onLayoutSave: () => void;
3942
onMap?: () => void;
4043
}
4144

4245
export const DiagramGridHeader = (props: DiagramGridHeaderProps) => {
43-
const { onLoad, onSearch, onMap, onLayoutSave } = props;
46+
const { onLoad, onSearch, onOpenNetworkAreaDiagram, onMap, onLayoutSave } = props;
4447

4548
const intl = useIntl();
4649

4750
const [isLoadSelectorOpen, setIsLoadSelectorOpen] = useState(false);
4851
const [isDialogSearchOpen, setIsDialogSearchOpen] = useState(false);
52+
const mapOpen = useSelector((state: AppState) => state.mapOpen);
4953

5054
const selectElement = (selectedElements: TreeViewFinderNodeProps[]) => {
5155
if (selectedElements.length > 0 && selectedElements[0].type) {
@@ -96,12 +100,15 @@ export const DiagramGridHeader = (props: DiagramGridHeaderProps) => {
96100
})}
97101
multiSelect={false}
98102
/>
99-
<TopBarEquipmentSearchDialog
100-
showVoltageLevelDiagram={onSearch}
101-
isDialogSearchOpen={isDialogSearchOpen}
102-
setIsDialogSearchOpen={setIsDialogSearchOpen}
103-
disableEventSearch
104-
/>
103+
{!mapOpen && (
104+
<TopBarEquipmentSearchDialog
105+
showVoltageLevelDiagram={onSearch}
106+
onOpenNetworkAreaDiagram={onOpenNetworkAreaDiagram}
107+
isDialogSearchOpen={isDialogSearchOpen}
108+
setIsDialogSearchOpen={setIsDialogSearchOpen}
109+
disablCenterSubstation={true}
110+
/>
111+
)}
105112
</Box>
106113
);
107114
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Copyright (c) 2025, RTE (http://www.rte-france.com)
3+
* This Source Code Form is subject to the terms of the Mozilla Public
4+
* License, v. 2.0. If a copy of the MPL was not distributed with this
5+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
6+
*/
7+
8+
import { UUID } from 'crypto';
9+
import { Diagram, DiagramType } from './diagram.type';
10+
11+
export const MAX_NUMBER_OF_NAD_DIAGRAMS = 3;
12+
13+
export const countOpenedNadDiagrams = (diagrams: Record<UUID, Diagram>) => {
14+
return Object.values(diagrams).filter((diagram) => diagram?.type === DiagramType.NETWORK_AREA_DIAGRAM).length;
15+
};

0 commit comments

Comments
 (0)