Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/9.0' into task/3118/remove-plow-js
Browse files Browse the repository at this point in the history
# Conflicts:
#	Classes/Service/NodePolicyService.php
#	packages/neos-ui-sagas/src/Changes/index.js
#	packages/neos-ui-sagas/src/Publish/index.js
#	packages/neos-ui/src/Containers/PrimaryToolbar/PublishDropDown/index.js
  • Loading branch information
markusguenther committed Nov 9, 2023
2 parents 425dd42 + 1545777 commit 60262de
Show file tree
Hide file tree
Showing 99 changed files with 545 additions and 1,143 deletions.
35 changes: 26 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,34 @@ version: 2.0
aliases:
- &workspace_root ~/neos-ui-workspace
- &store_yarn_package_cache
key: yarn-cache-v{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock" }}
key: yarn-cache-v{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn

- &restore_yarn_package_cache
keys:
- yarn-cache-v{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock" }}
- yarn-cache-v{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ checksum "yarn.lock" }}

- &store_app_cache
key: full-app-cache-v{{ .Environment.CACHE_VERSION }}-{{ arch }}-{{ checksum "Tests/IntegrationTests/TestDistribution/composer.json" }}-{{ checksum "Tests/IntegrationTests/TestDistribution/Configuration/Settings.yaml" }}
key: full-app-cache-v{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ arch }}-{{ checksum "Tests/IntegrationTests/TestDistribution/composer.json" }}-{{ checksum "Tests/IntegrationTests/TestDistribution/Configuration/Settings.yaml" }}
paths:
- /home/circleci/app

- &restore_app_cache
keys:
- full-app-cache-v{{ .Environment.CACHE_VERSION }}-{{ arch }}-{{ checksum "Tests/IntegrationTests/TestDistribution/composer.json" }}-{{ checksum "Tests/IntegrationTests/TestDistribution/Configuration/Settings.yaml" }}
- full-app-cache-v{{ .Environment.CACHE_VERSION }}-{{ arch }}-{{ checksum "Tests/IntegrationTests/TestDistribution/composer.json" }}-
- full-app-cache-v{{ .Environment.CACHE_VERSION }}-{{ arch }}-
- full-app-cache-v{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ arch }}-{{ checksum "Tests/IntegrationTests/TestDistribution/composer.json" }}-{{ checksum "Tests/IntegrationTests/TestDistribution/Configuration/Settings.yaml" }}
- full-app-cache-v{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ arch }}-{{ checksum "Tests/IntegrationTests/TestDistribution/composer.json" }}-
- full-app-cache-v{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ arch }}-

- &save_composer_cache
key: composer-cache-v{{ .Environment.CACHE_VERSION }}-{{ arch }}-{{ checksum "Tests/IntegrationTests/TestDistribution/composer.json" }}
key: composer-cache-v{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ arch }}-{{ checksum "Tests/IntegrationTests/TestDistribution/composer.json" }}
paths:
- /home/circleci/composer/cache-dir

- &restore_composer_cache
keys:
- composer-cache-v{{ .Environment.CACHE_VERSION }}-{{ arch }}-{{ checksum "Tests/IntegrationTests/TestDistribution/composer.json" }}
- composer-cache-v{{ .Environment.CACHE_VERSION }}-{{ arch }}-
- composer-cache-v{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ arch }}-{{ checksum "Tests/IntegrationTests/TestDistribution/composer.json" }}
- composer-cache-v{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ arch }}-

- &attach_workspace
at: *workspace_root
Expand Down Expand Up @@ -140,6 +140,20 @@ jobs:
cd /home/circleci/app/
bin/phpunit -c Build/BuildEssentials/PhpUnit/UnitTests.xml Packages/Application/Neos.Neos.Ui/Tests/Unit
php-linting:
docker:
- image: cimg/php:8.2-node
working_directory: *workspace_root
steps:
- attach_workspace: *attach_workspace
- restore_cache: *restore_app_cache

