Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

[Prototype] EZP-26309: Prototype the usage of REST Embedding in PlatformUI #687

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

dpobel
Copy link
Contributor

@dpobel dpobel commented Oct 12, 2016

JIRA: https://jira.ez.no/browse/EZP-26309

Description

This is a prototype to use REST Embeddding (implemented in ezsystems/ezpublish-kernel#1741) in PlatformUI. It also requires ezsystems/ez-js-rest-client#79 in the JavaScript REST Client. This is done for 2 parts in PlatformUI:

  1. on the "My Drafts" block on the dashboard, this avoids having to load the ContentInfo for each version individually.
  2. on the "Version" tab when viewing a Content, this allows to get the Creator of a Version without a new requests.

Outcome

I see 2 issues in the current implementation:

  1. it seems like the ContentInfo has been removed from the Location response. This is breaking some parts of PlatformUI.
  2. there's a recursion protection which prevents the system from embedding the same object several times. For instance 2 versions can have the same creator (or you can have 2 drafts for the same Content) and this is something very complicated to handle in the PlatformUI.

Other than that, this is working well. The performance improvement on the dashboard block is really interesting and we could so the same in a lots of places! In terms of change, the big thing is in the JavaScript client where we need to change each and every method to accept a new parameter so that we can pass the custom header to request the embedding.

callback(error, response);
return;
}
Y.Array.each(response.document.VersionList.VersionItem, function (versionItemHash) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: response.document.VersionList.VersionItem.forEach() is a better, native way of doing it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the nitpicking, but what about the core feature/implementation ? (In case, you missed it, that's only a Prototype)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dpobel I'm going to check it ASAP. Very interesting approach.

var attrName, linkName;

if ( L.isObject(item) ) {
linkName = Y.Object.keys(item)[0];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Object.keys() works natively everywhere

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants