@@ -21,18 +21,10 @@ import yup from '../../../utils/yup-config';
21
21
import { yupResolver } from '@hookform/resolvers/yup' ;
22
22
import { useForm } from 'react-hook-form' ;
23
23
import { FunctionComponent , useCallback , useEffect , useMemo , useState } from 'react' ;
24
- import { CustomMuiDialog , useSnackMessage } from '@gridsuite/commons-ui' ;
24
+ import { CustomMuiDialog , FetchStatus , useSnackMessage } from '@gridsuite/commons-ui' ;
25
25
import { UserAdminSrv , UserProfile } from '../../../services' ;
26
26
import { UUID } from 'crypto' ;
27
27
28
- // TODO remove FetchStatus when exported in commons-ui (available soon)
29
- enum FetchStatus {
30
- IDLE = 'IDLE' ,
31
- FETCHING = 'FETCHING' ,
32
- FETCH_SUCCESS = 'FETCH_SUCCESS' ,
33
- FETCH_ERROR = 'FETCH_ERROR' ,
34
- }
35
-
36
28
export interface ProfileModificationDialogProps {
37
29
profileId : UUID | undefined ;
38
30
open : boolean ;
@@ -47,7 +39,7 @@ const ProfileModificationDialog: FunctionComponent<ProfileModificationDialogProp
47
39
onUpdate,
48
40
} ) => {
49
41
const { snackError } = useSnackMessage ( ) ;
50
- const [ dataFetchStatus , setDataFetchStatus ] = useState < FetchStatus > ( FetchStatus . IDLE ) ;
42
+ const [ dataFetchStatus , setDataFetchStatus ] = useState < string > ( FetchStatus . IDLE ) ;
51
43
52
44
const formSchema = yup
53
45
. object ( )
@@ -115,27 +107,15 @@ const ProfileModificationDialog: FunctionComponent<ProfileModificationDialogProp
115
107
setDataFetchStatus ( FetchStatus . FETCH_SUCCESS ) ;
116
108
reset ( {
117
109
[ PROFILE_NAME ] : response . name ,
118
- [ LOADFLOW_PARAM_ID ] : response . loadFlowParameterId ? response . loadFlowParameterId : undefined ,
119
- [ SECURITY_ANALYSIS_PARAM_ID ] : response . securityAnalysisParameterId
120
- ? response . securityAnalysisParameterId
121
- : undefined ,
122
- [ SENSITIVITY_ANALYSIS_PARAM_ID ] : response . sensitivityAnalysisParameterId
123
- ? response . sensitivityAnalysisParameterId
124
- : undefined ,
125
- [ SHORTCIRCUIT_PARAM_ID ] : response . shortcircuitParameterId
126
- ? response . shortcircuitParameterId
127
- : undefined ,
128
- [ VOLTAGE_INIT_PARAM_ID ] : response . voltageInitParameterId
129
- ? response . voltageInitParameterId
130
- : undefined ,
110
+ [ LOADFLOW_PARAM_ID ] : response . loadFlowParameterId ?? undefined ,
111
+ [ SECURITY_ANALYSIS_PARAM_ID ] : response . securityAnalysisParameterId ?? undefined ,
112
+ [ SENSITIVITY_ANALYSIS_PARAM_ID ] : response . sensitivityAnalysisParameterId ?? undefined ,
113
+ [ SHORTCIRCUIT_PARAM_ID ] : response . shortcircuitParameterId ?? undefined ,
114
+ [ VOLTAGE_INIT_PARAM_ID ] : response . voltageInitParameterId ?? undefined ,
131
115
[ USER_QUOTA_CASE_NB ] : response . maxAllowedCases ,
132
116
[ USER_QUOTA_BUILD_NB ] : response . maxAllowedBuilds ,
133
- [ SPREADSHEET_CONFIG_COLLECTION_ID ] : response . spreadsheetConfigCollectionId
134
- ? response . spreadsheetConfigCollectionId
135
- : undefined ,
136
- [ NETWORK_VISUALIZATION_PARAMETERS_ID ] : response . networkVisualizationParameterId
137
- ? response . networkVisualizationParameterId
138
- : undefined ,
117
+ [ SPREADSHEET_CONFIG_COLLECTION_ID ] : response . spreadsheetConfigCollectionId ?? undefined ,
118
+ [ NETWORK_VISUALIZATION_PARAMETERS_ID ] : response . networkVisualizationParameterId ?? undefined ,
139
119
} ) ;
140
120
} )
141
121
. catch ( ( error ) => {
0 commit comments