Skip to content

Moving the byFilterDeletion form gridstudy to commons-ui#3809

Open
benrejebmoh wants to merge 2 commits intomainfrom
modif-delete-by-filter
Open

Moving the byFilterDeletion form gridstudy to commons-ui#3809
benrejebmoh wants to merge 2 commits intomainfrom
modif-delete-by-filter

Conversation

@benrejebmoh
Copy link
Contributor

PR Summary

Extracting byFilterDeletion to commons-ui for common usage with other front apps

Copy link
Contributor

@dbraquart dbraquart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code: little change requests
tests: sounds good

Comment on lines 81 to 86
deleteEquipmentByFilter(
studyUuid,
currentNodeUuid,
formData[TYPE],
formData[FILTERS],
formData[FieldConstants.TYPE],
formData[FieldConstants.FILTERS],
editData?.uuid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should use:

const dto = byFilterDeletionFormToDto(form);
deleteEquipmentByFilter(studyUuid, currentNodeUuid, editData?.uuid, dto)

ex: #3815

[TYPE]: null,
[FILTERS]: [],
type ByFilterDeletionDialogProps = NetworkModificationDialogProps & {
editData: ByFilterDeletionDto;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
editData: ByFilterDeletionDto;
editData?: ByFilterDeletionDto & { uuid: UUID };

editData is optional (cf creation mode). and you can add uuid here (if you remove it from the DTO).

.min(1, 'FieldIsRequired'),
})
.required();
const emptyFormData: ByFilterDeletionFormData = {
Copy link
Contributor

@dbraquart dbraquart Mar 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const emptyFormData: ByFilterDeletionFormData = {
const emptyFormData: DeepNullable<ByFilterDeletionFormData> = {

And we put it in commons-ui too

@@ -69,17 +58,14 @@ const ByFilterDeletionDialog: FunctionComponent<ByFilterDeletionDialogProps> = (

const formMethods = useForm<ByFilterDeletionFormData>({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const formMethods = useForm<ByFilterDeletionFormData>({
const formMethods = useForm<DeepNullable<ByFilterDeletionFormData>>({

const formMethods = useForm<ByFilterDeletionFormData>({
defaultValues: emptyFormData,
resolver: yupResolver<ByFilterDeletionFormData>(formSchema),
resolver: yupResolver<ByFilterDeletionFormData>(byFilterDeletionFormSchema),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
resolver: yupResolver<ByFilterDeletionFormData>(byFilterDeletionFormSchema),
resolver: yupResolver<DeepNullable<ByFilterDeletionFormData>>(byFilterDeletionFormSchema),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants