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') { service AdminService @(path:'/admin') {
entity Authors as projection on my.Authors; entity Authors as projection on my.Authors;
entity Books as projection on my.Books; 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 using from '../common'; // to help UI linter get the complete annotations
@@ -50,7 +50,7 @@ annotate AdminService.Books with {
genre @(Common: { genre @(Common: {
Label : 'Genre', Label : 'Genre',
ValueList: { ValueList: {
CollectionPath : 'GenreHierarchy', CollectionPath : 'Genres',
Parameters : [ Parameters : [
{ {
$Type : 'Common.ValueListParameterDisplayOnly', $Type : 'Common.ValueListParameterDisplayOnly',
@@ -67,7 +67,7 @@ annotate AdminService.Books with {
}); });
} }
annotate AdminService.GenreHierarchy with @UI: { annotate AdminService.Genres with @UI: {
PresentationVariant #VH: { PresentationVariant #VH: {
$Type : 'UI.PresentationVariantType', $Type : 'UI.PresentationVariantType',
Visualizations : ['@UI.LineItem'], Visualizations : ['@UI.LineItem'],
@@ -81,7 +81,7 @@ annotate AdminService.GenreHierarchy with @UI: {
}; };
// Hide ID because of the ValueHelp // Hide ID because of the ValueHelp
annotate AdminService.GenreHierarchy with { annotate AdminService.Genres with {
ID @UI.Hidden; ID @UI.Hidden;
}; };

View File

@@ -69,6 +69,63 @@ annotate my.Books with {
image @title: '{i18n>Image}'; 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 // Genres List
@@ -94,12 +151,7 @@ annotate my.Genres with @(UI : {
TypeNamePlural : '{i18n>Genres}', TypeNamePlural : '{i18n>Genres}',
Title : { Value: name }, Title : { Value: name },
Description : { Value: ID } 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": {}, "parameters": {},
"additionalParameters": "allowed" "additionalParameters": "allowed"
}, },
"semanticObject": "GenreHierarchy", "semanticObject": "Genres",
"action": "display" "action": "display"
} }
} }
@@ -61,27 +61,27 @@
"routes": [ "routes": [
{ {
"pattern": ":?query:", "pattern": ":?query:",
"name": "GenreHierarchyList", "name": "GenresList",
"target": "GenreHierarchyList" "target": "GenresList"
}, },
{ {
"pattern": "GenreHierarchy({key}):?query:", "pattern": "Genres({key}):?query:",
"name": "GenreHierarchyDetails", "name": "GenresDetails",
"target": "GenreHierarchyDetails" "target": "GenresDetails"
} }
], ],
"targets": { "targets": {
"GenreHierarchyList": { "GenresList": {
"type": "Component", "type": "Component",
"id": "GenreHierarchyList", "id": "GenresList",
"name": "sap.fe.templates.ListReport", "name": "sap.fe.templates.ListReport",
"options": { "options": {
"settings": { "settings": {
"contextPath": "/GenreHierarchy", "contextPath": "/Genres",
"navigation": { "navigation": {
"GenreHierarchy": { "Genres": {
"detail": { "detail": {
"route": "GenreHierarchyDetails" "route": "GenresDetails"
} }
} }
}, },
@@ -96,13 +96,13 @@
} }
} }
}, },
"GenreHierarchyDetails": { "GenresDetails": {
"type": "Component", "type": "Component",
"id": "GenreHierarchyDetails", "id": "GenresDetails",
"name": "sap.fe.templates.ObjectPage", "name": "sap.fe.templates.ObjectPage",
"options": { "options": {
"settings": { "settings": {
"contextPath": "/GenreHierarchy" "contextPath": "/Genres"
} }
} }
} }

View File

@@ -1,32 +1,6 @@
/* /*
This model controls what gets served to Fiori frontends... 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-authors/fiori-service';
using from './admin-books/fiori-service'; using from './admin-books/fiori-service';
using from './browse/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;