Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit saved form & replace saved XML functionality #161

Merged
merged 13 commits into from
Feb 12, 2021

Conversation

saulipurhonen
Copy link
Contributor

Description

Introduced edit functionality for submitted forms and replace functionality for uploaded XML files.

Related issues

Closes #144

Type of change

  • New feature (non-breaking change which adds functionality)

Changes Made

  • Added button groups for saved object listing with edit and delete functionalities
  • Change Submit button type and label according to what user is filling / editing / uploading / replacing
  • Renamed draftObject slice to currentObject
  • Enabled replace object in folder so tags can be updated
  • Show success message with message tied to user action
  • Dialog content and functionality for unsaved forms with saved status

Testing

  • E2E test for saved form edit

XML replace testing needs to be done some other way. Issued in #160

@saulipurhonen saulipurhonen added the enhancement New feature or request label Feb 11, 2021
@saulipurhonen saulipurhonen added this to the MVP milestone Feb 11, 2021
@saulipurhonen saulipurhonen self-assigned this Feb 11, 2021
@saulipurhonen saulipurhonen force-pushed the feature/edit-replace-saved-objects branch from 95c10a5 to efbc844 Compare February 11, 2021 07:36
@saulipurhonen saulipurhonen linked an issue Feb 11, 2021 that may be closed by this pull request
@saulipurhonen
Copy link
Contributor Author

Pushed an test for testing XML replace with Cypress. This fixes #160

@saulipurhonen saulipurhonen linked an issue Feb 11, 2021 that may be closed by this pull request
@blankdots
Copy link
Contributor

blankdots commented Feb 11, 2021

@saulipurhonen could we also solve conflicts ? I think merging #159 intodevelop caused some of them.

@saulipurhonen
Copy link
Contributor Author

@saulipurhonen could we also solve conflicts ? I think merging #159 intodevelop caused some of them.

Conflicts resolved.

@saulipurhonen
Copy link
Contributor Author

saulipurhonen commented Feb 11, 2021

Pushed an test for testing XML replace with Cypress. This fixes #160

For some reason GH actions failed with rendering snackbar alert after testing replace of XML. I left the test without check for that alert and edited #160 to mirror current status.

@hannyle
Copy link
Contributor

hannyle commented Feb 12, 2021

So far looks good to me.

One thing I noticed is sometimes when I click to Edit a submitted form, it renders like this to me.
Focusing on the input fields would solve the problem, but if I unfocused them, it happened again. This has happened randomly from my side, haven't figured out the pattern.

Screenshot 2021-02-12 at 8 38 53

@hannyle
Copy link
Contributor

hannyle commented Feb 12, 2021

I have a small question about the code:

In WizardFillObjectDetailsForm - function handleChange:

!currentObject.accessionId && currentObjectId
? dispatch(
setCurrentObject({
...clone,
cleanedValues: values,
type: currentObject.type || "draft",
objectId: currentObjectId,
})
)
: dispatch(setCurrentObject({ ...clone, cleanedValues: values }))

When will the condition !currentObject.accessionId && currentObjectId happen ? I think if currentObject doesn't have accessionId, will it have a type ?

@saulipurhonen
Copy link
Contributor Author

So far looks good to me.

One thing I noticed is sometimes when I click to Edit a submitted form, it renders like this to me.
Focusing on the input fields would solve the problem, but if I unfocused them, it happened again. This has happened randomly from my side, haven't figured out the pattern.

Screenshot 2021-02-12 at 8 38 53

I stumbled into this before but on my local it got fixed with React Hook Form reset() function. Let's make an issue when someone finds a way to reproduce this with pattern.

@saulipurhonen
Copy link
Contributor Author

I have a small question about the code:

In WizardFillObjectDetailsForm - function handleChange:

!currentObject.accessionId && currentObjectId
? dispatch(
setCurrentObject({
...clone,
cleanedValues: values,
type: currentObject.type || "draft",
objectId: currentObjectId,
})
)
: dispatch(setCurrentObject({ ...clone, cleanedValues: values }))

When will the condition !currentObject.accessionId && currentObjectId happen ? I think if currentObject doesn't have accessionId, will it have a type ?

This is a fallback if user saves a draft, edits form and navigates when draftStatus is notSaved. In this scenario we don't have an accessionId set to currentObject but we have set currentObjectId.

This logic could have some improvements.

@blankdots blankdots merged commit 8e1952e into develop Feb 12, 2021
@blankdots blankdots deleted the feature/edit-replace-saved-objects branch February 12, 2021 09:18
@blankdots blankdots mentioned this pull request Feb 12, 2021
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add edit and delete functionality to submitted objects
3 participants