Overview

Ensure segments have a weight.

Proposed resolution

  • Ensure segments have a weight for sorting them.
  • Check if segments need to be sorted by weight when exposed via API.
  • This will be required for the negotiation of the segments, as the evaluation order matters.

User interface changes

Segments are sorted by weight.

Command icon 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

penyaskito created an issue. See original summary.

wim leers’s picture

How does this relate to #3541148: Provide a locked Default segment? Will that have a special reserved weight that no other Segment can set?

penyaskito’s picture

I'm guessing we will be giving that one a high value, or ensuring all locked segments come last?

thoward216 made their first commit to this issue’s fork.

thoward216’s picture

Status: Active » Needs review

I've created an MR for adding weight to Segments, I haven't addressed anything in the Drupal UI for weighting as I saw this issue: #3527086: Revisit segments UI: do we need a Drupal UI? and I assume it may get addressed there? (i.e you can't re-order in the UI, but they are ordered per their weight)

I've also not addressed discussion in #2/#3 as seems thats not currently confirmed. But we might need #3541148: Provide a locked Default segment to land first? Or it get handled in that ticket after this lands?

penyaskito’s picture

Status: Needs review » Reviewed & tested by the community

I think that's all we need. We can discuss how do we want to handle #2 in #3541148: Provide a locked Default segment.

wim leers’s picture

Assigned: penyaskito » Unassigned
Status: Reviewed & tested by the community » Needs work
Issue tags: +Configuration schema, +validation

Looks good!

Two bugs:

  1. weight is not exposed by the HTTP API, which AFAICT will make the UI impossible to implement: https://git.drupalcode.org/project/experience_builder/-/merge_requests/1...
  2. weight should either be updated via the HTTP API, or it should have a comment pointing to which issue will make it so: https://git.drupalcode.org/project/experience_builder/-/merge_requests/1...
thoward216’s picture

Assigned: Unassigned » thoward216
penyaskito’s picture

Issue tags: +openapi

As Wim pointed out I missed we need to expose the weight to the client-side. Which means openapi.yml needs updates too.

thoward216’s picture

Assigned: thoward216 » Unassigned
Status: Needs work » Needs review
wim leers’s picture

Status: Needs review » Needs work

This looks great now, thanks! 😊

Just one last bug in the OpenAPI spec: https://git.drupalcode.org/project/experience_builder/-/merge_requests/1...

thoward216’s picture

Status: Needs work » Needs review
wim leers’s picture

Status: Needs review » Reviewed & tested by the community

One last bit was missing, fixed that. Awaiting green CI results 🤞

wim leers’s picture

Actually, as I was about to merge, all the weight: 0 lines that were deleted in https://git.drupalcode.org/project/experience_builder/-/merge_requests/1... should be restored 😅 They were totally right — without those, the examples do would not be valid against their (now updated) schema!

Restored all deleted lines in https://git.drupalcode.org/project/experience_builder/-/merge_requests/1...

Again awaiting green CI results, then merging.

wim leers’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.