Skip to content

Commit 158aff4

Browse files
Associate default model parameters (for security analysis, sensitivity analysis, short circuit, voltage init) with a user profile (#59)
* Associate default model parameters (for security analysis, sensitivity analysis, short circuit, voltage init) with a user profile. Signed-off-by: Franck LECUYER <[email protected]>
1 parent b464968 commit 158aff4

File tree

6 files changed

+80
-6
lines changed

6 files changed

+80
-6
lines changed

src/pages/profiles/modification/parameter-selection.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export interface ParameterSelectionProps {
2020
| ElementType.LOADFLOW_PARAMETERS
2121
| ElementType.SECURITY_ANALYSIS_PARAMETERS
2222
| ElementType.SENSITIVITY_PARAMETERS
23+
| ElementType.SHORT_CIRCUIT_PARAMETERS
2324
| ElementType.VOLTAGE_INIT_PARAMETERS;
2425
parameterFormId: string;
2526
}
@@ -78,6 +79,14 @@ const ParameterSelection: FunctionComponent<ParameterSelectionProps> = (props) =
7879
switch (props.elementType) {
7980
case ElementType.LOADFLOW_PARAMETERS:
8081
return 'profiles.form.modification.loadflow.name';
82+
case ElementType.SECURITY_ANALYSIS_PARAMETERS:
83+
return 'profiles.form.modification.securityAnalysis.name';
84+
case ElementType.SENSITIVITY_PARAMETERS:
85+
return 'profiles.form.modification.sensitivityAnalysis.name';
86+
case ElementType.SHORT_CIRCUIT_PARAMETERS:
87+
return 'profiles.form.modification.shortcircuit.name';
88+
case ElementType.VOLTAGE_INIT_PARAMETERS:
89+
return 'profiles.form.modification.voltageInit.name';
8190
}
8291
return 'cannot happen';
8392
};

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

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
*/
77