- run: rm -rf /home/circleci/app/Packages/Application/Neos.Neos.Ui
- run: cd /home/circleci/app/Packages/Application && mv ~/neos-ui-workspace Neos.Neos.Ui
- run: |
cd /home/circleci/app/Packages/Application/Neos.Neos.Ui
../../../bin/phpstan analyse
workflows:
version: 2
build_and_test:
Expand All @@ -161,3 +175,6 @@ workflows:
- php-unittests:
requires:
- build_flow_app
- php-linting:
requires:
- build_flow_app
46 changes: 46 additions & 0 deletions Classes/ContentRepository/Service/NeosUiNodeService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php
namespace Neos\Neos\Ui\ContentRepository\Service;

/*
* This file is part of the Neos.Neos.Ui package.
*
* (c) Contributors of the Neos Project - www.neos.io
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with this
* source code.
*/


use Neos\ContentRepository\Core\Factory\ContentRepositoryId;
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use Neos\Neos\FrontendRouting\NodeAddressFactory;
use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Flow\Annotations as Flow;
use Neos\Neos\Utility\NodeTypeWithFallbackProvider;

/**
* @internal
* @Flow\Scope("singleton")
*/
class NeosUiNodeService
{
use NodeTypeWithFallbackProvider;

#[Flow\Inject]
protected ContentRepositoryRegistry $contentRepositoryRegistry;

public function findNodeBySerializedNodeAddress(string $serializedNodeAddress, ContentRepositoryId $contentRepositoryId): ?Node
{
$contentRepository = $this->contentRepositoryRegistry->get($contentRepositoryId);
$nodeAddress = NodeAddressFactory::create($contentRepository)->createFromUriString($serializedNodeAddress);

$subgraph = $contentRepository->getContentGraph()->getSubgraph(
$nodeAddress->contentStreamId,
$nodeAddress->dimensionSpacePoint,
VisibilityConstraints::withoutRestrictions()
);
return $subgraph->findNodeById($nodeAddress->nodeAggregateId);
}
}
80 changes: 0 additions & 80 deletions Classes/ContentRepository/Service/NodeService.php

This file was deleted.

37 changes: 12 additions & 25 deletions Classes/ContentRepository/Service/WorkspaceService.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
use Neos\ContentRepository\Core\ContentRepository;
use Neos\ContentRepository\Core\Factory\ContentRepositoryId;
use Neos\ContentRepository\Core\Feature\WorkspacePublication\Command\DiscardIndividualNodesFromWorkspace;
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindClosestNodeFilter;
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use Neos\ContentRepository\Core\Projection\Workspace\Workspace;
use Neos\Neos\Domain\Service\NodeTypeNameFactory;
use Neos\Neos\FrontendRouting\NodeAddress;
use Neos\Neos\FrontendRouting\NodeAddressFactory;
use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints;
Expand All @@ -26,12 +27,18 @@
use Neos\Neos\PendingChangesProjection\ChangeFinder;
use Neos\Neos\Service\UserService;
use Neos\Neos\Ui\Domain\Model\Feedback\Operations\RemoveNode;
use Neos\Neos\Utility\NodeTypeWithFallbackProvider;

/**
* @Flow\Scope("singleton")
*/
class WorkspaceService
{
use NodeTypeWithFallbackProvider;

#[Flow\Inject]
protected ContentRepositoryRegistry $contentRepositoryRegistry;

/**
* @Flow\Inject
* @var UserService
Expand All @@ -44,12 +51,6 @@ class WorkspaceService
*/
protected $domainUserService;

/**
* @Flow\Inject
* @var ContentRepositoryRegistry
*/
protected $contentRepositoryRegistry;

/**
* Get all publishable node context paths for a workspace
*
Expand Down Expand Up @@ -97,7 +98,7 @@ public function getPublishableNodeInfo(WorkspaceName $workspaceName, ContentRepo
$node = $subgraph->findNodeById($change->nodeAggregateId);

if ($node instanceof Node) {
$documentNode = $this->getClosestDocumentNode($node);
$documentNode = $subgraph->findClosestNode($node->nodeAggregateId, FindClosestNodeFilter::create(nodeTypes: NodeTypeNameFactory::NAME_DOCUMENT));
if ($documentNode instanceof Node) {
$contentRepository = $this->contentRepositoryRegistry->get($documentNode->subgraphIdentity->contentRepositoryId);
$nodeAddressFactory = NodeAddressFactory::create($contentRepository);
Expand Down Expand Up @@ -126,7 +127,6 @@ public function getAllowedTargetWorkspaces(ContentRepository $contentRepository)
$user = $this->domainUserService->getCurrentUser();

$workspacesArray = [];
/** @var Workspace $workspace */
foreach ($contentRepository->getWorkspaceFinder()->findAll() as $workspace) {
// FIXME: This check should be implemented through a specialized Workspace Privilege or something similar
// Skip workspace not owned by current user
Expand Down Expand Up @@ -155,13 +155,14 @@ public function getAllowedTargetWorkspaces(ContentRepository $contentRepository)
return $workspacesArray;
}

/** @return list<RemoveNode> */
public function predictRemoveNodeFeedbackFromDiscardIndividualNodesFromWorkspaceCommand(
DiscardIndividualNodesFromWorkspace $command,
ContentRepository $contentRepository
): array {
$workspace = $contentRepository->getWorkspaceFinder()->findOneByName($command->workspaceName);
if (is_null($workspace)) {
return Nodes::createEmpty();
return [];
}

$changeFinder = $contentRepository->projectionState(ChangeFinder::class);
Expand Down Expand Up @@ -190,7 +191,7 @@ public function predictRemoveNodeFeedbackFromDiscardIndividualNodesFromWorkspace

$childNode = $subgraph->findNodeById($nodeToDiscard->nodeAggregateId);
$parentNode = $subgraph->findParentNode($nodeToDiscard->nodeAggregateId);
if ($parentNode) {
if ($childNode && $parentNode) {
$result[] = new RemoveNode($childNode, $parentNode);
$handledNodes[] = $nodeToDiscard;
}
Expand All @@ -201,18 +202,4 @@ public function predictRemoveNodeFeedbackFromDiscardIndividualNodesFromWorkspace

return $result;
}

private function getClosestDocumentNode(Node $node): ?Node
{
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);

while ($node instanceof Node) {
if ($node->nodeType->isOfType('Neos.Neos:Document')) {
return $node;
}
$node = $subgraph->findParentNode($node->nodeAggregateId);
}

return null;
}
}
3 changes: 2 additions & 1 deletion Classes/Controller/BackendController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use Neos\Neos\Controller\Backend\MenuHelper;
use Neos\Neos\Domain\Repository\DomainRepository;
use Neos\Neos\Domain\Repository\SiteRepository;
use Neos\Neos\Domain\Service\NodeTypeNameFactory;
use Neos\Neos\Domain\Service\WorkspaceNameBuilder;
use Neos\Neos\FrontendRouting\NodeAddressFactory;
use Neos\Neos\FrontendRouting\SiteDetection\SiteDetectionResult;
Expand Down Expand Up @@ -170,7 +171,7 @@ public function indexAction(string $node = null)
// to call the contentGraph here directly.
$rootNodeAggregate = $contentRepository->getContentGraph()->findRootNodeAggregateByType(
$workspace->currentContentStreamId,
NodeTypeName::fromString('Neos.Neos:Sites')
NodeTypeNameFactory::forSites()
);
$rootNode = $rootNodeAggregate->getNodeByCoveredDimensionSpacePoint($defaultDimensionSpacePoint);

Expand Down
Loading

0 comments on commit 60262de

Please sign in to comment.