Overview
Follow-up to #3478299: Implement basic auto-save. We now need to a meet the auto-save requires of #3455753: Milestone 0.2.0: Early preview
In #3478299 we implemented the basics, we auto-save the entity and allow the editor to load those changes back.
For Milestone 0.2 we will need be able to retrieve all auto-save entities and metadata about the auto-saves
List of all entities that have been changed
The API endpoint needs to have following information:
- Entity Label
- Entity type
- Entity ID
- Changed timestamp
- Author of the change
Proposed resolution
- Create an auto-save service that will replace
NotTheGoodAutoSaveTraitThis service will have to
- Auto-save an individual entity, including metadata about the save
- Retrieve the auto-save state of an entity
- Provide a list of all auto-saved entities with there meta
- Replace the existing use of the
NotTheGoodAutoSaveTraitinApiPreviewControllerandApiLayoutControllerwith use of the new serviceEventually the client may want to have have separate calls to the server to for auto-save operation but for now these are working and not changing that keeps the scope smaller and just to the backend
- Provide a controller that will use the service to retrieve a listing the entity auto-save and their metadata
Remaning tasks
Add conflict IDs and updated data to body of the 409update openapi.yml to reflect possible 409 and presence of the data_hash keyAdd image styleRename controller and consider consolidation with the publish all oneRebase off 0.x now that 408 is in
User interface changes
Issue fork experience_builder-3489743
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
tedbowComment #3
larowlanCouple of questions on the current progress:
* I don't think we should pass the data as an array, can we not just keep it as a string and save the performance overhead of serialize\unserialize being called (and particularly the memory impact). Would likely need our own schema for the tempstore to bypass the serializing of the data column
* Should we also be considering langcode here in the identifiers?
Comment #4
tedbowI pushed up a start that just replaces the current trait with a service. It doesn't change the basic functionality.
It does not add any of the extra metadata, timestamp, author, etc to the auto-save yet.
One thing we will have to consider eventually is that by #3455753: Milestone 0.2.0: Early preview we will be dealing with new entities, not just existing ones. We will also have a "publish all" button that takes all of the auto-saved work and saves them to real entity revisions. For new entities that are created in XB that means we can not rely on entity type/entity id for the auto-save key because they will not exist as entities yet. Maybe
\Drupal\experience_builder\AutoSaveManager::saveshould return back the auto-save key(a uuid?) so that client can request the auto-save state back later when it there is no entity involved.Comment #5
tedbowAlso right now the e2e still don't test auto-save. There is hack in the test to get around it
we should probably commit #3481736: Adapt E2E tests to work with auto-save, this issue. But it doesn't block it now
Comment #6
larowlanRebased the MR on top of #3489994: Create an endpoint to publish all auto-saved entities
Adding PP-1 to the title to reflect that should go in first and then this should be rebased
Comment #8
larowlanhttps://git.drupalcode.org/issue/experience_builder-3489994/-/merge_requ... shows the changes on top of #3489994: Create an endpoint to publish all auto-saved entities
The merge request seen above is including that branch
Comment #9
larowlanThe code here is passing
Comment #10
tedbowChanges since my last review look good. I think this is basically ready. Will review again after #3489994: Create an endpoint to publish all auto-saved entities is and we can remove those changes
Comment #11
lauriiiComment #12
larowlanThis is ready for review now, there's one question on the MR about whether we should ship with an image style for the avatars or not
Comment #13
tedbowI talked to @effulgentsia about this issue and #3489994: Create an endpoint to publish all auto-saved entities which together will allow the UI to create "Publish all" button
I think we missed something between these 2 issues
Here is the UI proposed workflow
So as it is now
ApiPublishAllControllerdoesn't take any input from the client but we probably need to change that where the client sends back some info that it received fromApiAutoSaveController. Otherwise the user could see a list of changes to be published wait an hour while other changes are made, without them being aware, click "publish all" and then they have published things they are not away of.Comment #14
tedbowOk started a solution to #13 will comment on the MR
Comment #15
larowlanAdded https://www.drupal.org/project/experience_builder/issues/3491459
And in doing so it makes me feel the best naming for the controller here would be something involving 'pending changes'
Remaining tasks:
* Add conflict IDs and updated data to body of the 409
* update openapi.yml to reflect possible 409 and presence of the data_hash key
* Add image style
* Rename controller and consider consolidation with the publish all one
* Rebase off 0.x now that 408 is in
Comment #16
larowlanThis is ready for review now 🙌
Comment #17
lauriiiComment #18
tedbowI think this issue is done but there are couple problem in 0.x that makes test fail.
#3492734: Empty-canvas e2e test is failing randomly and has leftover wait() call that shouldn't be there causes e2e tests to fail.
#3492722: Update XB to require Drupal 11.2 found an error that should be fixed in the core issue #3492705: Install modules with container_rebuild_true set by themselves
Comment #19
tedbowCreated follow-up #3492740: ui/tests/support/commands.js should set 'hostname' = '/'
Comment #20
tedbowassigned to @traviscarden for openapi.yml approval/review
Comment #22
traviscarden commentedJust the usual little formatting niggle and it looks good, @tedbow.
Comment #23
tedbow@traviscarden thanks for the review !
Test are still failing because of #3492722: Update XB to require Drupal 11.2 and #3492734: Empty-canvas e2e test is failing randomly and has leftover wait() call that shouldn't be there(e2e)
Comment #24
tedbowTest are passing except for cspell which is know issue fixed in #3493299: Fix cspell errors we didn't affect that file
empty-canvas.cy.jsis failing but that is known issue being worked on in #3492734: Empty-canvas e2e test is failing randomly and has leftover wait() call that shouldn't be thereComment #25
tedbowComment #27
tedbowDone! thanks @larowlan and everyone!
Comment #28
tedbowComment #30
wim leersFYI, follow-up fixed: #3505590: Follow-up for #3489743: add missing `enforced` dependency to xb_avatar image style, to ensure it is uninstalled together with XB.