Skip to content

Commit

Permalink
Show extensions in list for import and export cases (#304)
Browse files Browse the repository at this point in the history
Co-authored-by: GhassenEll <[email protected]>
Co-authored-by: Sylvain Bouzols <[email protected]>
  • Loading branch information
3 people authored Oct 3, 2023
1 parent 7a8eb28 commit 5ec1086
Show file tree
Hide file tree
Showing 2 changed files with 148 additions and 58 deletions.
98 changes: 98 additions & 0 deletions demo/src/FlatParametersTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,101 @@ const EXAMPLE_PARAMETERS = [
defaultValue: ['EQ', 'TP', 'SSH', 'SV'],
possibleValues: ['EQ', 'TP', 'SSH', 'SV'],
},
{
name: 'iidm.export.xml.extensions',
type: 'STRING_LIST',
description: 'The list of exported extensions',
defaultValue: [
'generatorShortCircuit',
'identifiableShortCircuit',
'slackTerminal',
'entsoeArea',
'coordinatedReactiveControl',
'linePosition',
'baseVoltageMapping',
'voltagePerReactivePowerControl',
'substationPosition',
'cgmesControlAreas',
'loadAsymmetrical',
'cgmesTapChangers',
'branchObservability',
'generatorFortescue',
'startup',
'branchStatus',
'cgmesDanglingLineBoundaryNode',
'cgmesLineBoundaryNode',
'busbarSectionPosition',
'threeWindingsTransformerToBeEstimated',
'injectionObservability',
'cgmesSvMetadata',
'measurements',
'twoWindingsTransformerPhaseAngleClock',
'generatorShortCircuits',
'entsoeCategory',
'hvdcOperatorActivePowerRange',
'twoWindingsTransformerFortescue',
'hvdcAngleDroopActivePowerControl',
'standbyAutomaton',
'voltageLevelShortCircuits',
'twoWindingsTransformerToBeEstimated',
'generatorActivePowerControl',
'discreteMeasurements',
'secondaryVoltageControl',
'cimCharacteristics',
'cgmesSshMetadata',
'position',
'detail',
'threeWindingsTransformerPhaseAngleClock',
'lineFortescue',
'activePowerControl',
'threeWindingsTransformerFortescue',
],
possibleValues: [
'generatorShortCircuit',
'identifiableShortCircuit',
'slackTerminal',
'entsoeArea',
'coordinatedReactiveControl',
'linePosition',
'baseVoltageMapping',
'voltagePerReactivePowerControl',
'substationPosition',
'cgmesControlAreas',
'loadAsymmetrical',
'cgmesTapChangers',
'branchObservability',
'generatorFortescue',
'startup',
'branchStatus',
'cgmesDanglingLineBoundaryNode',
'cgmesLineBoundaryNode',
'busbarSectionPosition',
'threeWindingsTransformerToBeEstimated',
'injectionObservability',
'cgmesSvMetadata',
'measurements',
'twoWindingsTransformerPhaseAngleClock',
'generatorShortCircuits',
'entsoeCategory',
'hvdcOperatorActivePowerRange',
'twoWindingsTransformerFortescue',
'hvdcAngleDroopActivePowerControl',
'standbyAutomaton',
'voltageLevelShortCircuits',
'twoWindingsTransformerToBeEstimated',
'generatorActivePowerControl',
'discreteMeasurements',
'secondaryVoltageControl',
'cimCharacteristics',
'cgmesSshMetadata',
'position',
'detail',
'threeWindingsTransformerPhaseAngleClock',
'lineFortescue',
'activePowerControl',
'threeWindingsTransformerFortescue',
],
},
];

export const FlatParametersTab = () => {
Expand All @@ -124,6 +219,9 @@ export const FlatParametersTab = () => {
onChange={onChange}
variant={'standard'}
showSeparator
selectionWithDialog={(param) =>
param?.possibleValues?.length > 10
}
/>
</RightResizableBox>
</div>
Expand Down
108 changes: 50 additions & 58 deletions src/components/MultipleSelectionDialog/MultipleSelectionDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { Dialog, DialogContent, Divider } from '@mui/material';
import { Dialog, DialogContent, List } from '@mui/material';
import DialogTitle from '@mui/material/DialogTitle';
import { FormattedMessage } from 'react-intl';
import FormControlLabel from '@mui/material/FormControlLabel';
Expand Down Expand Up @@ -43,68 +43,60 @@ const MultipleSelectionDialog = ({
};

return (
<Dialog open={open} fullWidth maxWidth={'lg'}>
<Dialog open={open}>
<DialogTitle>{titleId}</DialogTitle>
<DialogContent>
<Grid container spacing={2}>
<Grid item xs={12}>
<Divider>
<FormControlLabel
label={
<FormattedMessage
id={
'multiple_selection_dialog/selectAll'
}
/>
}
control={
<Checkbox
checked={
selectedIds.length ===
options.length
}
indeterminate={
selectedIds.length &&
selectedIds.length !==
options.length
}
onChange={handleSelectAll}
/>
}
/>
</Divider>
<Grid container spacing={2} flexDirection="column">
<Grid item>
<FormControlLabel
label={
<FormattedMessage
id={'multiple_selection_dialog/selectAll'}
/>
}
control={
<Checkbox
checked={
selectedIds.length === options.length
}
indeterminate={
!!selectedIds.length &&
selectedIds.length !== options.length
}
onChange={handleSelectAll}
/>
}
/>
</Grid>
{options.map((option, index) => {
const optionId = option?.id ?? option;
const label = getOptionLabel(option);
return (
<React.Fragment key={optionId}>
<Grid item xs={4}>
<FormControlLabel
label={label}
control={
<Checkbox
checked={selectedIds.includes(
optionId
)}
onChange={() =>
handleOptionSelection(
optionId
)
<Grid item>
<List>
{options.map((option) => {
const optionId = option?.id ?? option;
const label = getOptionLabel(option);
return (
<React.Fragment key={optionId}>
<Grid item>
<FormControlLabel
label={label}
control={
<Checkbox
checked={selectedIds.includes(
optionId
)}
onChange={() =>
handleOptionSelection(
optionId
)
}
/>
}
/>
}
/>
</Grid>
{/*All rows contain 3 options, and we add divider after each row*/}
{(index + 1) % 3 === 0 && (
<Grid item xs={12} key={index}>
<Divider />
</Grid>
)}
</React.Fragment>
);
})}
</Grid>
</React.Fragment>
);
})}
</List>
</Grid>
</Grid>
</DialogContent>
<DialogActions>
Expand Down

0 comments on commit 5ec1086

Please sign in to comment.