Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/pages/profiles/modification/configuration-selection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export interface ConfigSelectionProps {
| ElementType.SHORT_CIRCUIT_PARAMETERS
| ElementType.VOLTAGE_INIT_PARAMETERS
| ElementType.SPREADSHEET_CONFIG_COLLECTION
| ElementType.NETWORK_VISUALIZATIONS_PARAMETERS;
| ElementType.NETWORK_VISUALIZATIONS_PARAMETERS
| ElementType.DIAGRAM_CONFIG;
selectionFormId: string;
}

Expand Down Expand Up @@ -88,6 +89,8 @@ const ConfigurationSelection: FunctionComponent<ConfigSelectionProps> = (props)
return 'profiles.form.modification.spreadsheetConfigCollection.name';
case ElementType.NETWORK_VISUALIZATIONS_PARAMETERS:
return 'profiles.form.modification.networkVisualizations.name';
case ElementType.DIAGRAM_CONFIG:
return 'profiles.form.modification.diagramConfig.name';
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import ProfileModificationForm, {
USER_QUOTA_BUILD_NB,
USER_QUOTA_CASE_NB,
NETWORK_VISUALIZATION_PARAMETERS_ID,
DIAGRAM_CONFIG_ID,
} from './profile-modification-form';
import { yupResolver } from '@hookform/resolvers/yup';
import { useForm } from 'react-hook-form';
Expand Down Expand Up @@ -53,6 +54,7 @@ const ProfileModificationDialog: FunctionComponent<ProfileModificationDialogProp
[USER_QUOTA_BUILD_NB]: yup.number().positive('userQuotaPositive').nullable(),
[SPREADSHEET_CONFIG_COLLECTION_ID]: yup.string().optional(),
[NETWORK_VISUALIZATION_PARAMETERS_ID]: yup.string().optional(),
[DIAGRAM_CONFIG_ID]: yup.string().optional(),
})
.required();

Expand All @@ -77,6 +79,7 @@ const ProfileModificationDialog: FunctionComponent<ProfileModificationDialogProp
maxAllowedBuilds: profileFormData[USER_QUOTA_BUILD_NB],
spreadsheetConfigCollectionId: profileFormData[SPREADSHEET_CONFIG_COLLECTION_ID],
networkVisualizationParameterId: profileFormData[NETWORK_VISUALIZATION_PARAMETERS_ID],
diagramConfigId: profileFormData[DIAGRAM_CONFIG_ID],
};
UserAdminSrv.modifyProfile(profileData)
.catch((error) => {
Expand Down Expand Up @@ -115,6 +118,7 @@ const ProfileModificationDialog: FunctionComponent<ProfileModificationDialogProp
[USER_QUOTA_BUILD_NB]: response.maxAllowedBuilds,
[SPREADSHEET_CONFIG_COLLECTION_ID]: response.spreadsheetConfigCollectionId ?? undefined,
[NETWORK_VISUALIZATION_PARAMETERS_ID]: response.networkVisualizationParameterId ?? undefined,
[DIAGRAM_CONFIG_ID]: response.diagramConfigId ?? undefined,
});
})
.catch((error) => {
Expand Down
2 changes: 2 additions & 0 deletions src/pages/profiles/modification/profile-modification-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const SHORTCIRCUIT_PARAM_ID = 'shortcircuitParamId';
export const VOLTAGE_INIT_PARAM_ID = 'voltageInitParamId';
export const SPREADSHEET_CONFIG_COLLECTION_ID = 'spreadsheetConfigCollectionId';
export const NETWORK_VISUALIZATION_PARAMETERS_ID = 'networkVisualizationParametersId';
export const DIAGRAM_CONFIG_ID = 'diagramConfigId';

export const USER_QUOTA_CASE_NB = 'userQuotaCaseNb';
export const USER_QUOTA_BUILD_NB = 'userQuotaBuildNb';
Expand All @@ -34,6 +35,7 @@ const configList: ConfigSelectionProps[] = [
selectionFormId: NETWORK_VISUALIZATION_PARAMETERS_ID,
elementType: ElementType.NETWORK_VISUALIZATIONS_PARAMETERS,
},
{ selectionFormId: DIAGRAM_CONFIG_ID, elementType: ElementType.DIAGRAM_CONFIG },
];

const ProfileModificationForm: FunctionComponent = () => {
Expand Down
1 change: 1 addition & 0 deletions src/services/user-admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export type UserProfile = {
maxAllowedBuilds?: number;
spreadsheetConfigCollectionId?: UUID;
networkVisualizationParameterId?: UUID;
diagramConfigId?: UUID;
};

export function fetchProfiles(): Promise<UserProfile[]> {
Expand Down
1 change: 1 addition & 0 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"profiles.form.modification.voltageInit.name": "Voltage init",
"profiles.form.modification.spreadsheetConfigCollection.name": "Spreadsheet model collection",
"profiles.form.modification.networkVisualizations.name": "Network visualizations",
"profiles.form.modification.diagramConfig.name": "Home NAD image",
"profiles.form.modification.readError": "Error while reading the profile",
"profiles.form.modification.updateError": "Error while updating the profile",

Expand Down
1 change: 1 addition & 0 deletions src/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"profiles.form.modification.voltageInit.name": "Initialisation du plan de tension",
"profiles.form.modification.spreadsheetConfigCollection.name": "Modèles de tableur",
"profiles.form.modification.networkVisualizations.name": "Images réseau",
"profiles.form.modification.diagramConfig.name": "Image nodale d'accueil",
"profiles.form.modification.readError": "Erreur lors de la lecture du profil",
"profiles.form.modification.updateError": "Erreur lors de la modification du profil",

Expand Down
Loading