Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

!!!FEATURE: Reform foundation and boot process of the UI #3682

Merged
merged 27 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
72bd767
TASK: Load head scripts using `<script defer/>`
grebaldi Jan 8, 2024
966fe6a
TASK: Refactor the UI boot process
grebaldi Jan 8, 2024
a7992e2
TASK: Remove `discover` function from utility-helpers package
grebaldi Jan 8, 2024
a0e45c2
TASK: Remove `delay` function from utility-helpers package
grebaldi Jan 8, 2024
fc566d9
TASK: JSON.parse the initial data for the boot process...
grebaldi Jan 10, 2024
6c8ad06
TASK: Refactor fatal initlization error handling
grebaldi Jan 10, 2024
6ecf5e6
TASK: Group all initial data variables into a single view variable
grebaldi Jan 10, 2024
a2ec91b
TASK: Turn SplashScreen into a Fusion Component
grebaldi Jan 10, 2024
df20bf0
TASK: Remove `data-first-tab` attribute from #appContainer
grebaldi Jan 10, 2024
7a71ee6
TASK: Move fusion declaration of initial data into a separate prototype
grebaldi Jan 10, 2024
0e2a69c
TASK: Move fusion declaration of head stylesheets into a separate pro…
grebaldi Jan 10, 2024
05ce39d
TASK: Move fusion declaration of head icons into a separate prototype
grebaldi Jan 10, 2024
d515da3
TASK: Move fusion declaration of headScripts into a separate prototype
grebaldi Jan 10, 2024
2525214
FEATURE: Introduce `Neos.Neos.Ui:Application` prototype
grebaldi Jan 10, 2024
e0590e6
TASK: Use the `Neos.Neos.Ui:Application` prototype to render the UI
grebaldi Jan 10, 2024
6286533
TASK: Remove the `Backend/Index.html` Fluid template
grebaldi Jan 10, 2024
61559f3
TASK: Make fusion includes local to the prototypes that use them
grebaldi Jan 10, 2024
8875c24
TASK: Refactor controller to not use static fusion path
daniellienert Jul 5, 2021
85259f7
!!!FEATURE: Introduce `ApplicationView` to replace Fusion for bootstr…
grebaldi Jan 22, 2024
218a42c
TASK: Remove all backend-related Fusion code
grebaldi Jan 22, 2024
e092605
TASK: Remove `@neos/neos-ui/System/BOOT` redux action + dispatch
grebaldi Jan 22, 2024
4325fb0
TASK: Prevent duplication of `defer` attribute on `<script/>`-includes
grebaldi Jan 22, 2024
ae1e7ba
TASK: `terminateDueToFatalInitializationError` throw directly if no d…
mhsdesign Jan 23, 2024
4918ae2
BUGFIX: Avoid rendering unwanted variables in the view by scoping eve…
mhsdesign Jan 23, 2024
148e851
BUGFIX: Hide first level menus if `hideInMenu` set
mhsdesign Jan 23, 2024
d36a006
TASK: Move Providers to `InitialData` namespace
mhsdesign Jan 30, 2024
ba8cf91
TASK: Remove Views.yaml in favour of $defaultViewObjectName
mhsdesign Feb 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading