Skip to content

Commit

Permalink
Merge pull request #3682 from neos/feature/multi-app/01-foundation
Browse files Browse the repository at this point in the history
!!!FEATURE: Reform foundation and boot process of the UI
  • Loading branch information
mhsdesign authored Feb 2, 2024
2 parents 841c42a + ba8cf91 commit 1575ec0
Show file tree
Hide file tree
Showing 35 changed files with 1,360 additions and 698 deletions.
106 changes: 57 additions & 49 deletions Classes/Controller/BackendController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,37 @@
* source code.
*/

use Neos\ContentRepository\Core\NodeType\NodeTypeName;
use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Mvc\Controller\ActionController;
use Neos\Flow\Mvc\View\ViewInterface;
use Neos\Flow\Persistence\PersistenceManagerInterface;
use Neos\Flow\ResourceManagement\ResourceManager;
use Neos\Flow\Security\Context;
use Neos\Flow\Session\SessionInterface;
use Neos\Fusion\View\FusionView;
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;
use Neos\Neos\Service\BackendRedirectionService;
use Neos\Neos\Service\UserService;
use Neos\Neos\Ui\Domain\Service\StyleAndJavascriptInclusionService;
use Neos\Neos\Ui\Service\NodeClipboard;
use Neos\Neos\Ui\Domain\InitialData\ConfigurationProviderInterface;
use Neos\Neos\Ui\Domain\InitialData\FrontendConfigurationProviderInterface;
use Neos\Neos\Ui\Domain\InitialData\InitialStateProviderInterface;
use Neos\Neos\Ui\Domain\InitialData\MenuProviderInterface;
use Neos\Neos\Ui\Domain\InitialData\NodeTypeGroupsAndRolesProviderInterface;
use Neos\Neos\Ui\Domain\InitialData\RoutesProviderInterface;
use Neos\Neos\Ui\Presentation\ApplicationView;

