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

ISSUE-100: Automatic Draft Saving, Navigation, better Metadata Dates, Multiple Options for Getty #106

Merged
merged 20 commits into from
Mar 7, 2021

Conversation

DiegoPino
Copy link
Member

@DiegoPino DiegoPino commented Mar 7, 2021

What?

This covers #103 #100 #101 #91 #88

I know its not the typical pull, but a lot of this is connected or related and in this case makes sense since ISSUE-100 has been already in production In many live archipelagos.

Main feature is the Autosave that survives for a week of no interaction on any Webform Submit triggering interaction (and no validation needed) but still accumulating errors as you move forward avoiding you to submit things without reason

DiegoPino and others added 20 commits January 26, 2021 23:22
@alliomeria we will have to talk about this...
So what i need now after all this is that we make sure people understand that when this is enabled either 1.- No saving is possible without validation. Right now on the navigation we are shamelessly bypassing validation.
Or
2.- This option is available only for admins?
or
3.- We only allow navigation that enforces at all pages to be validated. Which means, visiting each page, and not skipping any step

its a complex thing since a lot of the validation actually happens on a per page basis!

Tired now, so will keep developing tomorrow morning...
The actual code (tired.. gosh)
This hides for good (for now) the preview button on Nodes Entity Forms where a Webform is used (normally the ones we will have user facing) because with View Mode switching enabled those previews become a source of confusion and have just the worst even UI. Also, deals now with Revisions so the we always use the current on edit one and not the View-able one See #101
I wish all this logic would simply not reload on every webform step. But this is just over my paygrade now. This is now forms work. Rebuilding and rebuilding for ever.
What a mess. calling a protected member. Gosh
Same as #101 now we also load on the webform on "button click" the right revision to be edited.
Ok. Seem like progress saving is functional now!
- So much
- More than much
- ON wizard navigation we keep track of un handled errors and then we clear errors so people can jumo
- ON next/submit/preview button we check if the current step was validated and if so we clear the tracked errors (so people can actually correct them)
On any page that has a "submit/save" we check if there were errors tracked. If so we disable the submit and show a nice message.
TODO @alliomeria
: add the "quick save button" requested
Make sure that we also check that "EVERY" visible/accesible page was visited, not only the ones we found errors (tiny detail but is 1AM!)
TODO DEV too:
There is a lot of duplicated code in how we check if the node is new or not, if its widget driven, if it has wizard pages, etc. WE can do better and make a lot of that common methos

Of course this needs more work and a lot of testing, but right now i'm optimistic!
But fully functional

New ADOs in progress have now a "quick save" button that just pushed data unvalidated into the priv store.

This may feel a lot of changes because i did a quick reformat of the code
@pcambra wondering if my IDE is offset re- DCS? wonder if i should be not trusting it and should run phpcs. FYI: maybe you could share your Idea xml file.

Added also a helper function (more needed since i see a lot of dup. code)
Yep. Do not wait over a week. Private gets cleaned after that if not renewed
I "could" allow the draft message to be set at the webform level BUT, since we are not submitting dear webform hides the settings UI making all that just a YML operation. We could add this message as a setting of the formatter OR of handler (better?)
This adds a selection option for endusers at the webform getty level element and makes some sparql magic to get it done.
fuzzy, exact and terms.

 May require some testing
A few fixes and a lot of questions/doubts
- Dates can now be shown as RAW on the preview page
- When multiple empty elements are being automatically pushed into a list (because the admin or users decided so) we no longer end with empty entries in the JSON. We clean them up. basically anything that only has a date_type is perceived as emtpy and removed (preSave of the element which I SHOULD USE MORE!)

Restored the Labels for the 3 different text boxes but no solution yet for a JS that can on the fly on state change of the radios change the values from Point Date to Start Date.

I ahve to be honest with myself. This is a needed element and "fully functional" entry method right now, but i DO NOT like it. I feel the code needs a deep cleanup and a lot of testing. But we can not right now stop 2 weeks just to get this done in a perfect way. So i will roll with how it is. It works, its not perfect, its stable and gets the job done. Perfect, eventually. Clean, sooner than Perfect
@alliomeria
To date is confusing, even for a never confused and confident human being
@patdunlavey since we do not "delete" old mappings because the user may have provided its own, or there could be mappings present that exist but not handled by this particular form, you may want to remove your ap:entitymapping array generated during your tests.

This will support now this full list https://github.com/esmero/strawberryfield/blob/1.0.0-RC2/src/EventSubscriber/StrawberryfieldEventPresaveSubscriberAsFileStructureGenerator.php#L33-L42 which may be expanded (and that constant maybe put in a different class too)
Seems like there is a lot of heterogenity in webform elements that implement EntityReferences and not all (we use mostly the based on core entity_reference so never noticed) use #target_type

This fixes it. @patdunlavey please test with as many entity reference options you can.
…ngle value metadata date fields to be saved into json as if they were multi-valued. This resulted in them not being read back into the webform correctly after saving.
ISSUE-100 - Fix when not $element['#multiple']
@DiegoPino DiegoPino self-assigned this Mar 7, 2021
@DiegoPino DiegoPino added enhancement New feature or request UI/UX The thing people do when in front of a screen Webform Elements Things with input to fill and interact with while ingesting metadata Webform Handler Webform Widgets Connecting Webforms and Entity Fields labels Mar 7, 2021
@DiegoPino
Copy link
Member Author

@patdunlavey merging ISSUE-100 into 1.0.0-RC2 so we can advance. Thanks for your contributions here! (and everywhere too)

@DiegoPino DiegoPino merged commit 6702a7a into 1.0.0-RC2 Mar 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request UI/UX The thing people do when in front of a screen Webform Elements Things with input to fill and interact with while ingesting metadata Webform Handler Webform Widgets Connecting Webforms and Entity Fields
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants