Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Fiori Tree Views towards GA#839

Merged
danjoa merged 8 commits into
mainfrom
fiori-tree-view
Jun 5, 2025
Merged

Fiori Tree Views towards GA#839
danjoa merged 8 commits into
mainfrom
fiori-tree-view

Conversation

@danjoa
Copy link
Copy Markdown
Contributor

@danjoa danjoa commented May 15, 2025

No description provided.

Comment thread fiori/server.js Outdated
// PoC for simplified Fiori Tree Views
const cds = require('@sap/cds/lib')

cds.on('compile.to.edmx', csn => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also for @Aggregation.RecursiveHierarchy?

Copy link
Copy Markdown
Contributor Author

@danjoa danjoa May 15, 2025

Choose a reason for hiding this comment

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

Yes, if we replace that by a simplified shortcut, e.g. like that:

annotate AdminService.Genres with @Fiori.TreeView #GenreHierarchy .via: parent;
annotate AdminService.Genres with @Fiori.TreeView #GenreHierarchy { via: parent };

If there's only one Association to self:

annotate AdminService.Genres with @Fiori.TreeView #GenreHierarchy;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

CoPilot just did that for me in d46956d

@danjoa
Copy link
Copy Markdown
Contributor Author

danjoa commented May 15, 2025

P.S. We can also use the loaded event instead of compile.to.edmx, e.g. in case the latter event is too late in these experiments. The final solution will anyways be baked into the compiler. Reason I started with that is that I wanted us to detect, which parts are required for EDMX only, and which are required in the runtime, or in db.

Comment thread fiori/app/common.cds Outdated
Comment on lines +79 to +81
LimitedDescendantCount : Int16 = null;
LimitedRank : Int16 = null;
DistanceFromRoot : Int16 = null;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Here I also tried changing Int64 types to Int16 as discussed → seems to work end-to-end for Fiori clients.

@danjoa
Copy link
Copy Markdown
Contributor Author

danjoa commented May 15, 2025

Leftover: We also need to check and document how to do Value Helps:

annotate AdminService.Genres with @UI: {
PresentationVariant #VH: {
$Type : 'UI.PresentationVariantType',
Visualizations : ['@UI.LineItem'],
RecursiveHierarchyQualifier: 'GenreHierarchy'
},
LineItem : [{
$Type: 'UI.DataField',
Value: name,
Label :'{i18n>Name}'
}],
};

@danjoa danjoa marked this pull request as ready for review June 5, 2025 13:39
@danjoa danjoa merged commit 600afb7 into main Jun 5, 2025
5 checks passed
@danjoa danjoa deleted the fiori-tree-view branch June 5, 2025 13:39
Comment on lines +24 to +42
Capabilities.FilterRestrictions.NonFilterableProperties: [
'LimitedDescendantCount',
'DistanceFromRoot',
'DrillState',
'LimitedRank'
],
// Disallow sorting on these properties from Fiori UIs
Capabilities.SortRestrictions.NonSortableProperties : [
'LimitedDescendantCount',
'DistanceFromRoot',
'DrillState',
'LimitedRank'
],
) columns { // Ensure we can query these fields from database
null as LimitedDescendantCount : Int16,
null as DistanceFromRoot : Int16,
null as DrillState : String,
null as LimitedRank : Int16,
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We should capture these as a reusable aspect. Unfortunately, an aspect can't have virtual or computed elements.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants