Skip to content

Commit

Permalink
FEATURE: Mark inherited disabled nodes in document and content tree
Browse files Browse the repository at this point in the history
  • Loading branch information
dlubitz committed Dec 11, 2024
1 parent c964e09 commit 0e96ed4
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 7 deletions.
15 changes: 9 additions & 6 deletions Classes/Fusion/Helper/NodeInfoHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public function renderNodeWithMinimalPropertiesAndChildrenInformation(
// ensure _isHidden is sent to hidden nodes are correctly shown in the tree.
// TODO: we should export this correctly named, but that needs changes throughout the JS code as well.
'_hidden' => $node->tags->withoutInherited()->contain(SubtreeTag::disabled()),
'_hiddenByAncestors' => $node->tags->onlyInherited()->contain(SubtreeTag::disabled()),
'_hiddenInIndex' => $node->getProperty('hiddenInMenu'),
'_hasTimeableNodeVisibility' =>
$node->getProperty('enableAfterDateTime') instanceof \DateTimeInterface
Expand Down Expand Up @@ -145,6 +146,14 @@ public function renderNodeWithPropertiesAndChildrenInformation(
$nodeInfo['properties'] = $this->nodePropertyConverterService->getPropertiesArray($node);
$nodeInfo['tags'] = $node->tags;
$nodeInfo['isFullyLoaded'] = true;
$nodeInfo['properties'] = array_merge($nodeInfo['properties'], [
// TODO: we should export this correctly named, but that needs changes throughout the JS code as well.
'_hidden' => $node->tags->withoutInherited()->contain(SubtreeTag::disabled()),
'_hiddenByAncestors' => $node->tags->onlyInherited()->contain(SubtreeTag::disabled()),
'_hasTimeableNodeVisibility' =>
$node->getProperty('enableAfterDateTime') instanceof \DateTimeInterface
|| $node->getProperty('disableAfterDateTime') instanceof \DateTimeInterface,
]);

if ($actionRequest !== null) {
$nodeInfo = array_merge($nodeInfo, $this->getUriInformation($node, $actionRequest));
Expand Down Expand Up @@ -217,7 +226,6 @@ protected function getBasicNodeInformation(Node $node): array
*/
protected function renderChildrenInformation(Node $node, string $nodeTypeFilterString): array
{
$contentRepository = $this->contentRepositoryRegistry->get($node->contentRepositoryId);
$subgraph = $this->contentRepositoryRegistry->subgraphForNode($node);

$documentChildNodes = $subgraph->findChildNodes(
Expand All @@ -235,7 +243,6 @@ protected function renderChildrenInformation(Node $node, string $nodeTypeFilterS

$infos = [];
foreach ($childNodes as $childNode) {
$contentRepository = $this->contentRepositoryRegistry->get($childNode->contentRepositoryId);
$infos[] = [
'contextPath' => NodeAddress::fromNode($childNode)->toJson(),
'nodeType' => $childNode->nodeTypeName->value
Expand Down Expand Up @@ -329,9 +336,6 @@ public function defaultNodesForBackend(
Node $documentNode,
ActionRequest $actionRequest
): array {
// does not support multiple CRs here yet
$contentRepository = $this->contentRepositoryRegistry->get($site->contentRepositoryId);

return [
(NodeAddress::fromNode($site)->toJson())
=> $this->renderNodeWithPropertiesAndChildrenInformation($site, $actionRequest),
Expand Down Expand Up @@ -404,7 +408,6 @@ protected function buildContentChildNodeFilterString(): string

public function serializedNodeAddress(Node $node): string
{
$contentRepository = $this->contentRepositoryRegistry->get($node->contentRepositoryId);
return NodeAddress::fromNode($node)->toJson();
}

Expand Down
11 changes: 11 additions & 0 deletions packages/neos-ui/src/Containers/LeftSideBar/NodeTree/Node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ export default class Node extends PureComponent {
const {node} = this.props;

const isDisabled = node?.properties?._hidden;
const isDisabledByAncestors = node?.properties?._hiddenByAncestors;
const hasTimeableNodeVisibility = node?.properties?._hasTimeableNodeVisibility;

if (hasTimeableNodeVisibility) {
Expand All @@ -192,6 +193,16 @@ export default class Node extends PureComponent {
);
}

if (isDisabledByAncestors) {
return (
<span className="fa-layers fa-fw">
<Icon icon={this.getIcon()} />
<Icon icon="circle" color="contrastDark" transform="shrink-3 down-6 right-4" />
<Icon icon="times" transform="shrink-7 down-6 right-4" />
</span>
);
}

return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe('<FontAwesomeIcon/>', () => {
'icon--big': 'bigClassName',
'icon--color-error': 'color-errorClassName',
'icon--color-primaryBlue': 'color-primaryBlueClassName',
'icon--color-contrastDark': 'color-contrastDarkClassName',
'icon--color-warn': 'color-warnClassName',
'icon--paddedLeft': 'paddedLeftClassName',
'icon--paddedRight': 'paddedRightClassName',
Expand Down
3 changes: 2 additions & 1 deletion packages/react-ui-components/src/Icon/fontAwesomeIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class FontAwesomeIcon extends PureComponent<IconProps> {
[theme!['icon--paddedRight']]: padded === 'right',
[theme!['icon--color-warn']]: color === 'warn',
[theme!['icon--color-error']]: color === 'error',
[theme!['icon--color-primaryBlue']]: color === 'primaryBlue'
[theme!['icon--color-primaryBlue']]: color === 'primaryBlue',
[theme!['icon--color-contrastDark']]: color === 'contrastDark'
}
);

Expand Down
1 change: 1 addition & 0 deletions packages/react-ui-components/src/Icon/icon.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ describe('<Icon/>', () => {
'icon--big': 'bigClassName',
'icon--color-error': 'color-errorClassName',
'icon--color-primaryBlue': 'color-primaryBlueClassName',
'icon--color-contrastDark': 'color-contrastDarkClassName',
'icon--color-warn': 'color-warnClassName',
'icon--paddedLeft': 'paddedLeftClassName',
'icon--paddedRight': 'paddedRightClassName',
Expand Down
1 change: 1 addition & 0 deletions packages/react-ui-components/src/Icon/icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface IconTheme {
readonly 'icon--color-warn': string;
readonly 'icon--color-error': string;
readonly 'icon--color-primaryBlue': string;
readonly 'icon--color-contrastDark': string;
}

export interface IconProps extends Omit<FontAwesomeIconProps, 'icon' | 'ref'> {
Expand Down
1 change: 1 addition & 0 deletions packages/react-ui-components/src/Icon/resourceIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class ResourceIcon extends PureComponent<ResourceIconProps> {
[theme!['icon--color-warn']]: color === 'warn',
[theme!['icon--color-error']]: color === 'error',
[theme!['icon--color-primaryBlue']]: color === 'primaryBlue',
[theme!['icon--color-contrastDark']]: color === 'contrastDark',
[theme!['icon--huge']]: size === '3x',
[theme!['icon--large']]: size === '2x',
[theme!['icon--big']]: size === 'lg',
Expand Down
4 changes: 4 additions & 0 deletions packages/react-ui-components/src/Icon/style.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
color: var(--colors-PrimaryBlue);
}

.icon--color-contrastDark {
color: var(--colors-ContrastDark)
}

.icon--huge {
& svg {
height: 3em;
Expand Down

0 comments on commit 0e96ed4

Please sign in to comment.