Skip to content

Commit 14f17f8

Browse files
committed
fix margin and refacto
Signed-off-by: David BRAQUART <[email protected]>
1 parent 1836614 commit 14f17f8

File tree

1 file changed

+25
-44
lines changed

1 file changed

+25
-44
lines changed

src/pages/profiles/modification/profile-modification-form.tsx

Lines changed: 25 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import { ElementType, IntegerInput, TextInput } from '@gridsuite/commons-ui';
99
import Grid from '@mui/material/Grid';
10-
import ConfigurationSelection from './configuration-selection';
10+
import ConfigurationSelection, { ConfigSelectionProps } from './configuration-selection';
1111
import { FormattedMessage } from 'react-intl';
1212
import React, { FunctionComponent } from 'react';
1313

@@ -23,6 +23,19 @@ export const NETWORK_VISUALIZATION_PARAMETERS_ID = 'networkVisualizationParamete
2323
export const USER_QUOTA_CASE_NB = 'userQuotaCaseNb';
2424
export const USER_QUOTA_BUILD_NB = 'userQuotaBuildNb';
2525

26+
const configList: ConfigSelectionProps[] = [
27+
{ selectionFormId: LOADFLOW_PARAM_ID, elementType: ElementType.LOADFLOW_PARAMETERS },
28+
{ selectionFormId: SECURITY_ANALYSIS_PARAM_ID, elementType: ElementType.SECURITY_ANALYSIS_PARAMETERS },
29+
{ selectionFormId: SENSITIVITY_ANALYSIS_PARAM_ID, elementType: ElementType.SENSITIVITY_PARAMETERS },
30+
{ selectionFormId: SHORTCIRCUIT_PARAM_ID, elementType: ElementType.SHORT_CIRCUIT_PARAMETERS },
31+
{ selectionFormId: VOLTAGE_INIT_PARAM_ID, elementType: ElementType.VOLTAGE_INIT_PARAMETERS },
32+
{ selectionFormId: SPREADSHEET_CONFIG_COLLECTION_ID, elementType: ElementType.SPREADSHEET_CONFIG_COLLECTION },
33+
{
34+
selectionFormId: NETWORK_VISUALIZATION_PARAMETERS_ID,
35+
elementType: ElementType.NETWORK_VISUALIZATIONS_PARAMETERS,
36+
},
37+
];
38+
2639
const ProfileModificationForm: FunctionComponent = () => {
2740
return (
2841
<Grid container spacing={2} marginTop={'auto'}>
@@ -34,54 +47,22 @@ const ProfileModificationForm: FunctionComponent = () => {
3447
<FormattedMessage id={'profiles.form.modification.defaultConfigurations'} />
3548
</h3>
3649
</Grid>
37-
<Grid item xs={12}>
38-
<ConfigurationSelection
39-
elementType={ElementType.LOADFLOW_PARAMETERS}
40-
selectionFormId={LOADFLOW_PARAM_ID}
41-
/>
42-
</Grid>
43-
<Grid item xs={12}>
44-
<ConfigurationSelection
45-
elementType={ElementType.SECURITY_ANALYSIS_PARAMETERS}
46-
selectionFormId={SECURITY_ANALYSIS_PARAM_ID}
47-
/>
48-
</Grid>
49-
<Grid item xs={12}>
50-
<ConfigurationSelection
51-
elementType={ElementType.SENSITIVITY_PARAMETERS}
52-
selectionFormId={SENSITIVITY_ANALYSIS_PARAM_ID}
53-
/>
54-
</Grid>
55-
<Grid item xs={12}>
56-
<ConfigurationSelection
57-
elementType={ElementType.SHORT_CIRCUIT_PARAMETERS}
58-
selectionFormId={SHORTCIRCUIT_PARAM_ID}
59-
/>
60-
</Grid>
61-
<Grid item xs={12}>
62-
<ConfigurationSelection
63-
elementType={ElementType.VOLTAGE_INIT_PARAMETERS}
64-
selectionFormId={VOLTAGE_INIT_PARAM_ID}
65-
/>
66-
</Grid>
67-
<Grid item xs={12}>
68-
<ConfigurationSelection
69-
elementType={ElementType.SPREADSHEET_CONFIG_COLLECTION}
70-
selectionFormId={SPREADSHEET_CONFIG_COLLECTION_ID}
71-
/>
72-
</Grid>
73-
<Grid item xs={12}>
74-
<ConfigurationSelection
75-
elementType={ElementType.NETWORK_VISUALIZATIONS_PARAMETERS}
76-
selectionFormId={NETWORK_VISUALIZATION_PARAMETERS_ID}
77-
/>
78-
</Grid>
50+
{configList.map((config) => {
51+
return (
52+
<Grid item xs={12} key={config.selectionFormId}>
53+
<ConfigurationSelection
54+
elementType={config.elementType}
55+
selectionFormId={config.selectionFormId}
56+
/>
57+
</Grid>
58+
);
59+
})}
7960
<Grid item xs={12}>
8061
<h3>
8162
<FormattedMessage id={'profiles.form.modification.userQuotas'} />
8263
</h3>
8364
</Grid>
84-
<Grid container spacing={2}>
65+
<Grid container spacing={2} direction="row" marginLeft={'auto'}>
8566
<Grid item xs={4}>
8667
<IntegerInput
8768
name={USER_QUOTA_CASE_NB}

0 commit comments

Comments
 (0)