Problem/Motivation

View integration don't show preview of view sources, only placeholders.

Proposed resolution

For each view source, execute the view and extract the rendered plugin.

It may be easier to start from #3540078: Dynamic theme registry alteration and it may make easier to do this later: #3533043: Expose view sources forms in SourceInterface::settingsForm() (because the logic to load and run the specific plugin could be shared).

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

pdureau created an issue. See original summary.

pdureau’s picture

Too late for alpha5

grimreaper’s picture

Assigned: Unassigned » grimreaper
grimreaper’s picture

Assigned: grimreaper » Unassigned

Hello,

Unassigning, I will focus myself on Styles API in Core + UI Styles 2 and related issues in the ecosystem.

pdureau’s picture

Assigned: Unassigned » pdureau

While working on the revamp UI Patterns's contexts, I may get an idea about this.

I will give a try.

pdureau’s picture

Status: Active » Needs work

Started.

pdureau’s picture

First proposal pushed. Still WIP.

TODO:

  • check pipeline fails
  • check feed icon rendering
  • estimate performance cost of re-excecuting the view 7 times 😱
  • check fatal when rendering a full entity in View row (with and without attachments)

And also, use the current state of work to:

pdureau’s picture

Assigned: pdureau » mogtofu33
Status: Needs work » Needs review

Rebased. It works pretty well:

  • ViewAttachmentAfterSource ✅ but let's check again: it sometimes print the renderable multiple time
  • ViewAttachmentBeforeSource ✅ but let's check again too
  • ViewExposedSource ✅
  • ViewFeedIconsSource ❌
  • ViewFooterSource ✅
  • ViewHeaderSource ✅
  • ViewMoreSource ✅
  • ViewPagerSource ✅
  • ViewRowsSource ✅
  • ViewTitleSource ✅

This is not a real "review", it is too soon to merge, but an opportunity to discuss about the pipeline fails. The hardcoded placeholders from PreviewPanel::alterPreviewPlaceholder() ("[View] Header", "[View] Exposed"...) have been removed and the preview is now behaving the normal way, with the "[Placeholder] No preview" added by PreviewPanel::renderPreviewSources() when empty.

However, everything become "[Placeholder] No preview":

  • '[View] Header' >> '[Placeholder] No preview'
  • '[View] Exposed' >> '[Placeholder] No preview'
  • '[View] Attachment_before' >> '[Placeholder] No preview'
  • '[View] Rows' >> '[Placeholder] No preview'
  • '[View] Pager' >> '[Placeholder] No preview'
  • '[View] Attachment_after' >> '[Placeholder] No preview'
  • '[View] More' >> '[Placeholder] No preview'
  • '[View] Footer' >> '[Placeholder] No preview'
  • '[View] Feed_icons' >> '[Placeholder] No preview'

So, it is not properly testable by playwright with Displaybuilder.expectBlocksAvailable() which expect a specific and unique placeholder label for each.

The solution will be to update PreviewPanel::renderPreviewSources() to print something dynamic like '[Placeholder] @source_plugin_label'

And this may also be the opportunity to the last 4 hardcoded placeholder from PreviewPanel::alterPreviewPlaceholder():

  • [Placeholder] Local tasks (Tabs)
  • [Placeholder] Block messages
  • [Placeholder] Page title
  • [Placeholder] Page content

This is extending the scope of the ticket, is it OK?

mogtofu33’s picture

A change of preview placeholder is proposed in #3615031: Enhance instances list for better navigation so probably better to have it merged before, then back to this one, then a follow up issue for views placeholder.

mogtofu33’s picture

Parent issue: » #3613194: [meta] Next beta
mogtofu33’s picture

pdureau’s picture

Assigned: mogtofu33 » pdureau
Status: Needs review » Needs work

A change of preview placeholder is proposed in #3615031: UX for nesting displays in displays comprehension so probably better to have it merged before, then back to this one, then a follow up issue for views placeholder.

Ok, i take back this issue (because I have work left to do there) and i will resume once the other one is fixed.

Edit: Finally, it will be addressed in #3618072: Placeholders and real render, in Canvas and Preview

mogtofu33’s picture

Assigned: pdureau » mogtofu33

mogtofu33’s picture

Assigned: mogtofu33 » pdureau
Status: Needs work » Needs review
Issue tags: +AI-accelerated

mogtofu33 changed the visibility of the branch 3542796-preview-of-view to hidden.

pdureau’s picture

Assigned: pdureau » mogtofu33
Status: Needs review » Needs work

With the split, the reviews must be done following this order:

  1. #3618072: Placeholders and real render, in Canvas and Preview
  2. #3542796: Preview of view sources, because the MR is rebasing the previous one
  3. #3618618: Preview an entity view override and a view page display on their own page, because the MR is rebasing the previous one
pdureau’s picture

Assigned: mogtofu33 » pdureau
Status: Needs work » Needs review

ooops, wrong status change.

Back to me for review.

pdureau changed the visibility of the branch 3542796-placeholders-preview-views to hidden.

pdureau changed the visibility of the branch 3542796-placeholders-preview-views to active.

pdureau’s picture

#3618072: Placeholders and real render, in Canvas and Preview has been merged to 1.0.x. I will rebase before the review.

pdureau’s picture

Assigned: pdureau » mogtofu33
Status: Needs review » Reviewed & tested by the community

Feature review

OK, source previews seem to work as expected 👍

Code review

OK, except the playwright fail following the changes in #3618072: Placeholders and real render, in Canvas and Preview:

tests/src/Playwright/Tests/views.spec.ts:49:5 › Views build and render @base › Check the base display 
    Error: expect(locator).toMatchAriaSnapshot(expected) failed
    Locator: locator('.db-island-builder .db-dropzone--root')

    - - button "[View] Header"
    - - button "[View] Exposed form"
    - - button "[View] Attachment before"
    - - button "[View] Rows"
    - - button "[View] Pager"
    - - button "[View] Attachment after"
    - - button "[View] More"
    - - button "[View] Footer"
    - - button "[View] Feed icons"
    + - text: "[View] Header Empty. Configure it to make it visible. [View] Exposed form Empty. Configure it to make it visible. [View] Attachment before Empty. Configure it to make it visible. [View] Rows Empty. Configure it to make it visible. [View] Pager Empty. Configure it to make it visible. [View] Attachment after Empty. Configure it to make it visible. [View] More Empty. Configure it to make it visible. [View] Footer Empty. Configure it to make it visible. [View] Feed icons Empty. Configure it to make it visible."

  • mogtofu33 committed 4017275e on 1.0.x
    feat: #3542796 Preview of view sources
    
    By: pdureau
    By: mogtofu33
    
mogtofu33’s picture

Assigned: mogtofu33 » Unassigned
Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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