Closed (fixed)
Project:
Experience Builder
Component:
Data model
Priority:
Critical
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
22 Aug 2024 at 07:02 UTC
Updated:
4 Oct 2024 at 09:34 UTC
Jump to comment: Most recent
Per #3454519: [META] Support component types other than SDC, block, and code components, we'll need to support additional component types eventually.
But currently, ComponentTreeStructure (the tree prop on the ComponentTreeItem field type) is storing SDC plugin IDs.
Which means that the data model is currently tightly coupled to SDCs.
Change those to Component config entity IDs.
IOW, this issue must make the following documentation change a reality:
diff --git a/docs/data-model.md b/docs/data-model.md
index c5eea807..77eca2bd 100644
--- a/docs/data-model.md
+++ b/docs/data-model.md
@@ -243,22 +243,22 @@ Example:
```json
{
"ROOT_UUID": [
- {"uuid": "uuid-root-1", "component": "provider:two-col"},
- {"uuid": "uuid-root-2", "component": "provider:marquee"},
- {"uuid": "uuid-root-3", "component": "provider:marquee"}
+ {"uuid": "uuid-root-1", "component": "provider+two-col"},
+ {"uuid": "uuid-root-2", "component": "provider+marquee"},
+ {"uuid": "uuid-root-3", "component": "provider+marquee"}
],
"uuid-root-1": {
"firstColumn": [
- {"uuid": "uuid4-author1", "component": "provider:person-card"},
- {"uuid": "uuid2-submitted", "component": "provider:elegant-date"}
+ {"uuid": "uuid4-author1", "component": "provider+person-card"},
+ {"uuid": "uuid2-submitted", "component": "provider+elegant-date"}
],
"secondColumn": [
- {"uuid": "uuid5-author2", "component": "provider:person-card"}
+ {"uuid": "uuid5-author2", "component": "provider+person-card"}
]
},
"uuid-root-2": {
"content": [
- {"uuid": "uuid4-author3", "component": "provider:person-card"}
+ {"uuid": "uuid4-author3", "component": "provider+person-card"}
]
}
}
Zero changes.
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
wim leersComment #3
wim leersThis blocks #3469610: Prepare for multiple component types: prefix Component config entity IDs with `sdc`.
Comment #4
wim leersComment #5
abhisekmazumdarI want to pick this up, but before that, can I get some doubts cleared up:
ComponentTreeStructureso that the said format of config are generated?I will really appreciate some input on how to get started with this. As of now, I have XB working locally.
Comment #6
wim leersYay, thank you, @abhisekmazumdar! 😊
config/optional/field.field.node.article.field_xb_demo.yml. But it's the exact same change, because both content and config are validated by\Drupal\experience_builder\Plugin\Validation\Constraint\ComponentTreeStructureConstraintValidator(). That is the file you'll have to make logic changes in. See the first paragraph of https://wimleers.com/xb-week-12 for context.ComponentTreeStructureTestto match what I've described in the issue summary.Comment #7
wim leersD'oh, I guess this issue interestingly sits at the intersection of and : it's an update to the data model to correctly use future config management stuff.
Undoing what I did in #4 🙈
Comment #8
abhisekmazumdarThis makes sense to me now. Thank you so much for clearing my doubts
I'm working on these changes.
Comment #9
wim leers🎉 Thank you! :)
Comment #10
wim leersThis also blocks #3462241: [PP-1] Decorate the SDC plugin manager and allow components defined in code.
Comment #14
abhisekmazumdarI will need some more help here. This is what I understand so far:
ComponentTreeStructureand see the different structure for the components which now don't have the sdc names.field.field.node.article.field_xb_demo, which doesn't have much of a difference in the config nor for the default content.phpunit -c core modules/contrib/experience_builder/tests/src/Kernel/DataType/ComponentTreeStructureTest.phpand see it all green.Constraint\ComponentTreeStructureConstraintValidatorbut I'm not sure how and where.This is what I need to understand:
I also understand this is a critical issue, and unassigning this from me. If someone already has the experience to do it quickly, please take it over.
I will pick it up if I get my answer or figure it out.
Comment #15
wim leers#14:
Besides updating the validator, the other crucial next step is to update the logic in the XB field type and the
hydratedcomputed property's logic due to thetreefield property now containing component config entity IDs instead of SDC plugin IDs. Did that for you in https://git.drupalcode.org/project/experience_builder/-/merge_requests/2... 👈 Thanks to this commit, as soon as you update the default config (#14.3), everything should render once again. But you probably need to disable the validator temporarily, until you've updated its logic, because that will (should) complain about invalid config.WRT understanding:
docs/data-model.md. You'll see that now the test starts to fail, so it points to how to validator logic will need to be updated :)🏓 Back to you — you can do it! 😊
Comment #16
abhisekmazumdarComment #17
abhisekmazumdarThank you, @Wim Leers, for the detailed input & believing in me 😁
🏓 The MR is still a work in progress, so it is not completely ready for review. However, I seek some answers to the questions I have asked over the MR. Really appreciate your help.
Comment #18
wim leersI do totally believe in you! 😄
Also, I very much messed up the sample commits and issue summary 🙈
Issue summary fixed, and mistake rectified on the MR: https://git.drupalcode.org/project/experience_builder/-/merge_requests/2....
Comment #19
abhisekmazumdarComment #20
abhisekmazumdarDone:
Todo:
Please review and give feedback.
Comment #21
abhisekmazumdarI will check and rebuild the XB with a fresh setup. Some of the outstanding TODO have been fixed:
Remaining TODO:
phpcswhich are unrelated to this MR.For these, I still need feedback.
Comment #22
wim leersWow those
phpcsfailures are super weird! 🤪The first next step: making the
phpunittests pass — they have many failures at the moment: https://git.drupalcode.org/issue/experience_builder-3469609/-/jobs/2697530Those need to pass first, before the UI will be able to work and before the Cypress E2E tests can possibly pass 😊
Comment #23
abhisekmazumdartrying to make the tests all green and happy
Comment #24
abhisekmazumdarI tried setting up the xdebugger on my local machine to make it work with the current local setup I have. Setting up the xdebugger correctly will give me a much clearer idea of what is breaking during the test.
Yet I was unable to make Xdebugger work for the unit test cases.
Comment #25
abhisekmazumdarOkay, I was successfully able to make the debugger work. It works out of the box, but I need to click the continue button one more time to stop it at the required mark.
@Wim Leers
I see mostly the
\Drupal\Tests\experience_builder\Kernel\DataType\ComponentTreeStructureTest::testValidationis creating problem. For our case should we just updateproviderValidationdata to match it with what its actually trying to assert?Or should I be looking at why the assertion is breaking ?
Comment #26
wim leersThanks for pushing this forward, I'll take a look at where you got the MR 😊
(Started with merging in upstream, thanks to #3472299: Update default config to make a fresh install result in an XB UI with an empty canvas landing yesterday, this MR now has to make fewer changes, but it required a conflict to be resolved.)
Comment #27
wim leers#25 was accurate, yet incomplete: more changes are necessary. The
ComponentTreeStructurevalidator needed to be updated too, for example: https://git.drupalcode.org/project/experience_builder/-/merge_requests/2.... That alone fixes a number of failures.Comment #28
wim leersDone for the day. @abhisekmazumdar, could you push this across the finish line? 😊🙏
Comment #29
wim leersComment #30
wim leersComment #31
longwaveOverall this is the way I think we need to go but Wim's comments and my comments need addressing.
Comment #32
wim leersThanks, @longwave!
I think anybody could tackle the remaining feedback :)
Comment #33
longwaveAddressed all feedback.
Comment #34
longwaveSaving attribution.
Comment #35
wim leersComment #37
wim leers