class BackendController extends ActionController
{
/**
* @var FusionView
* @var ApplicationView
*/
protected $view;

protected $defaultViewObjectName = ApplicationView::class;

/**
* @Flow\Inject
* @var UserService
Expand Down Expand Up @@ -74,57 +75,51 @@ class BackendController extends ActionController

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

/**
* @Flow\Inject
* @var MenuHelper
* @var Context
*/
protected $menuHelper;
protected $securityContext;

/**
* @Flow\Inject(lazy=false)
* @var BackendRedirectionService
* @Flow\Inject
* @var ConfigurationProviderInterface
*/
protected $backendRedirectionService;
protected $configurationProvider;

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

/**
* @Flow\Inject
* @var Context
* @var FrontendConfigurationProviderInterface
*/
protected $securityContext;
protected $frontendConfigurationProvider;

/**
* @Flow\Inject
* @var StyleAndJavascriptInclusionService
* @var NodeTypeGroupsAndRolesProviderInterface
*/
protected $styleAndJavascriptInclusionService;
protected $nodeTypeGroupsAndRolesProvider;

/**
* @Flow\Inject
* @var NodeClipboard
* @var MenuProviderInterface
*/
protected $clipboard;
protected $menuProvider;

/**
* @Flow\InjectConfiguration(package="Neos.Neos.Ui", path="splashScreen.partial")
* @var string
* @Flow\Inject
* @var InitialStateProviderInterface
*/
protected $splashScreenPartial;

public function initializeView(ViewInterface $view)
{
/** @var FusionView $view */
$view->setFusionPath('backend');
}
protected $initialStateProvider;

/**
* Displays the backend interface
Expand Down Expand Up @@ -187,23 +182,36 @@ public function indexAction(string $node = null)
$node = $subgraph->findNodeById($nodeAddress->nodeAggregateId);
}

$this->view->assign('user', $user);
$this->view->assign('documentNode', $node);
$this->view->assign('site', $siteNode);
$this->view->assign('clipboardNodes', $this->clipboard->getSerializedNodeAddresses());
$this->view->assign('clipboardMode', $this->clipboard->getMode());
$this->view->assign('headScripts', $this->styleAndJavascriptInclusionService->getHeadScripts());
$this->view->assign('headStylesheets', $this->styleAndJavascriptInclusionService->getHeadStylesheets());
$this->view->assign('splashScreenPartial', $this->splashScreenPartial);
$this->view->assign('sitesForMenu', $this->menuHelper->buildSiteList($this->getControllerContext()));
$this->view->assign('modulesForMenu', $this->menuHelper->buildModuleList($this->getControllerContext()));
$this->view->assign('contentRepositoryId', $siteDetectionResult->contentRepositoryId);

$this->view->assignMultiple([
'subgraph' => $subgraph
$this->view->setOption('title', 'Neos CMS');
$this->view->assign('initialData', [
'configuration' =>
$this->configurationProvider->getConfiguration(
contentRepository: $contentRepository,
uriBuilder: $this->controllerContext->getUriBuilder(),
),
'routes' =>
$this->routesProvider->getRoutes(
uriBuilder: $this->controllerContext->getUriBuilder()
),
'frontendConfiguration' =>
$this->frontendConfigurationProvider->getFrontendConfiguration(
controllerContext: $this->controllerContext,
),
'nodeTypes' =>
$this->nodeTypeGroupsAndRolesProvider->getNodeTypes(),
'menu' =>
$this->menuProvider->getMenu(
controllerContext: $this->controllerContext,
),
'initialState' =>
$this->initialStateProvider->getInitialState(
controllerContext: $this->controllerContext,
contentRepositoryId: $siteDetectionResult->contentRepositoryId,
documentNode: $node,
site: $siteNode,
user: $user,
),
]);

$this->view->assign('interfaceLanguage', $this->userService->getInterfaceLanguage());
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?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\Domain\InitialData;

/**
* Retrieves the current version identifier for the configuration cache so it
* can be used as a cache busting parameter for resources fetched on client
* side.
*
* @internal
*/
interface CacheConfigurationVersionProviderInterface
{
public function getCacheConfigurationVersion(): string;
}
37 changes: 37 additions & 0 deletions Classes/Domain/InitialData/ConfigurationProviderInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?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\Domain\InitialData;

use Neos\ContentRepository\Core\ContentRepository;
use Neos\Flow\Mvc\Routing\UriBuilder;

/**
* Retrieves the `nodeTree` and `structureTree` segments from
* `Neos.Neos.userInterface.navigateComponent` settings,
* `allowedTargetWorkspaces` from the ContentRepository's `WorkspaceService`
* as well as the `nodeTypeSchema` and `translations` endpoints.
*
* @internal
*/
interface ConfigurationProviderInterface
{
/**
* @return array{nodeTree:mixed,structureTree:mixed,allowedTargetWorkspaces:mixed,endpoints:array{nodeTypeSchema:string,translations:string}}
*/
public function getConfiguration(
ContentRepository $contentRepository,
UriBuilder $uriBuilder,
): array;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?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\Domain\InitialData;

use Neos\Flow\Mvc\Controller\ControllerContext;

/**
* Reads and preprocesses the `Neos.Neos.Ui.frontendConfiguration` settings
* that are mostly used by third-party plugins to share data between server
* and client.
*
* @internal
*/
interface FrontendConfigurationProviderInterface
{
/** @return array<mixed> */
public function getFrontendConfiguration(
ControllerContext $controllerContext
): array;
}
38 changes: 38 additions & 0 deletions Classes/Domain/InitialData/InitialStateProviderInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?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\Domain\InitialData;

use Neos\ContentRepository\Core\Factory\ContentRepositoryId;
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use Neos\Flow\Mvc\Controller\ControllerContext;
use Neos\Neos\Domain\Model\User;

/**
* Reads and preprocesses the `Neos.Neos.Ui.initialState` settings that are
* used to hydrate the UI's redux store.
*
* @internal
*/
interface InitialStateProviderInterface
{
/** @return array<mixed> */
public function getInitialState(
ControllerContext $controllerContext,
ContentRepositoryId $contentRepositoryId,
?Node $documentNode,
?Node $site,
User $user,
): array;
}
31 changes: 31 additions & 0 deletions Classes/Domain/InitialData/MenuProviderInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?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\Domain\InitialData;

use Neos\Flow\Mvc\Controller\ControllerContext;

/**
* Retrieves all data needed to render the main burger menu located in the
* top left corner of the UI.
*
* @internal
*/
interface MenuProviderInterface
{
/**
* @return array<int,array{label:string,icon:string,uri:string,target:string,children:array<int,array{icon:string,label:string,uri:string,position?:string,isActive:bool,target:string,skipI18n:bool}>}>
*/
public function getMenu(ControllerContext $controllerContext): array;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?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\Domain\InitialData;

/**
* Retrieves information about node type roles and node type groups.
*
* Roles are a dedicated UI-concept that is meant to distinguish between
* document, content and collection nodes.
* Groups refer the grouping of node types in the creation dialog.
*
* @internal
*/
interface NodeTypeGroupsAndRolesProviderInterface
{
/**
* @return array{roles:mixed,groups:mixed}
*/
public function getNodeTypes(): array;
}
Loading

0 comments on commit 1575ec0

Please sign in to comment.