-
Notifications
You must be signed in to change notification settings - Fork 4
refactoring #3496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
refactoring #3496
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
55fd46b
refactoring
cade03b
resolve conflicts
bc9e548
fix
1b40228
fix
a214372
fix sonar issue
ab3aa99
Merge branch 'main' into refactor_tooltip_css_style
souissimai 60c605f
fix sonar issues
c4a18e9
Merge branch 'main' into refactor_tooltip_css_style
souissimai 79f3efe
Merge branch 'main' into refactor_tooltip_css_style
souissimai 6de23d6
render cell
777c590
fix
4fa7f07
Merge branch 'main' into refactor_tooltip_css_style
souissimai 1c4ca30
Merge branch 'main' into refactor_tooltip_css_style
souissimai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /** | ||
| * Copyright (c) 2025, RTE (http://www.rte-france.com) | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
| */ | ||
|
|
||
| import { EquipmentType } from '@gridsuite/commons-ui'; | ||
| import { Grid } from '@mui/material'; | ||
| import { RunningStatus } from '../utils/running-status'; | ||
| import { renderVoltageLevelCharacteristics } from './generic-equipment-popover-utils'; | ||
| import { CharacteristicsTable } from './carateristics-table'; | ||
| import { CurrentTable } from './current-table'; | ||
| import { LimitsTable } from './limit-table'; | ||
|
|
||
| interface BranchPopoverContentProps { | ||
| equipmentInfos: any; | ||
| loadFlowStatus?: RunningStatus; | ||
| equipmentType?: EquipmentType; | ||
| } | ||
|
|
||
| export const BranchPopoverContent: React.FC<BranchPopoverContentProps> = ({ | ||
| equipmentInfos, | ||
| loadFlowStatus, | ||
| equipmentType, | ||
| }) => { | ||
| return ( | ||
| <Grid container direction="column" rowSpacing={2} alignItems="center"> | ||
| <CharacteristicsTable | ||
| equipmentInfos={equipmentInfos} | ||
| renderVoltageLevelCharacteristics={(equipmentInfos) => | ||
| renderVoltageLevelCharacteristics(equipmentInfos, equipmentType) | ||
| } | ||
| /> | ||
| <CurrentTable equipmentInfos={equipmentInfos} loadFlowStatus={loadFlowStatus} /> | ||
|
|
||
| <LimitsTable equipmentInfos={equipmentInfos} loadFlowStatus={loadFlowStatus} /> | ||
| </Grid> | ||
| ); | ||
| }; | ||
|
|
||
| export default BranchPopoverContent; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| /** | ||
| * Copyright (c) 2025, RTE (http://www.rte-france.com) | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
| */ | ||
|
|
||
| import { EquipmentInfos } from '@gridsuite/commons-ui'; | ||
| import { Table, TableHead, TableRow, TableCell, TableBody, TableContainer, Grid } from '@mui/material'; | ||
| import { renderCommonCharacteristics, styles } from './generic-equipment-popover-utils'; | ||
| import { CellRender } from './cell-render'; | ||
|
|
||
| interface CharacteristicsTableProps { | ||
| equipmentInfos: EquipmentInfos; | ||
| renderVoltageLevelCharacteristics?: (equipmentInfos: EquipmentInfos) => JSX.Element; | ||
| } | ||
|
|
||
| export const CharacteristicsTable: React.FC<CharacteristicsTableProps> = ({ | ||
| equipmentInfos, | ||
| renderVoltageLevelCharacteristics, | ||
| }) => { | ||
| return ( | ||
| <Grid item sx={styles.grid}> | ||
| <TableContainer sx={styles.table}> | ||
| <Table size="small" sx={styles.layout}> | ||
| <TableHead> | ||
| <TableRow> | ||
| <TableCell sx={styles.cell} /> | ||
| <CellRender | ||
| isLabel={true} | ||
| label="characteristic" | ||
| colStyle={{ ...styles.cell, fontWeight: 'bold' }} | ||
| ></CellRender> | ||
| <CellRender | ||
| isLabel={true} | ||
| label="values" | ||
| colStyle={{ ...styles.cell, fontWeight: 'bold' }} | ||
| ></CellRender> | ||
| </TableRow> | ||
| </TableHead> | ||
| <TableBody> | ||
| {renderCommonCharacteristics(equipmentInfos)} | ||
| {renderVoltageLevelCharacteristics?.(equipmentInfos)} | ||
| </TableBody> | ||
| </Table> | ||
| </TableContainer> | ||
| </Grid> | ||
| ); | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /** | ||
| * Copyright (c) 2025, RTE (http://www.rte-france.com) | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
| */ | ||
|
|
||
| import React from 'react'; | ||
| import { TableCell } from '@mui/material'; | ||
| import { useIntl } from 'react-intl'; | ||
|
|
||
| interface CellRenderProps { | ||
| label?: string; | ||
| value?: string | number; | ||
| isLabel: boolean; | ||
| colStyle: React.CSSProperties; | ||
| } | ||
|
|
||
| export const CellRender: React.FC<CellRenderProps> = ({ label, value, isLabel, colStyle }) => { | ||
| const intl = useIntl(); | ||
|
|
||
| const cellLabel = label ? intl.formatMessage({ id: label }) : ''; | ||
|
|
||
| return <TableCell sx={colStyle}>{isLabel ? cellLabel : value}</TableCell>; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| /** | ||
| * Copyright (c) 2025, RTE (http://www.rte-france.com) | ||
| * This Source Code Form is subject to the terms of the Mozilla Public | ||
| * License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
| */ | ||
|
|
||
| import React from 'react'; | ||
souissimai marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| import { Table, TableHead, TableRow, TableCell, TableBody, TableContainer, Grid } from '@mui/material'; | ||
| import { mergeSx } from '@gridsuite/commons-ui'; | ||
| import { RunningStatus } from '../utils/running-status'; | ||
| import { formatValue, styles } from './generic-equipment-popover-utils'; | ||
| import { CellRender } from './cell-render'; | ||
|
|
||
| interface CurrentTableProps { | ||
| equipmentInfos: any; | ||
| loadFlowStatus?: RunningStatus; | ||
| } | ||
|
|
||
| export const CurrentTable: React.FC<CurrentTableProps> = ({ equipmentInfos, loadFlowStatus }) => { | ||
| return ( | ||
| <Grid item sx={styles.grid}> | ||
| <TableContainer sx={styles.table}> | ||
| <Table size="small" sx={styles.layout}> | ||
| <TableHead> | ||
| <TableRow> | ||
| <CellRender | ||
| isLabel={true} | ||
| label="CURRENT" | ||
| colStyle={{ ...styles.cell, fontWeight: 'bold' }} | ||
| ></CellRender> | ||
| <TableCell sx={{ ...styles.cell, fontWeight: 'bold' }}> | ||
| {formatValue(equipmentInfos?.voltageLevelId1)} | ||
| </TableCell> | ||
| <TableCell sx={{ ...styles.cell, fontWeight: 'bold' }}> | ||
| {formatValue(equipmentInfos?.voltageLevelId2)} | ||
| </TableCell> | ||
| </TableRow> | ||
| </TableHead> | ||
| <TableBody> | ||
| <TableRow> | ||
| <CellRender | ||
| isLabel={true} | ||
| label="I_(A)" | ||
| colStyle={{ ...styles.cell, fontWeight: 'bold' }} | ||
| ></CellRender> | ||
| <TableCell | ||
| sx={mergeSx(styles.cell, { | ||
| opacity: loadFlowStatus === RunningStatus.SUCCEED ? 1 : 0.2, | ||
| })} | ||
| > | ||
| {formatValue(Math.round(equipmentInfos?.i1))} | ||
| </TableCell> | ||
| <TableCell | ||
| sx={mergeSx(styles.cell, { | ||
| opacity: loadFlowStatus === RunningStatus.SUCCEED ? 1 : 0.2, | ||
| })} | ||
| > | ||
| {formatValue(Math.round(equipmentInfos?.i2))} | ||
| </TableCell> | ||
| </TableRow> | ||
| </TableBody> | ||
| </Table> | ||
| </TableContainer> | ||
| </Grid> | ||
| ); | ||
| }; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.