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: Separate properties and references in clientEval #3813

Open
wants to merge 5 commits into
base: 9.0
Choose a base branch
from
Open
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
19 changes: 16 additions & 3 deletions Classes/Domain/Service/NodePropertyConverterService.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private function getProperty(Node $node, string $propertyName): mixed
}

/**
* Get all properties and references stuff reduced to simple type (no objects) representations in an array
* Get all properties information reduced to simple type (no objects) representations in an array
*
* @param Node $node
* @return array<string,mixed>
Expand All @@ -181,10 +181,23 @@ public function getPropertiesArray(Node $node)

$properties[$propertyName] = $this->getProperty($node, $propertyName);
}
return $properties;
}

/**
* Get all references information reduced to simple type (no objects) representations in an array
*
* @param Node $node
* @return array<string,mixed>
*/
public function getReferencesArray(Node $node)
{
$references = [];

foreach ($this->getNodeType($node)->getReferences() as $referenceName => $_) {
$properties[$referenceName] = $this->getReference($node, $referenceName);
$references[$referenceName] = $this->getReference($node, $referenceName);
}
return $properties;
return $references;
}

/**
Expand Down
1 change: 1 addition & 0 deletions Classes/Fusion/Helper/NodeInfoHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ public function renderNodeWithPropertiesAndChildrenInformation(

$nodeInfo = $this->getBasicNodeInformation($node);
$nodeInfo['properties'] = $this->nodePropertyConverterService->getPropertiesArray($node);
$nodeInfo['references'] = $this->nodePropertyConverterService->getReferencesArray($node);
$nodeInfo['tags'] = $node->tags;
$nodeInfo['isFullyLoaded'] = true;

Expand Down
27 changes: 26 additions & 1 deletion packages/neos-ts-interfaces/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ export interface Node {
properties: {
[propName: string]: any;
};
references: {
[referenceName: string]: any;
};
isFullyLoaded: boolean;
uri: string;
parent: NodeContextPath;
Expand Down Expand Up @@ -142,7 +145,26 @@ export interface PropertyConfiguration {
[propName: string]: ValidatorConfiguration | undefined;
};
}

export interface ReferencesConfiguration {
type?: string;
ui?: {
label?: string;
reloadIfChanged?: boolean;
inspector?: {
hidden?: boolean;
editor?: string;
editorOptions?: {
[propName: string]: any;
}
group?: string;
position?: number | string;
};
help?: {
message?: string;
thumbnail?: string;
};
};
}
export interface NodeType {
name?: string;
superTypes: {
Expand Down Expand Up @@ -215,6 +237,9 @@ export interface NodeType {
properties?: {
[propName: string]: PropertyConfiguration | undefined;
};
references?: {
[referenceName: string]: ReferencesConfiguration | undefined;
};
}

//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ export default class NodeTypesRegistry extends SynchronousRegistry<NodeType> {
const _properties = Object.values(withId(nodeType.properties || {}));
const properties = positionalArraySorter(_properties, 'position', 'id');

const _references = Object.values(withId(nodeType.references || {}));
const references = positionalArraySorter(_references, 'position', 'id');

const viewConfiguration = {
tabs: tabs.map(tab => ({
...tab,
Expand All @@ -215,6 +218,19 @@ export default class NodeTypesRegistry extends SynchronousRegistry<NodeType> {
helpThumbnail: property.ui?.help?.thumbnail
})
),
...references.filter(p => p.ui?.inspector?.group === group.id)
.map(reference => ({
type: 'editor',
id: reference.id,
label: reference.ui?.label,
editor: reference.ui?.inspector?.editor,
editorOptions: reference.ui?.inspector?.editorOptions,
position: reference.ui?.inspector?.position,
hidden: reference.ui?.inspector?.hidden,
helpMessage: reference.ui?.help?.message,
helpThumbnail: reference.ui?.help?.thumbnail
})
),
...views.filter(v => v.group === group.id)
.map(property => ({
type: 'view',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ export default class InspectorEditorEnvelope extends PureComponent {
//
// nodeType needs to be read directly from node
//
const sourceValueRaw = id === '_nodeType' ? node?.nodeType : node?.properties?.[id];
const sourceValue = sourceValueRaw;
const sourceValue = id === '_nodeType' ? node?.nodeType : (node?.references?.[id] ? node?.references?.[id] : node?.properties?.[id]);
Copy link
Member

Choose a reason for hiding this comment

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

its a bit random that the source value is fetched here inside the component and not from the outside ... are there other places like this?

const transientValue = transientValueRaw;

return (
Expand Down
Loading