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: Mark inherited disabled nodes in document and content tree #3902

Draft
wants to merge 4 commits into
base: 9.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
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' =>
Comment on lines 105 to 108
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all this stuff is slightly getting more and more bloated ... i dont like that :D maybe we should do something similar to what we have done with other data: use bit masks ... this is especially useful to denote that there is likely of all the things only one state that we really want to highlight in the ui.

export enum TypeOfChange {
NODE_HAS_BEEN_CREATED = 0b0001,
NODE_HAS_BEEN_CHANGED = 0b0010,
NODE_HAS_BEEN_MOVED = 0b0100,
NODE_HAS_BEEN_DELETED = 0b1000
}

aside from this the chnage looks good :D Code wise it looks fine and should work ... is there anything missing than to disucss if we like to keep introducing data bloat :D ?

$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 @@ -10,6 +10,7 @@ exports[`<Icon/> should render correctly. 1`] = `
Object {
"icon": "iconClassName",
"icon--big": "bigClassName",
"icon--color-contrastDark": "color-contrastDarkClassName",
"icon--color-error": "color-errorClassName",
"icon--color-primaryBlue": "color-primaryBlueClassName",
"icon--color-warn": "color-warnClassName",
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
3 changes: 2 additions & 1 deletion packages/react-ui-components/src/Icon/icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {defaultProps} from './iconDefaultProps';

type IconSize = 'xs' | 'sm' | 'lg' | '2x' | '3x';
type IconPadding = 'none' | 'left' | 'right';
type IconColor = 'default' | 'warn' | 'error' | 'primaryBlue';
type IconColor = 'default' | 'warn' | 'error' | 'primaryBlue' | 'contrastDark';

export interface IconTheme {
readonly icon: string;
Expand All @@ -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
Loading