Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/9.0' into 90/timeable-node-visib…
Browse files Browse the repository at this point in the history
…ility
  • Loading branch information
dlubitz committed Feb 11, 2024
2 parents 5ab9c4f + cb2b966 commit 22be056
Show file tree
Hide file tree
Showing 155 changed files with 1,810 additions and 870 deletions.
56 changes: 45 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ aliases:
jobs:
checkout:
docker:
- image: cimg/node:16.17-browsers
- image: cimg/node:20.9-browsers
environment:
FLOW_CONTEXT: Production
steps:
Expand Down Expand Up @@ -108,17 +108,48 @@ jobs:

- run: curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
- run: chmod +x ~/.nvm/nvm.sh
- run: |
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
cd /home/circleci/app/Packages/Application/Neos.Neos.Ui
nvm install
nvm use
echo 127.0.0.1 onedimension.localhost | sudo tee -a /etc/hosts
echo 127.0.0.1 twodimensions.localhost | sudo tee -a /etc/hosts
make test-e2e-saucelabs
- run:
no_output_timeout: 20m
command: |
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
cd /home/circleci/app/Packages/Application/Neos.Neos.Ui
nvm install
nvm use
echo 127.0.0.1 onedimension.localhost | sudo tee -a /etc/hosts
echo 127.0.0.1 twodimensions.localhost | sudo tee -a /etc/hosts
make test-e2e-saucelabs > /home/circleci/app/Data/Logs/AcceptanceTesting.log
- store_artifacts:
path: /home/circleci/app/Data/Logs
- persist_to_workspace:
root: /home/circleci/app/Data/Logs
paths:
- .

post-acceptance-tests-recordings:
environment:
FLOW_CONTEXT: Production
docker:
- image: cimg/php:8.2-node

steps:
- attach_workspace:
at: /home/circleci/app
- run:
name: Install GitHub CLI and jq
command: |
type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
- run:
name: Run Script
command: |
JOB_IDS=$(cat /home/circleci/app/AcceptanceTesting.log | grep -o 'https://app.saucelabs.com/tests/[a-zA-Z0-9]\+' | sed 's/.*\///')
echo "Job IDs: $JOB_IDS"
/home/circleci/app/Build/comment-acceptance-tests.sh "$JOB_IDS" "$(basename "$CIRCLE_PULL_REQUEST")"
php-unittests:
environment:
Expand Down Expand Up @@ -152,7 +183,7 @@ jobs:
- 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
composer run lint:phpstan
workflows:
version: 2
Expand All @@ -172,6 +203,9 @@ workflows:
- e2e:
requires:
- build_flow_app
- post-acceptance-tests-recordings:
requires:
- e2e
- php-unittests:
requires:
- build_flow_app
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.16
20.9
71 changes: 71 additions & 0 deletions Build/comment-acceptance-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/bin/bash

# Check if the required parameters are provided
if [ $# -ne 2 ]; then
echo "Usage: $0 <JobID> <PullRequestNumber>"
exit 1
fi

# If no comment with recordings exists, create a new comment
# create a function names createNewComment with the comment body as parameter

function generateCommentBody() {
# Split the JobID string into an array
IFS=$'\n' read -r -d '' -a jobIdArray <<< "$jobIds"
echo "Generate comment message for following JobIDs: ${jobIdArray[@]}"

# Iterate over each JobID in the array
for i in ${!jobIdArray[@]}; do
iterator=$(($i+1))
jobId="${jobIdArray[$i]}"
link="[Recording $iterator](https://app.saucelabs.com/rest/v1/jobs/$jobId/video.mp4)"
videoRecordingsLinks+="\n* $link"
done

# Construct the comment with the latest acceptance test recordings
# Construct the comment with the latest acceptance test recordings
if [ -n "$videoRecordingsLinks" ]; then
commentBody="🎥 **End-to-End Test Recordings**\n\n$videoRecordingsLinks\n\nThese videos demonstrate the end-to-end tests for the changes in this pull request."
else
# empty comment body to prevent a comment without recordings
commentBody=""
fi
}

# Check if a comment with recordings already exists
function getExistingComment() {
echo "Checking if a comment with recordings already exists..."
existingComment=$(gh pr view --repo neos/neos-ui $pullRequestNumber --json comments | jq -r ".comments[] | select( .body | contains(\"End-to-End Test Recordings\"))")
}

function createComment() {
echo "Creating new comment..."
gh pr comment --repo neos/neos-ui $pullRequestNumber --body "$(printf "$commentBody")"
}

# If a comment with recordings exists, update the existing comment
function updateComment() {
# Note: The gh cli does not support editing comments yet, so we have to use the GitHub API directly
echo "Updating existing comment..."
commentUri=$(echo "$existingComment" | jq -r ".url")
commentId=$(echo "$commentUri" | awk -F'#issuecomment-' '{print $2}')
jsonBody=$(jq -n --arg str "$(printf "$commentBody")" '{"body": $str}')

curl -s -H "Authorization: token $GH_TOKEN" \
-X PATCH -d "$jsonBody" \
"https://api.github.com/repos/neos/neos-ui/issues/comments/$commentId"
}

jobIds=$1
pullRequestNumber=$2
generateCommentBody
getExistingComment

echo "Existing comment: $existingComment"
if [ -n "$existingComment" ]; then
updateComment
else
createComment
fi

echo "Comment added to Pull Request #$pullRequestNumber with the latest acceptance test recordings."
1 change: 1 addition & 0 deletions Classes/ContentRepository/Service/WorkspaceService.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use Neos\Neos\Utility\NodeTypeWithFallbackProvider;

/**
* @internal
* @Flow\Scope("singleton")
*/
class WorkspaceService
Expand Down
111 changes: 61 additions & 50 deletions Classes/Controller/BackendController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,40 @@
* 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;

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

protected $defaultViewObjectName = ApplicationView::class;

/**
* @Flow\Inject
* @var UserService
Expand Down Expand Up @@ -74,57 +78,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 +185,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
1 change: 1 addition & 0 deletions Classes/Controller/BackendControllerInternals.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

/**
* @deprecated really un-nice :D
* @internal
*/
class BackendControllerInternals implements ContentRepositoryServiceInterface
{
Expand Down
1 change: 1 addition & 0 deletions Classes/Controller/BackendControllerInternalsFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
/**
* @deprecated
* @implements ContentRepositoryServiceFactoryInterface<BackendControllerInternals>
* @internal
*/
class BackendControllerInternalsFactory implements ContentRepositoryServiceFactoryInterface
{
Expand Down
3 changes: 3 additions & 0 deletions Classes/Controller/BackendServiceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
use Neos\Neos\Ui\TypeConverter\ChangeCollectionConverter;
use Neos\Neos\Utility\NodeUriPathSegmentGenerator;

/**
* @internal
*/
class BackendServiceController extends ActionController
{
use TranslationTrait;
Expand Down
1 change: 1 addition & 0 deletions Classes/Controller/TranslationTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

/**
* A trait to do easy backend module translations
* @internal
*/
trait TranslationTrait
{
Expand Down
Loading

0 comments on commit 22be056

Please sign in to comment.