forked from neos/neos-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request neos#3759 from neos/feature/conflict-resolution-01…
…/publishing-modal !!!FEATURE: Lock the UI and present a modal during publish/discard
- Loading branch information
Showing
56 changed files
with
2,868 additions
and
689 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
/* | ||
* 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. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Neos\Neos\Ui\Application\ReloadNodes; | ||
|
||
use Neos\ContentRepository\Core\Projection\ContentGraph\Node; | ||
use Neos\Flow\Annotations as Flow; | ||
use Neos\Flow\Mvc\ActionRequest; | ||
use Neos\Neos\Ui\Fusion\Helper\NodeInfoHelper; | ||
|
||
/** | ||
* A helper DTO containing a minimal node representation as needed for | ||
* the document or content tree | ||
* | ||
* @internal for communication within the Neos UI only | ||
*/ | ||
#[Flow\Proxy(false)] | ||
final readonly class MinimalNodeForTree implements \JsonSerializable | ||
{ | ||
/** | ||
* @param array{nodeAddress:string}&array<string,mixed> $data | ||
*/ | ||
private function __construct(private array $data) | ||
{ | ||
} | ||
|
||
public static function tryFromNode( | ||
Node $node, | ||
NodeInfoHelper $nodeInfoHelper, | ||
ActionRequest $actionRequest | ||
): ?self { | ||
/** @var null|(array{nodeAddress:string}&array<string,mixed>) $data */ | ||
$data = $nodeInfoHelper | ||
->renderNodeWithMinimalPropertiesAndChildrenInformation( | ||
node: $node, | ||
actionRequest: $actionRequest | ||
); | ||
|
||
return $data ? new self($data) : null; | ||
} | ||
|
||
public function getNodeAddressAsString(): string | ||
{ | ||
return $this->data['nodeAddress']; | ||
} | ||
|
||
/** | ||
* @return array<string,mixed> | ||
*/ | ||
public function jsonSerialize(): array | ||
{ | ||
return $this->data; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
Classes/Application/ReloadNodes/NoDocumentNodeWasFound.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
/* | ||
* 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. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Neos\Neos\Ui\Application\ReloadNodes; | ||
|
||
/** | ||
* @internal for communication within the Neos UI only | ||
*/ | ||
final class NoDocumentNodeWasFound extends \Exception | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
/* | ||
* 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. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Neos\Neos\Ui\Application\ReloadNodes; | ||
|
||
/** | ||
* @internal for communication within the Neos UI only | ||
*/ | ||
final class NoSiteNodeWasFound extends \Exception | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
/* | ||
* 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. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Neos\Neos\Ui\Application\ReloadNodes; | ||
|
||
use Neos\ContentRepository\Core\ContentRepository; | ||
use Neos\Flow\Annotations as Flow; | ||
use Neos\Flow\Mvc\ActionRequest; | ||
use Neos\Neos\FrontendRouting\NodeAddress; | ||
use Neos\Neos\Ui\Fusion\Helper\NodeInfoHelper; | ||
|
||
/** | ||
* Helper DTO for collections of nodes | ||
* | ||
* @internal for communication within the Neos UI only | ||
*/ | ||
#[Flow\Proxy(false)] | ||
final readonly class NodeMap implements \JsonSerializable | ||
{ | ||
/** @var MinimalNodeForTree[] */ | ||
private array $items; | ||
|
||
public function __construct(MinimalNodeForTree ...$items) | ||
{ | ||
$this->items = $items; | ||
} | ||
|
||
/** | ||
* @param class-string<MinimalNodeForTree> $nodeRepresentationClass | ||
*/ | ||
public static function builder( | ||
string $nodeRepresentationClass, | ||
NodeInfoHelper $nodeInfoHelper, | ||
ActionRequest $actionRequest | ||
): NodeMapBuilder { | ||
return new NodeMapBuilder( | ||
nodeRepresentationClass: $nodeRepresentationClass, | ||
nodeInfoHelper: $nodeInfoHelper, | ||
actionRequest: $actionRequest, | ||
); | ||
} | ||
|
||
/** | ||
* @return \stdClass|(array<string,MinimalNodeForTree>) | ||
*/ | ||
public function jsonSerialize(): mixed | ||
{ | ||
$result = []; | ||
foreach ($this->items as $item) { | ||
$result[$item->getNodeAddressAsString()] = $item; | ||
} | ||
|
||
return $result ? $result : new \stdClass; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
/* | ||
* 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. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Neos\Neos\Ui\Application\ReloadNodes; | ||
|
||
use Neos\ContentRepository\Core\Projection\ContentGraph\Node; | ||
use Neos\Flow\Annotations as Flow; | ||
use Neos\Flow\Mvc\ActionRequest; | ||
use Neos\Neos\Ui\Fusion\Helper\NodeInfoHelper; | ||
|
||
/** | ||
* @internal for communication within the Neos UI only | ||
*/ | ||
#[Flow\Proxy(false)] | ||
final class NodeMapBuilder | ||
{ | ||
/** | ||
* @var MinimalNodeForTree[] | ||
*/ | ||
private array $items; | ||
|
||
/** | ||
* @param class-string<MinimalNodeForTree> $nodeRepresentationClass | ||
*/ | ||
public function __construct( | ||
private readonly string $nodeRepresentationClass, | ||
private readonly NodeInfoHelper $nodeInfoHelper, | ||
private readonly ActionRequest $actionRequest | ||
) { | ||
} | ||
|
||
public function addNode(Node $node): void | ||
{ | ||
$item = $this->nodeRepresentationClass::tryFromNode( | ||
node: $node, | ||
nodeInfoHelper: $this->nodeInfoHelper, | ||
actionRequest: $this->actionRequest | ||
); | ||
|
||
if ($item !== null) { | ||
$this->items[] = $item; | ||
} | ||
} | ||
|
||
public function build(): NodeMap | ||
{ | ||
return new NodeMap(...$this->items); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
/* | ||
* 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. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Neos\Neos\Ui\Application\ReloadNodes; | ||
|
||
use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint; | ||
use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId; | ||
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; | ||
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateIds; | ||
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; | ||
use Neos\Flow\Annotations as Flow; | ||
|
||
/** | ||
* The application layer level query DTO to find all nodes the UI needs | ||
* to refresh its in-memory node cache | ||
* | ||
* @internal for communication within the Neos UI only | ||
*/ | ||
#[Flow\Proxy(false)] | ||
final readonly class ReloadNodesQuery | ||
{ | ||
public function __construct( | ||
public ContentRepositoryId $contentRepositoryId, | ||
public WorkspaceName $workspaceName, | ||
public DimensionSpacePoint $dimensionSpacePoint, | ||
public NodeAggregateId $siteId, | ||
public NodeAggregateId $documentId, | ||
public NodeAggregateIds $ancestorsOfDocumentIds, | ||
public NodeAggregateIds $toggledNodesIds, | ||
public NodeAggregateIds $clipboardNodesIds | ||
) { | ||
} | ||
|
||
/** | ||
* @param array<mixed> $values | ||
*/ | ||
public static function fromArray(array $values): self | ||
{ | ||
return new self( | ||
contentRepositoryId: ContentRepositoryId::fromString($values['contentRepositoryId']), | ||
workspaceName: WorkspaceName::fromString($values['workspaceName']), | ||
dimensionSpacePoint: DimensionSpacePoint::fromLegacyDimensionArray($values['dimensionSpacePoint']), | ||
siteId: NodeAggregateId::fromString($values['siteId']), | ||
documentId: NodeAggregateId::fromString($values['documentId']), | ||
ancestorsOfDocumentIds: NodeAggregateIds::fromArray($values['ancestorsOfDocumentIds']), | ||
toggledNodesIds: NodeAggregateIds::fromArray($values['toggledNodesIds']), | ||
clipboardNodesIds: NodeAggregateIds::fromArray($values['clipboardNodesIds']) | ||
); | ||
} | ||
} |
Oops, something went wrong.