88
import ProfileModificationForm, {
9-
LF_PARAM_ID,
9+
LOADFLOW_PARAM_ID,
10+
SECURITY_ANALYSIS_PARAM_ID,
11+
SENSITIVITY_ANALYSIS_PARAM_ID,
12+
SHORTCIRCUIT_PARAM_ID,
13+
VOLTAGE_INIT_PARAM_ID,
1014
PROFILE_NAME,
1115
USER_QUOTA_BUILD_NB,
1216
USER_QUOTA_CASE_NB,
@@ -47,7 +51,11 @@ const ProfileModificationDialog: FunctionComponent<ProfileModificationDialogProp
4751
.object()
4852
.shape({
4953
[PROFILE_NAME]: yup.string().trim().required('nameEmpty'),
50-
[LF_PARAM_ID]: yup.string().optional(),
54+
[LOADFLOW_PARAM_ID]: yup.string().optional(),
55+
[SECURITY_ANALYSIS_PARAM_ID]: yup.string().optional(),
56+
[SENSITIVITY_ANALYSIS_PARAM_ID]: yup.string().optional(),
57+
[SHORTCIRCUIT_PARAM_ID]: yup.string().optional(),
58+
[VOLTAGE_INIT_PARAM_ID]: yup.string().optional(),
5159
[USER_QUOTA_CASE_NB]: yup.number().positive('userQuotaPositive').nullable(),
5260
[USER_QUOTA_BUILD_NB]: yup.number().positive('userQuotaPositive').nullable(),
5361
})
@@ -65,7 +73,11 @@ const ProfileModificationDialog: FunctionComponent<ProfileModificationDialogProp
6573
const profileData: UserProfile = {
6674
id: profileId,
6775
name: profileFormData[PROFILE_NAME],
68-
loadFlowParameterId: profileFormData[LF_PARAM_ID],
76+
loadFlowParameterId: profileFormData[LOADFLOW_PARAM_ID],
77+
securityAnalysisParameterId: profileFormData[SECURITY_ANALYSIS_PARAM_ID],
78+
sensitivityAnalysisParameterId: profileFormData[SENSITIVITY_ANALYSIS_PARAM_ID],
79+
shortcircuitParameterId: profileFormData[SHORTCIRCUIT_PARAM_ID],
80+
voltageInitParameterId: profileFormData[VOLTAGE_INIT_PARAM_ID],
6981
maxAllowedCases: profileFormData[USER_QUOTA_CASE_NB],
7082
maxAllowedBuilds: profileFormData[USER_QUOTA_BUILD_NB],
7183
};
@@ -97,7 +109,19 @@ const ProfileModificationDialog: FunctionComponent<ProfileModificationDialogProp
97109
setDataFetchStatus(FetchStatus.FETCH_SUCCESS);
98110
reset({
99111
[PROFILE_NAME]: response.name,
100-
[LF_PARAM_ID]: response.loadFlowParameterId ? response.loadFlowParameterId : undefined,
112+
[LOADFLOW_PARAM_ID]: response.loadFlowParameterId ? response.loadFlowParameterId : undefined,
113+
[SECURITY_ANALYSIS_PARAM_ID]: response.securityAnalysisParameterId
114+
? response.securityAnalysisParameterId
115+
: undefined,
116+
[SENSITIVITY_ANALYSIS_PARAM_ID]: response.sensitivityAnalysisParameterId
117+
? response.sensitivityAnalysisParameterId
118+
: undefined,
119+
[SHORTCIRCUIT_PARAM_ID]: response.shortcircuitParameterId
120+
? response.shortcircuitParameterId
121+
: undefined,
122+
[VOLTAGE_INIT_PARAM_ID]: response.voltageInitParameterId
123+
? response.voltageInitParameterId
124+
: undefined,
101125
[USER_QUOTA_CASE_NB]: response.maxAllowedCases,
102126
[USER_QUOTA_BUILD_NB]: response.maxAllowedBuilds,
103127
});

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

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ import { FormattedMessage } from 'react-intl';
1212
import React, { FunctionComponent } from 'react';
1313

1414
export const PROFILE_NAME = 'name';
15-
export const LF_PARAM_ID = 'lfParamId';
15+
export const LOADFLOW_PARAM_ID = 'loadFlowParamId';
16+
export const SECURITY_ANALYSIS_PARAM_ID = 'securityAnalysisParamId';
17+
export const SENSITIVITY_ANALYSIS_PARAM_ID = 'sensitivityAnalysisParamId';
18+
export const SHORTCIRCUIT_PARAM_ID = 'shortcircuitParamId';
19+
export const VOLTAGE_INIT_PARAM_ID = 'voltageInitParamId';
20+
1621
export const USER_QUOTA_CASE_NB = 'userQuotaCaseNb';
1722
export const USER_QUOTA_BUILD_NB = 'userQuotaBuildNb';
1823

@@ -28,7 +33,31 @@ const ProfileModificationForm: FunctionComponent = () => {
2833
</h3>
2934
</Grid>
3035
<Grid item xs={12}>
31-
<ParameterSelection elementType={ElementType.LOADFLOW_PARAMETERS} parameterFormId={LF_PARAM_ID} />
36+
<ParameterSelection elementType={ElementType.LOADFLOW_PARAMETERS} parameterFormId={LOADFLOW_PARAM_ID} />
37+
</Grid>
38+
<Grid item xs={12}>
39+
<ParameterSelection
40+
elementType={ElementType.SECURITY_ANALYSIS_PARAMETERS}
41+
parameterFormId={SECURITY_ANALYSIS_PARAM_ID}
42+
/>
43+
</Grid>
44+
<Grid item xs={12}>
45+
<ParameterSelection
46+
elementType={ElementType.SENSITIVITY_PARAMETERS}
47+
parameterFormId={SENSITIVITY_ANALYSIS_PARAM_ID}
48+
/>
49+
</Grid>
50+
<Grid item xs={12}>
51+
<ParameterSelection
52+
elementType={ElementType.SHORT_CIRCUIT_PARAMETERS}
53+
parameterFormId={SHORTCIRCUIT_PARAM_ID}
54+
/>
55+
</Grid>
56+
<Grid item xs={12}>
57+
<ParameterSelection
58+
elementType={ElementType.VOLTAGE_INIT_PARAMETERS}
59+
parameterFormId={VOLTAGE_INIT_PARAM_ID}
60+
/>
3261
</Grid>
3362
<Grid item xs={12}>
3463
<h3>

src/services/user-admin.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ export type UserProfile = {
107107
name: string;
108108
allParametersLinksValid?: boolean;
109109
loadFlowParameterId?: UUID;
110+
securityAnalysisParameterId?: UUID;
111+
sensitivityAnalysisParameterId?: UUID;
112+
shortcircuitParameterId?: UUID;
113+
voltageInitParameterId?: UUID;
110114
maxAllowedCases?: number;
111115
maxAllowedBuilds?: number;
112116
};

src/translations/en.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@
7474
"profiles.form.modification.parameterSelection.dialog.title": "Choose parameters",
7575
"profiles.form.modification.parameterSelection.dialog.message": "Please choose parameters",
7676
"profiles.form.modification.loadflow.name": "Loadflow",
77+
"profiles.form.modification.securityAnalysis.name": "Security analysis",
78+
"profiles.form.modification.sensitivityAnalysis.name": "Sensitivity analysis",
79+
"profiles.form.modification.shortcircuit.name": "Short-circuit",
80+
"profiles.form.modification.voltageInit.name": "Voltage init",
7781
"profiles.form.modification.readError": "Error while reading the profile",
7882
"profiles.form.modification.updateError": "Error while updating the profile",
7983

src/translations/fr.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@
7575
"profiles.form.modification.parameterSelection.dialog.title": "Choisir des paramètres",
7676
"profiles.form.modification.parameterSelection.dialog.message": "Veuillez choisir des paramètres",
7777
"profiles.form.modification.loadflow.name": "Calcul de répartition",
78+
"profiles.form.modification.securityAnalysis.name": "Analyse de sécurité",
79+
"profiles.form.modification.sensitivityAnalysis.name": "Analyse de sensibilités",
80+
"profiles.form.modification.shortcircuit.name": "Calcul de court-circuit",
81+
"profiles.form.modification.voltageInit.name": "Initialisation du plan de tension",
7882
"profiles.form.modification.readError": "Erreur lors de la lecture du profil",
7983
"profiles.form.modification.updateError": "Erreur lors de la modification du profil",
8084

0 commit comments

Comments
 (0)