Skip to content

Conversation

skurfuerst
Copy link
Member

@skurfuerst skurfuerst commented Oct 16, 2018

This change does two main things:

NeosUiDefaultNodesOperation should use TraversableNodeInterface

this is needed for Neos ES CR; and is a purely internal refactoring.

Backend-Calculated Parent Node Links

(main part of this change)

The Problem

There are a few places in the Neos UI where we rely on the fact that the contextPath of a node
is structured like /a/b/c@.. - so we calculate the parent path in JavaScript.

In the Event Sourced CR, context paths are actually NodeAddresses, looking roughly like: uuidOfNode__dimension__workspace.

Thus, the user interface needs to treat the contextPath properties as opaque; and figure out
the parents in a different way.

The Solution

  1. We include a parent property as a reference to the parent node in the server-sent data.
  2. We ensure this is used globally on the client side.

@skurfuerst skurfuerst changed the title TASK: make Neos UI roughly work with Event Sourced CR (TODO we need to get rid of this patch) WIP TASK: make Neos UI roughly work with Event Sourced CR (TODO we need to get rid of this patch) Oct 16, 2018
@skurfuerst
Copy link
Member Author

Actually this is going into the right direction now as soon as the core change is merged :)

@skurfuerst skurfuerst changed the title WIP TASK: make Neos UI roughly work with Event Sourced CR (TODO we need to get rid of this patch) FEATURE: make Neos UI roughly work with Event Sourced CR (TODO we need to get rid of this patch) Feb 24, 2020
@skurfuerst skurfuerst changed the title FEATURE: make Neos UI roughly work with Event Sourced CR (TODO we need to get rid of this patch) FEATURE: switch to backend-calculated parent node links (needed for Event Sourced CR) Feb 25, 2020
@skurfuerst
Copy link
Member Author

skurfuerst commented Feb 25, 2020

As soon as CircleCI is 👍, we can merge this I think :) I've done intense manual testing & ran the E2E tests (which still found some issues - so they are of great value)

public function reset()
{
$this->feedbacks = [];
}
Copy link
Member Author

Choose a reason for hiding this comment

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

this does not really have anything to do with the core of the change; but we were missing a way to reset feedbacks beforehand.

@@ -11,6 +11,8 @@
* source code.
*/

use Neos\ContentRepository\Domain\NodeType\NodeTypeConstraintFactory;
use Neos\ContentRepository\Domain\Projection\Content\TraversableNodeInterface;
Copy link
Member Author

Choose a reason for hiding this comment

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

In this file, we implement everything against the TraversableNodeInterface instead of NodeInterface; so that we use the forward-compatible API already.

@@ -212,6 +212,7 @@ protected function getBasicNodeInformation(NodeInterface $node): array
'isAutoCreated' => $node->isAutoCreated(),
'depth' => $node->getDepth(),
'children' => [],
'parent' => $node->getParent()->getContextPath(),
Copy link
Member Author

Choose a reason for hiding this comment

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

that's the server-side part of the "Parent"-change. Easy :D

//
// Helper function to get parent contextPath from current contextPath
//
export const parentNodeContextPath = (contextPath: NodeContextPath) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

basically, we remove this method and all transitive usages.

@@ -1,15 +1,5 @@
import {findNodeInGuestFrame, closestNodeInGuestFrame} from '@neos-project/neos-ui-guest-frame/src/dom';

export const parentNodeContextPath = contextPath => {
Copy link
Member Author

Choose a reason for hiding this comment

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

that's the 2nd occurence of client-side parent calculation which we need to get rid of

Copy link
Contributor

@dimaip dimaip left a comment

Choose a reason for hiding this comment

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

You make complicated things look easy, love this PR and I actually understand the code, looks good!

@dimaip dimaip merged commit fcbf934 into master Feb 26, 2020
@dimaip dimaip deleted the event-sourced-patch branch February 26, 2020 07:29
@skurfuerst
Copy link
Member Author

yeah yrah yeah :D

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

Successfully merging this pull request may close these issues.

3 participants