Skip to content

Commit 5d6cf76

Browse files
Merge remote-tracking branch 'origin/main' into tabstabs/add-branch-type
2 parents 54aa342 + 366d737 commit 5d6cf76

File tree

132 files changed

+7102
-3305
lines changed

Some content is hidden

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

132 files changed

+7102
-3305
lines changed

package-lock.json

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

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gridstudy-app",
3-
"version": "2.21.0-SNAPSHOT",
3+
"version": "2.22.0-SNAPSHOT",
44
"license": "MPL-2.0",
55
"private": true,
66
"type": "module",
@@ -11,15 +11,15 @@
1111
"dependencies": {
1212
"@emotion/react": "^11.14.0",
1313
"@emotion/styled": "^11.14.0",
14-
"@gridsuite/commons-ui": "0.115.0",
14+
"@gridsuite/commons-ui": "0.117.0",
1515
"@hello-pangea/dnd": "^18.0.1",
1616
"@hookform/resolvers": "^4.0.0",
1717
"@mui/icons-material": "^5.16.14",
1818
"@mui/lab": "5.0.0-alpha.175",
1919
"@mui/material": "^5.16.14",
2020
"@mui/x-charts": "^7.25.0",
2121
"@mui/x-tree-view": "^7.28.1",
22-
"@powsybl/network-viewer": "1.9.1",
22+
"@powsybl/network-viewer": "1.10.0",
2323
"@reduxjs/toolkit": "^2.5.1",
2424
"@svgdotjs/svg.js": "^3.2.4",
2525
"@xyflow/react": "^12.4.2",

sonar-project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ sonar.projectKey=gridsuite_gridstudy-app
22
sonar.organization=gridsuite
33
sonar.projectBaseDir=src
44
sonar.javascript.lcov.reportPaths=./coverage/lcov.info
5-
sonar.cpd.exclusions=**/translations/**
5+
sonar.cpd.exclusions=**/translations/**,**/*css-vars.ts

src/components/app.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
NotificationsUrlKeys,
2323
useNotificationsListener,
2424
useSnackMessage,
25+
LAST_SELECTED_DIRECTORY,
2526
} from '@gridsuite/commons-ui';
2627
import PageNotFound from './page-not-found';
2728
import { FormattedMessage } from 'react-intl';
@@ -120,6 +121,9 @@ const App = () => {
120121
case PARAM_FAVORITE_CONTINGENCY_LISTS:
121122
dispatch(selectFavoriteContingencyLists(param.value.split(',').filter((list) => list)));
122123
break;
124+
case LAST_SELECTED_DIRECTORY:
125+
localStorage.setItem(LAST_SELECTED_DIRECTORY, param.value);
126+
break;
123127
default:
124128
console.error('unsupported UI parameters : ', param.name);
125129
}

src/components/custom-aggrid/cell-renderers.tsx

Lines changed: 1 addition & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,14 @@
55
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
66
*/
77

8-
import { Box, Checkbox, Tooltip, IconButton, Menu, MenuItem } from '@mui/material';
8+
import { Box, Checkbox, Tooltip } from '@mui/material';
99
import { Theme } from '@mui/material/styles';
1010
import { ReactNode, useEffect, useRef, useState } from 'react';
11-
import CalculateIcon from '@mui/icons-material/Calculate';
12-
import { useDispatch, useSelector } from 'react-redux';
13-
import { setCalculationSelections } from '../../redux/actions';
14-
import { AppState } from '../../redux/reducer';
1511

1612
import { isBlankOrEmpty } from 'components/utils/validation-functions';
1713
import { ICellRendererParams } from 'ag-grid-community';
1814
import { CustomCellRendererProps } from 'ag-grid-react';
1915
import { mergeSx } from '@gridsuite/commons-ui';
20-
import { useIntl } from 'react-intl';
21-
import { CalculationRowType, CalculationType } from '../spreadsheet-view/types/calculation.type';
22-
import { isCalculationRow } from '../spreadsheet-view/utils/calculation-utils';
2316

2417
const styles = {
2518
tableCell: (theme: Theme) => ({
@@ -42,18 +35,6 @@ const styles = {
4235
numericValue: {
4336
marginLeft: 'inherit',
4437
},
45-
menuItemLabel: {
46-
marginLeft: 1,
47-
},
48-
calculationButton: {
49-
position: 'absolute',
50-
top: '50%',
51-
left: '50%',
52-
transform: 'translate(-50%, -50%)',
53-
padding: 0,
54-
minWidth: 'auto',
55-
minHeight: 'auto',
56-
},
5738
};
5839

5940
export const BooleanCellRenderer = (props: any) => {
@@ -265,115 +246,3 @@ export const ContingencyCellRenderer = ({ value }: { value: { cellValue: ReactNo
265246
</Box>
266247
);
267248
};
268-
269-
export const RowIndexCellRenderer = (props: CustomCellRendererProps) => {
270-
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
271-
const open = Boolean(anchorEl);
272-
273-
const intl = useIntl();
274-
275-
// Get tab UUID from context passed via column definition
276-
const tabUuid = props.colDef?.context?.tabUuid || '';
277-
278-
const dispatch = useDispatch();
279-
const calculationSelections = useSelector((state: AppState) => state.calculationSelections);
280-
281-
// Get selections for current tab
282-
const selections = calculationSelections[tabUuid] || [];
283-
284-
const handleClick = (event: React.MouseEvent<HTMLElement>) => {
285-
setAnchorEl(event.currentTarget);
286-
};
287-
288-
const handleClose = () => {
289-
setAnchorEl(null);
290-
};
291-
292-
const handleSelectionChange = (option: CalculationType) => {
293-
const newSelections = selections.includes(option)
294-
? selections.filter((item) => item !== option)
295-
: [...selections, option];
296-
297-
dispatch(setCalculationSelections(tabUuid, newSelections));
298-
};
299-
300-
if (isCalculationRow(props.data?.rowType)) {
301-
if (props.data?.rowType === CalculationRowType.CALCULATION_BUTTON) {
302-
return (
303-
<Box style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '100%' }}>
304-
<IconButton size="small" aria-label="calculate" onClick={handleClick} sx={styles.calculationButton}>
305-
<CalculateIcon fontSize="small" />
306-
</IconButton>
307-
<Menu anchorEl={anchorEl} open={open} onClose={handleClose}>
308-
<MenuItem dense onClick={() => handleSelectionChange(CalculationType.AVERAGE)}>
309-
<Checkbox
310-
checked={selections.includes(CalculationType.AVERAGE)}
311-
size="small"
312-
disableRipple
313-
/>
314-
<Box sx={styles.menuItemLabel}>
315-
{intl.formatMessage({ id: 'spreadsheet/calculation/average' })}
316-
</Box>
317-
</MenuItem>
318-
<MenuItem dense onClick={() => handleSelectionChange(CalculationType.SUM)}>
319-
<Checkbox checked={selections.includes(CalculationType.SUM)} size="small" disableRipple />
320-
<Box sx={styles.menuItemLabel}>
321-
{intl.formatMessage({ id: 'spreadsheet/calculation/sum' })}
322-
</Box>
323-
</MenuItem>
324-
<MenuItem dense onClick={() => handleSelectionChange(CalculationType.MIN)}>
325-
<Checkbox checked={selections.includes(CalculationType.MIN)} size="small" disableRipple />
326-
<Box sx={styles.menuItemLabel}>
327-
{intl.formatMessage({ id: 'spreadsheet/calculation/min' })}
328-
</Box>
329-
</MenuItem>
330-
<MenuItem dense onClick={() => handleSelectionChange(CalculationType.MAX)}>
331-
<Checkbox checked={selections.includes(CalculationType.MAX)} size="small" disableRipple />
332-
<Box sx={styles.menuItemLabel}>
333-
{intl.formatMessage({ id: 'spreadsheet/calculation/max' })}
334-
</Box>
335-
</MenuItem>
336-
</Menu>
337-
</Box>
338-
);
339-
}
340-
341-
// Row with calculation results - show appropriate label
342-
if (props.data?.rowType === CalculationRowType.CALCULATION) {
343-
let label = '';
344-
switch (props.data.calculationType) {
345-
case CalculationType.SUM:
346-
label = intl.formatMessage({ id: 'spreadsheet/calculation/sum_abbrev' });
347-
break;
348-
case CalculationType.AVERAGE:
349-
label = intl.formatMessage({ id: 'spreadsheet/calculation/average_abbrev' });
350-
break;
351-
case CalculationType.MIN:
352-
label = intl.formatMessage({ id: 'spreadsheet/calculation/min_abbrev' });
353-
break;
354-
case CalculationType.MAX:
355-
label = intl.formatMessage({ id: 'spreadsheet/calculation/max_abbrev' });
356-
break;
357-
}
358-
359-
return (
360-
<Box
361-
style={{
362-
display: 'flex',
363-
justifyContent: 'center',
364-
alignItems: 'center',
365-
height: '100%',
366-
fontWeight: 'bold',
367-
}}
368-
>
369-
{label}
370-
</Box>
371-
);
372-
}
373-
374-
return null;
375-
}
376-
377-
// For normal rows, return the row index number
378-
return props.value;
379-
};

0 commit comments

Comments
 (0)