Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/gridsuite/gridstudy-app int…
Browse files Browse the repository at this point in the history
…o disable-sld-display-if-edit-mode
  • Loading branch information
AAJELLAL committed Jul 12, 2024
2 parents b22e009 + 14d2840 commit 6dabdad
Show file tree
Hide file tree
Showing 19 changed files with 137 additions and 126 deletions.
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,11 @@ const BatteryModificationDialog = ({
setDataFetchStatus(FetchStatus.SUCCEED);
})
.catch(() => {
setBatteryToModify(null);
setDataFetchStatus(FetchStatus.FAILED);
reset(emptyFormData);
if (editData?.equipmentId !== equipmentId) {
setBatteryToModify(null);
reset(emptyFormData);
}
});
} else {
setValuesAndEmptyOthers();
Expand All @@ -272,6 +274,7 @@ const BatteryModificationDialog = ({
setValue,
setValuesAndEmptyOthers,
reset,
editData,
]
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ const DeleteEquipmentForm = ({ studyUuid, currentNode, editData }) => {
const { specificUpdate: hvdcLccSpecificUpdate } = useHvdcLccDeletion();
const { setValue } = useFormContext();

const richTypeLabel = (rt) => {
return intl.formatMessage({ id: rt });
const richTypeLabel = (richType) => {
if (richType === EQUIPMENT_TYPES.HVDC_LINE) {
return intl.formatMessage({ id: 'Hvdc' });
} else {
return intl.formatMessage({ id: richType });
}
};

const [equipmentsOptions, setEquipmentsOptions] = useState([]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,11 @@ const GeneratorModificationDialog = ({
setDataFetchStatus(FetchStatus.SUCCEED);
})
.catch(() => {
setGeneratorToModify(null);
reset(emptyFormData);
setDataFetchStatus(FetchStatus.FAILED);
if (editData?.equipmentId !== equipmentId) {
setGeneratorToModify(null);
reset(emptyFormData);
}
});
} else {
setValuesAndEmptyOthers();
Expand All @@ -326,6 +328,7 @@ const GeneratorModificationDialog = ({
getValues,
setValue,
setValuesAndEmptyOthers,
editData,
]
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,11 @@ const LineModificationDialog = ({
setDataFetchStatus(FetchStatus.SUCCEED);
})
.catch(() => {
setLineToModify(null);
setDataFetchStatus(FetchStatus.FAILED);
reset(emptyFormData);
if (editData?.equipmentId !== equipmentId) {
setLineToModify(null);
reset(emptyFormData);
}
});
} else {
setLineToModify(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,19 +177,21 @@ const ShuntCompensatorModificationDialog = ({
setLoading(false);
})
.catch((error) => {
setShuntCompensatorInfos(null);
setDataFetchStatus(FetchStatus.FAILED);
if (error.status === 404) {
setIdExists(true);
}
setLoading(false);
reset(emptyFormData);
if (editData?.equipmentId !== equipmentId) {
setShuntCompensatorInfos(null);
reset(emptyFormData);
}
});
} else {
setShuntCompensatorInfos(null);
}
},
[currentNode.id, snackError, studyUuid, reset, getValues]
[currentNode.id, snackError, studyUuid, reset, getValues, editData]
);

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -760,8 +760,11 @@ const TwoWindingsTransformerModificationDialog = ({
setDataFetchStatus(FetchStatus.SUCCEED);
})
.catch(() => {
setTwtToModify(null);
setDataFetchStatus(FetchStatus.FAILED);
if (editData?.equipmentId !== equipmentId) {
setTwtToModify(null);
reset(emptyFormData);
}
});
} else {
setTwtToModify(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,18 @@ const VoltageLevelModificationDialog = ({
}
})
.catch(() => {
setVoltageLevelInfos(null);
setDataFetchStatus(FetchStatus.FAILED);
reset(emptyFormData);
if (editData?.equipmentId !== equipmentId) {
setVoltageLevelInfos(null);
reset(emptyFormData);
}
});
} else {
setVoltageLevelInfos(null);
reset(emptyFormData, { keepDefaultValues: true });
}
},
[studyUuid, currentNodeUuid, reset, getValues]
[studyUuid, currentNodeUuid, reset, getValues, editData]
);

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,15 @@ const VscModificationDialog: React.FC<any> = ({
);

const onEquipmentIdChange = useCallback(
(equipementId: string | null) => {
if (equipementId) {
(equipmentId: string | null) => {
if (equipmentId) {
setDataFetchStatus(FetchStatus.RUNNING);
fetchNetworkElementInfos(
studyUuid,
currentNodeUuid,
EQUIPMENT_TYPES.HVDC_LINE,
EQUIPMENT_INFOS_TYPES.FORM.type,
equipementId,
equipmentId,
true
)
.then((value: any) => {
Expand Down Expand Up @@ -243,10 +243,12 @@ const VscModificationDialog: React.FC<any> = ({
}));
setDataFetchStatus(FetchStatus.SUCCEED);
})
.catch((_error) => {
.catch(() => {
setDataFetchStatus(FetchStatus.FAILED);
setVcsToModify(null);
reset(emptyFormData);
if (editData?.equipmentId !== equipmentId) {
setVcsToModify(null);
reset(emptyFormData);
}
});
} else {
setValuesAndEmptyOthers();
Expand All @@ -260,6 +262,7 @@ const VscModificationDialog: React.FC<any> = ({
getValues,
reset,
setValuesAndEmptyOthers,
editData,
]
);
useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,9 +427,9 @@ export const SensitivityAnalysisParameters = ({
};
}) ?? [],
};
reset(values);
return values;
},
[reset]
[]
);

const initRowsCount = useCallback(() => {
Expand Down Expand Up @@ -514,6 +514,7 @@ export const SensitivityAnalysisParameters = ({
keepDefaultValues: true,
}
);
initRowsCount();
})
.catch((error) => {
console.error(error);
Expand All @@ -525,13 +526,20 @@ export const SensitivityAnalysisParameters = ({
}
setOpenSelectParameterDialog(false);
},
[snackError, fromSensitivityAnalysisParamsDataToFormValues, reset]
[
snackError,
fromSensitivityAnalysisParamsDataToFormValues,
reset,
initRowsCount,
]
);

useEffect(() => {
if (sensitivityAnalysisParams) {
fromSensitivityAnalysisParamsDataToFormValues(
sensitivityAnalysisParams
reset(
fromSensitivityAnalysisParamsDataToFormValues(
sensitivityAnalysisParams
)
);
!isSubmitAction && initRowsCount();
}
Expand All @@ -540,6 +548,7 @@ export const SensitivityAnalysisParameters = ({
sensitivityAnalysisParams,
initRowsCount,
isSubmitAction,
reset,
]);

const clear = useCallback(() => {
Expand Down
3 changes: 2 additions & 1 deletion src/components/network/use-save-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ export const useSaveMap = (): UseSaveMapOutput => {
distDir,
studyUuid,
currentNodeUuid,
equipments
equipments,
nominalVoltages
);
snackInfo({
messageTxt: intl.formatMessage({
Expand Down
49 changes: 0 additions & 49 deletions src/components/spreadsheet/utils/config-tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,13 +473,6 @@ export const TABLES_DEFINITIONS = {
return params;
},
cellEditor: SitePropertiesEditor,
cellEditorParams: (params) => {
return {
gridApi: params.api,
colDef: params.colDef,
rowData: params.data,
};
},
cellEditorPopup: true,
...defaultTextFilterConfig,
},
Expand Down Expand Up @@ -649,13 +642,6 @@ export const TABLES_DEFINITIONS = {
return params;
},
cellEditor: SitePropertiesEditor,
cellEditorParams: (params) => {
return {
gridApi: params.api,
colDef: params.colDef,
rowData: params.data,
};
},
cellEditorPopup: true,
...defaultTextFilterConfig,
},
Expand Down Expand Up @@ -1571,13 +1557,6 @@ export const TABLES_DEFINITIONS = {
return params;
},
cellEditor: SitePropertiesEditor,
cellEditorParams: (params) => {
return {
gridApi: params.api,
colDef: params.colDef,
rowData: params.data,
};
},
cellEditorPopup: true,
...defaultTextFilterConfig,
},
Expand Down Expand Up @@ -2649,13 +2628,6 @@ export const TABLES_DEFINITIONS = {
return params;
},
cellEditor: SitePropertiesEditor,
cellEditorParams: (params) => {
return {
gridApi: params.api,
colDef: params.colDef,
rowData: params.data,
};
},
cellEditorPopup: true,
...defaultTextFilterConfig,
},
Expand Down Expand Up @@ -2800,13 +2772,6 @@ export const TABLES_DEFINITIONS = {
return params;
},
cellEditor: SitePropertiesEditor,
cellEditorParams: (params) => {
return {
gridApi: params.api,
colDef: params.colDef,
rowData: params.data,
};
},
cellEditorPopup: true,
...defaultTextFilterConfig,
},
Expand Down Expand Up @@ -3021,13 +2986,6 @@ export const TABLES_DEFINITIONS = {
return params;
},
cellEditor: SitePropertiesEditor,
cellEditorParams: (params) => {
return {
gridApi: params.api,
colDef: params.colDef,
rowData: params.data,
};
},
cellEditorPopup: true,
...defaultTextFilterConfig,
},
Expand Down Expand Up @@ -3367,13 +3325,6 @@ export const TABLES_DEFINITIONS = {
return params;
},
cellEditor: SitePropertiesEditor,
cellEditorParams: (params) => {
return {
gridApi: params.api,
colDef: params.colDef,
rowData: params.data,
};
},
cellEditorPopup: true,
...defaultTextFilterConfig,
},
Expand Down
Loading

0 comments on commit 6dabdad

Please sign in to comment.