Skip to content

Commit 534cc83

Browse files
associate nad to user profile (#128)
Co-authored-by: dbraquart <[email protected]>
1 parent c68b918 commit 534cc83

File tree

6 files changed

+13
-1
lines changed

6 files changed

+13
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export interface ConfigSelectionProps {
2323
| ElementType.SHORT_CIRCUIT_PARAMETERS
2424
| ElementType.VOLTAGE_INIT_PARAMETERS
2525
| ElementType.SPREADSHEET_CONFIG_COLLECTION
26-
| ElementType.NETWORK_VISUALIZATIONS_PARAMETERS;
26+
| ElementType.NETWORK_VISUALIZATIONS_PARAMETERS
27+
| ElementType.DIAGRAM_CONFIG;
2728
selectionFormId: string;
2829
}
2930

@@ -88,6 +89,8 @@ const ConfigurationSelection: FunctionComponent<ConfigSelectionProps> = (props)
8889
return 'profiles.form.modification.spreadsheetConfigCollection.name';
8990
case ElementType.NETWORK_VISUALIZATIONS_PARAMETERS:
9091
return 'profiles.form.modification.networkVisualizations.name';
92+
case ElementType.DIAGRAM_CONFIG:
93+
return 'profiles.form.modification.diagramConfig.name';
9194
}
9295
};
9396

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import ProfileModificationForm, {
1616
USER_QUOTA_BUILD_NB,
1717
USER_QUOTA_CASE_NB,
1818
NETWORK_VISUALIZATION_PARAMETERS_ID,
19+
DIAGRAM_CONFIG_ID,
1920
} from './profile-modification-form';
2021
import { yupResolver } from '@hookform/resolvers/yup';
2122
import { useForm } from 'react-hook-form';
@@ -53,6 +54,7 @@ const ProfileModificationDialog: FunctionComponent<ProfileModificationDialogProp
5354
[USER_QUOTA_BUILD_NB]: yup.number().positive('userQuotaPositive').nullable(),
5455
[SPREADSHEET_CONFIG_COLLECTION_ID]: yup.string().optional(),
5556
[NETWORK_VISUALIZATION_PARAMETERS_ID]: yup.string().optional(),
57+
[DIAGRAM_CONFIG_ID]: yup.string().optional(),
5658
})
5759
.required();
5860

@@ -77,6 +79,7 @@ const ProfileModificationDialog: FunctionComponent<ProfileModificationDialogProp
7779
maxAllowedBuilds: profileFormData[USER_QUOTA_BUILD_NB],
7880
spreadsheetConfigCollectionId: profileFormData[SPREADSHEET_CONFIG_COLLECTION_ID],
7981
networkVisualizationParameterId: profileFormData[NETWORK_VISUALIZATION_PARAMETERS_ID],
82+
diagramConfigId: profileFormData[DIAGRAM_CONFIG_ID],
8083
};
8184
UserAdminSrv.modifyProfile(profileData)
8285
.catch((error) => {
@@ -115,6 +118,7 @@ const ProfileModificationDialog: FunctionComponent<ProfileModificationDialogProp
115118
[USER_QUOTA_BUILD_NB]: response.maxAllowedBuilds,
116119
[SPREADSHEET_CONFIG_COLLECTION_ID]: response.spreadsheetConfigCollectionId ?? undefined,
117120
[NETWORK_VISUALIZATION_PARAMETERS_ID]: response.networkVisualizationParameterId ?? undefined,
121+
[DIAGRAM_CONFIG_ID]: response.diagramConfigId ?? undefined,
118122
});
119123
})
120124
.catch((error) => {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const SHORTCIRCUIT_PARAM_ID = 'shortcircuitParamId';
1919
export const VOLTAGE_INIT_PARAM_ID = 'voltageInitParamId';
2020
export const SPREADSHEET_CONFIG_COLLECTION_ID = 'spreadsheetConfigCollectionId';
2121
export const NETWORK_VISUALIZATION_PARAMETERS_ID = 'networkVisualizationParametersId';
22+
export const DIAGRAM_CONFIG_ID = 'diagramConfigId';
2223

2324
export const USER_QUOTA_CASE_NB = 'userQuotaCaseNb';
2425
export const USER_QUOTA_BUILD_NB = 'userQuotaBuildNb';
@@ -34,6 +35,7 @@ const configList: ConfigSelectionProps[] = [
3435
selectionFormId: NETWORK_VISUALIZATION_PARAMETERS_ID,
3536
elementType: ElementType.NETWORK_VISUALIZATIONS_PARAMETERS,
3637
},
38+
{ selectionFormId: DIAGRAM_CONFIG_ID, elementType: ElementType.DIAGRAM_CONFIG },
3739
];
3840

3941
const ProfileModificationForm: FunctionComponent = () => {

src/services/user-admin.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ export type UserProfile = {
9292
maxAllowedBuilds?: number;
9393
spreadsheetConfigCollectionId?: UUID;
9494
networkVisualizationParameterId?: UUID;
95+
diagramConfigId?: UUID;
9596
};
9697

9798
export function fetchProfiles(): Promise<UserProfile[]> {

src/translations/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
"profiles.form.modification.voltageInit.name": "Voltage init",
8989
"profiles.form.modification.spreadsheetConfigCollection.name": "Spreadsheet model collection",
9090
"profiles.form.modification.networkVisualizations.name": "Network visualizations",
91+
"profiles.form.modification.diagramConfig.name": "Home NAD image",
9192
"profiles.form.modification.readError": "Error while reading the profile",
9293
"profiles.form.modification.updateError": "Error while updating the profile",
9394

src/translations/fr.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
"profiles.form.modification.voltageInit.name": "Initialisation du plan de tension",
9090
"profiles.form.modification.spreadsheetConfigCollection.name": "Modèles de tableur",
9191
"profiles.form.modification.networkVisualizations.name": "Images réseau",
92+
"profiles.form.modification.diagramConfig.name": "Image nodale d'accueil",
9293
"profiles.form.modification.readError": "Erreur lors de la lecture du profil",
9394
"profiles.form.modification.updateError": "Erreur lors de la modification du profil",
9495

0 commit comments

Comments
 (0)