review fixes

This commit is contained in:
D070615
2025-03-31 13:31:08 +02:00
parent d9ae2de250
commit d56806957e
7 changed files with 80 additions and 83 deletions

View File

@@ -2,4 +2,5 @@ using { sap.capire.bookshop as my } from '../db/schema';
service AdminService @(path:'/admin') {
entity Authors as projection on my.Authors;
entity Books as projection on my.Books;
entity Genres as projection on my.Genres;
}

View File

@@ -1,4 +1,4 @@
using { AdminService } from '../services';
using { AdminService } from '@capire/bookstore';
using from '../common'; // to help UI linter get the complete annotations
@@ -50,7 +50,7 @@ annotate AdminService.Books with {
genre @(Common: {
Label : 'Genre',
ValueList: {
CollectionPath : 'GenreHierarchy',
CollectionPath : 'Genres',
Parameters : [
{
$Type : 'Common.ValueListParameterDisplayOnly',
@@ -67,7 +67,7 @@ annotate AdminService.Books with {
});
}
annotate AdminService.GenreHierarchy with @UI: {
annotate AdminService.Genres with @UI: {
PresentationVariant #VH: {
$Type : 'UI.PresentationVariantType',
Visualizations : ['@UI.LineItem'],
@@ -81,7 +81,7 @@ annotate AdminService.GenreHierarchy with @UI: {
};
// Hide ID because of the ValueHelp
annotate AdminService.GenreHierarchy with {
annotate AdminService.Genres with {
ID @UI.Hidden;
};

View File

@@ -69,6 +69,63 @@ annotate my.Books with {
image @title: '{i18n>Image}';
}
////////////////////////////////////////////////////////////////////////////
//
// Computed Fields for Tree Tables
//
aspect Hierarchy {
LimitedDescendantCount : Integer64 = null;
DistanceFromRoot : Integer64 = null;
DrillState : String = null;
Matched : Boolean = null;
MatchedDescendantCount : Integer64 = null;
LimitedRank : Integer64 = null;
}
annotate Hierarchy with @Capabilities.FilterRestrictions.NonFilterableProperties: [
'LimitedDescendantCount',
'DistanceFromRoot',
'DrillState',
'Matched',
'MatchedDescendantCount',
'LimitedRank'
];
annotate Hierarchy with @Capabilities.SortRestrictions.NonSortableProperties: [
'LimitedDescendantCount',
'DistanceFromRoot',
'DrillState',
'Matched',
'MatchedDescendantCount',
'LimitedRank'
];
extend my.Genres with Hierarchy;
////////////////////////////////////////////////////////////////////////////
//
// Genres Tree Table Annotations
//
annotate my.Genres with @Aggregation.RecursiveHierarchy #GenreHierarchy: {
$Type : 'Aggregation.RecursiveHierarchyType',
NodeProperty : ID, // identifies a node
ParentNavigationProperty: parent // navigates to a node's parent
};
annotate my.Genres with @Hierarchy.RecursiveHierarchy #GenreHierarchy: {
$Type : 'Hierarchy.RecursiveHierarchyType',
LimitedDescendantCount: LimitedDescendantCount,
DistanceFromRoot : DistanceFromRoot,
DrillState : DrillState,
Matched : Matched,
MatchedDescendantCount: MatchedDescendantCount,
LimitedRank : LimitedRank
};
annotate my.Genres with @(
readonly,
cds.search: {name}
);
////////////////////////////////////////////////////////////////////////////
//
// Genres List
@@ -94,12 +151,7 @@ annotate my.Genres with @(UI : {
TypeNamePlural : '{i18n>Genres}',
Title : { Value: name },
Description : { Value: ID }
},
Facets : [{
$Type : 'UI.ReferenceFacet',
Label : '{i18n>SubGenres}',
Target : 'children/@UI.LineItem'
}, ],
}
});
////////////////////////////////////////////////////////////////////////////

View File

@@ -1 +1,3 @@
/*
All annotations needed for UI5 Tree Table View are located in '../common'
*/

View File

@@ -24,7 +24,7 @@
"parameters": {},
"additionalParameters": "allowed"
},
"semanticObject": "GenreHierarchy",
"semanticObject": "Genres",
"action": "display"
}
}
@@ -61,27 +61,27 @@
"routes": [
{
"pattern": ":?query:",
"name": "GenreHierarchyList",
"target": "GenreHierarchyList"
"name": "GenresList",
"target": "GenresList"
},
{
"pattern": "GenreHierarchy({key}):?query:",
"name": "GenreHierarchyDetails",
"target": "GenreHierarchyDetails"
"pattern": "Genres({key}):?query:",
"name": "GenresDetails",
"target": "GenresDetails"
}
],
"targets": {
"GenreHierarchyList": {
"GenresList": {
"type": "Component",
"id": "GenreHierarchyList",
"id": "GenresList",
"name": "sap.fe.templates.ListReport",
"options": {
"settings": {
"contextPath": "/GenreHierarchy",
"contextPath": "/Genres",
"navigation": {
"GenreHierarchy": {
"Genres": {
"detail": {
"route": "GenreHierarchyDetails"
"route": "GenresDetails"
}
}
},
@@ -96,13 +96,13 @@
}
}
},
"GenreHierarchyDetails": {
"GenresDetails": {
"type": "Component",
"id": "GenreHierarchyDetails",
"id": "GenresDetails",
"name": "sap.fe.templates.ObjectPage",
"options": {
"settings": {
"contextPath": "/GenreHierarchy"
"contextPath": "/Genres"
}
}
}

View File

@@ -1,32 +1,6 @@
/*
This model controls what gets served to Fiori frontends...
*/
using { sap.capire.bookshop } from '../db/hierarchy';
using { AdminService } from '@capire/bookstore';
extend service AdminService with {
@readonly
@cds.search: {name}
entity GenreHierarchy as projection on bookshop.Genres;
}
annotate AdminService.GenreHierarchy with @Aggregation.RecursiveHierarchy #GenreHierarchy: {
$Type : 'Aggregation.RecursiveHierarchyType',
NodeProperty : ID, // identifies a node
ParentNavigationProperty: parent // navigates to a node's parent
};
annotate AdminService.GenreHierarchy with @Hierarchy.RecursiveHierarchy #GenreHierarchy: {
$Type : 'Hierarchy.RecursiveHierarchyType',
LimitedDescendantCount: LimitedDescendantCount,
DistanceFromRoot : DistanceFromRoot,
DrillState : DrillState,
Matched : Matched,
MatchedDescendantCount: MatchedDescendantCount,
LimitedRank : LimitedRank
};
using from './admin-authors/fiori-service';
using from './admin-books/fiori-service';
using from './browse/fiori-service';

View File

@@ -1,32 +0,0 @@
namespace sap.capire.bookshop;
using { sap.capire.bookshop.Genres } from '@capire/bookshop';
aspect Hierarchy {
LimitedDescendantCount : Integer64 = null;
DistanceFromRoot : Integer64 = null;
DrillState : String = null;
Matched : Boolean = null;
MatchedDescendantCount : Integer64 = null;
LimitedRank : Integer64 = null;
}
annotate Hierarchy with @Capabilities.FilterRestrictions.NonFilterableProperties: [
'LimitedDescendantCount',
'DistanceFromRoot',
'DrillState',
'Matched',
'MatchedDescendantCount',
'LimitedRank'
];
annotate Hierarchy with @Capabilities.SortRestrictions.NonSortableProperties: [
'LimitedDescendantCount',
'DistanceFromRoot',
'DrillState',
'Matched',
'MatchedDescendantCount',
'LimitedRank'
];
extend sap.capire.bookshop.Genres with Hierarchy;