diff --git a/bookshop/srv/cat-service.cds b/bookshop/srv/cat-service.cds index 2441db25..223b045a 100644 --- a/bookshop/srv/cat-service.cds +++ b/bookshop/srv/cat-service.cds @@ -1,16 +1,42 @@ -using { sap.capire.bookshop as my } from '../db/schema'; -service CatalogService @(path:'/browse') { +using {sap.capire.bookshop as my} from '../db/schema'; - /** For displaying lists of Books */ - @readonly entity ListOfBooks as projection on Books - excluding { descr }; +service CatalogService @(path : '/browse') { - /** For display in details pages */ - @readonly entity Books as projection on my.Books { *, - author.name as author - } excluding { createdBy, modifiedBy }; + /** + * For displaying lists of Books + */ + @readonly + entity ListOfBooks as projection on Books excluding { + descr + }; - @requires: 'authenticated-user' - action submitOrder ( book: Books:ID, quantity: Integer ) returns { stock: Integer }; - event OrderedBook : { book: Books:ID; quantity: Integer; buyer: String }; + /** + * For display in details pages + */ + @readonly + entity Books as projection on my.Books { + * , author.name as authorName + } excluding { + createdBy, + modifiedBy + }; + + @readonly + entity Authors as projection on my.Authors { + * , books : redirected to Books + } excluding { + createdBy, + modifiedBy + }; + + @requires : 'authenticated-user' + action submitOrder(book : Books:ID, quantity : Integer) returns { + stock : Integer + }; + + event OrderedBook : { + book : Books:ID; + quantity : Integer; + buyer : String + }; } diff --git a/fiori/app/admin/webapp/manifest.json b/fiori/app/admin/webapp/manifest.json index 25047c29..bdedd060 100644 --- a/fiori/app/admin/webapp/manifest.json +++ b/fiori/app/admin/webapp/manifest.json @@ -73,6 +73,7 @@ "options": { "settings" : { "entitySet" : "Books", + "initialLoad": true, "navigation" : { "Books" : { "detail" : { diff --git a/fiori/app/appconfig/fioriSandboxConfig.json b/fiori/app/appconfig/fioriSandboxConfig.json new file mode 100644 index 00000000..b223b498 --- /dev/null +++ b/fiori/app/appconfig/fioriSandboxConfig.json @@ -0,0 +1,142 @@ +{ + "services": { + "LaunchPage": { + "adapter": { + "config": { + "catalogs": [], + "groups": [ + { + "id": "Bookshop", + "title": "Bookshop", + "isPreset": true, + "isVisible": true, + "isGroupLocked": false, + "tiles": [ + { + "id": "BrowseBooks", + "tileType": "sap.ushell.ui.tile.StaticTile", + "properties": { + "title": "Browse Books", + "targetURL": "#Books-display" + } + }, + { + "id": "BrowseAuthors", + "tileType": "sap.ushell.ui.tile.StaticTile", + "properties": { + "title": "Browse Authors", + "targetURL": "#Authors-display" + } + } + ] + }, + { + "id": "Administration", + "title": "Administration", + "isPreset": true, + "isVisible": true, + "isGroupLocked": false, + "tiles": [ + { + "id": "ManageBooks", + "tileType": "sap.ushell.ui.tile.StaticTile", + "properties": { + "title": "Manage Books", + "targetURL": "#Books-manage" + } + }, + { + "id": "ManageOrders", + "tileType": "sap.ushell.ui.tile.StaticTile", + "properties": { + "title": "Manage Orders", + "targetURL": "#Orders-manage" + } + } + ] + } + ] + } + } + }, + "NavTargetResolution": { + "config": { + "enableClientSideTargetResolution": true + } + }, + "ClientSideTargetResolution": { + "adapter": { + "config": { + "inbounds": { + "BrowseBooks": { + "semanticObject": "Books", + "action": "display", + "title": "Browse Books", + "signature": { + "parameters": { + "Books.ID": { + "renameTo": "ID" + }, + "Authors.books.ID": { + "renameTo": "ID" + } + }, + "additionalParameters": "ignored" + }, + "resolutionResult": { + "applicationType": "SAPUI5", + "additionalInformation": "SAPUI5.Component=bookshop", + "url": "/browse/webapp" + } + }, + "BrowseAuthors": { + "semanticObject": "Authors", + "action": "display", + "title": "Browse Authors", + "signature": { + "parameters": { + "Books.author.ID":{ + "renameTo": "ID" + } + }, + "additionalParameters": "ignored" + }, + "resolutionResult": { + "applicationType": "SAPUI5", + "additionalInformation": "SAPUI5.Component=authors", + "url": "/authors/webapp" + } + }, + "ManageBooks": { + "semanticObject": "Books", + "action": "manage", + "title": "Manage Books", + "signature": { + "parameters": {}, + "additionalParameters": "allowed" + }, + "resolutionResult": { + "applicationType": "SAPUI5", + "additionalInformation": "SAPUI5.Component=admin", + "url": "/admin/webapp" + } + }, + "ManageOrders": { + "semanticObject": "Orders", + "action": "manage", + "signature": { + "parameters": {}, + "additionalParameters": "allowed" + }, + "resolutionResult": { + "applicationType": "SAPUI5", + "additionalInformation": "SAPUI5.Component=orders", + "url": "/orders/webapp" + } + } + } + } + } + } + } +} diff --git a/fiori/app/authors/fiori-service.cds b/fiori/app/authors/fiori-service.cds new file mode 100644 index 00000000..4a16c735 --- /dev/null +++ b/fiori/app/authors/fiori-service.cds @@ -0,0 +1,30 @@ +using CatalogService from '@capire/bookshop'; + +//////////////////////////////////////////////////////////////////////////// +// +// Authors Object Page +// +annotate CatalogService.Authors with @(UI : { + HeaderInfo : { + TypeName : 'Author', + TypeNamePlural : 'Authors', + Description : {Value : name} + }, + HeaderFacets : [{ + $Type : 'UI.ReferenceFacet', + Label : '{i18n>Description}', + Target : '@UI.FieldGroup#Descr' + }, ], + Facets : [{ + $Type : 'UI.ReferenceFacet', + Label : '{i18n>Details}', + Target : 'books/@UI.LineItem' + }, ], + FieldGroup #Descr : {Data : [ + {Value : name}, + {Value : dateOfBirth}, + {Value : dateOfDeath}, + {Value : placeOfBirth}, + {Value : placeOfDeath}, + ]}, +}); \ No newline at end of file diff --git a/fiori/app/authors/webapp/Component.js b/fiori/app/authors/webapp/Component.js new file mode 100644 index 00000000..05638a71 --- /dev/null +++ b/fiori/app/authors/webapp/Component.js @@ -0,0 +1,7 @@ +sap.ui.define(["sap/fe/core/AppComponent"], function (AppComponent) { + "use strict"; + return AppComponent.extend("authors.Component", { + metadata: { manifest: "json" }, + }); +}); +/* eslint no-undef:0 */ diff --git a/fiori/app/authors/webapp/i18n/i18n.properties b/fiori/app/authors/webapp/i18n/i18n.properties new file mode 100644 index 00000000..9d2dafd7 --- /dev/null +++ b/fiori/app/authors/webapp/i18n/i18n.properties @@ -0,0 +1,11 @@ +# This is the resource bundle of itelo +# __ldi.translation.uuid=c3431418-9caf-11e8-98d0-529269fb1459 + +# JCI app descriptor contains lower case TITLE +appTitle=Bookshop Authors + +# JCI app descriptor contains lower case DESCRIPTION +appSubTitle=Bookshop Authors + +# JCI app descriptor contains lower case DESCRIPTION +appDescription=Bookshop Authors diff --git a/fiori/app/authors/webapp/manifest.json b/fiori/app/authors/webapp/manifest.json new file mode 100644 index 00000000..7efe933c --- /dev/null +++ b/fiori/app/authors/webapp/manifest.json @@ -0,0 +1,141 @@ +{ + "_version": "1.28.0", + "sap.app": { + "id": "authors", + "type": "application", + "title": "Browse Authors", + "description": "Sample Application", + "i18n": "i18n/i18n.properties", + "applicationVersion": { + "version": "1.0.0" + }, + "dataSources": { + "CatalogService": { + "uri": "/browse/", + "type": "OData", + "settings": { + "odataVersion": "4.0" + } + } + }, + "sourceTemplate": { + "id": "ui5template.basicSAPUI5ApplicationProject", + "-id": "ui5template.smartTemplate", + "version": "1.40.12" + }, + "crossNavigation": { + "inbounds": { + "intent1": { + "signature": { + "parameters": { + "Books.author.ID":{ + "renameTo": "ID" + } + }, + "additionalParameters": "ignored" + }, + "semanticObject": "Authors", + "action": "display", + "title": "{{appTitle}}", + "info": "{{appInfo}}", + "subTitle": "{{appSubTitle}}", + "icon": "sap-icon://SAP-icons-TNT/user", + "indicatorDataSource": { + "dataSource": "CatalogService", + "path": "Authors/$count", + "refresh": 1800 + } + } + } + } + }, + "sap.ui5": { + "dependencies": { + "minUI5Version": "1.81.0", + "libs": { + "sap.fe.templates": {} + } + }, + "models": { + "i18n": { + "type": "sap.ui.model.resource.ResourceModel", + "uri": "i18n/i18n.properties" + }, + "": { + "dataSource": "CatalogService", + "settings": { + "synchronizationMode": "None", + "operationMode": "Server", + "autoExpandSelect": true, + "earlyRequests": true, + "groupProperties": { + "default": { + "submit": "Auto" + } + } + } + } + }, + "routing": { + "routes": [ + { + "pattern": ":?query:", + "name": "AuthorsList", + "target": "AuthorsList" + }, + { + "pattern": "Authors({key}):?query:", + "name": "AuthorsDetails", + "target": "AuthorsDetails" + } + ], + "targets": { + "AuthorsList": { + "type": "Component", + "id": "AuthorsList", + "name": "sap.fe.templates.ListReport", + "options": { + "settings": { + "entitySet": "Authors", + "initialLoad": true, + "navigation": { + "Authors": { + "detail": { + "route": "AuthorsDetails" + } + } + } + } + } + }, + "AuthorsDetails": { + "type": "Component", + "id": "AuthorsDetailsList", + "name": "sap.fe.templates.ObjectPage", + "options": { + "settings": { + "entitySet": "Authors" + } + } + } + } + }, + "contentDensities": { + "compact": true, + "cozy": true + } + }, + "sap.ui": { + "technology": "UI5", + "fullWidth": false, + "deviceTypes":{ + "desktop": true, + "tablet": true, + "phone": true + } + }, + "sap.fiori": { + "registrationIds": [], + "archeType": "transactional" + } +} diff --git a/fiori/app/browse/fiori-service.cds b/fiori/app/browse/fiori-service.cds index 47659669..15895c97 100644 --- a/fiori/app/browse/fiori-service.cds +++ b/fiori/app/browse/fiori-service.cds @@ -4,47 +4,57 @@ using CatalogService from '@capire/bookstore'; // // Books Object Page // -annotate CatalogService.Books with @( - UI: { - HeaderInfo: { - TypeName: 'Book', - TypeNamePlural: 'Books', - Description: {Value: author} - }, - HeaderFacets: [ - {$Type: 'UI.ReferenceFacet', Label: '{i18n>Description}', Target: '@UI.FieldGroup#Descr'}, - ], - Facets: [ - {$Type: 'UI.ReferenceFacet', Label: '{i18n>Details}', Target: '@UI.FieldGroup#Price'}, - ], - FieldGroup#Descr: { - Data: [ - {Value: descr}, - ] - }, - FieldGroup#Price: { - Data: [ - {Value: price}, - {Value: currency.symbol, Label: '{i18n>Currency}'}, - ] - }, - } -); +annotate CatalogService.Books with @(UI : { + HeaderInfo : { + TypeName : 'Book', + TypeNamePlural : 'Books', + Description : {Value : authorName} + }, + HeaderFacets : [{ + $Type : 'UI.ReferenceFacet', + Label : '{i18n>Description}', + Target : '@UI.FieldGroup#Descr' + }, ], + Facets : [{ + $Type : 'UI.ReferenceFacet', + Label : '{i18n>Details}', + Target : '@UI.FieldGroup#Price' + }, ], + FieldGroup #Descr : {Data : [{Value : descr}, ]}, + FieldGroup #Price : {Data : [ + {Value : price}, + { + Value : currency.symbol, + Label : '{i18n>Currency}' + }, + ]}, +}); //////////////////////////////////////////////////////////////////////////// // // Books Object Page // -annotate CatalogService.Books with @( - UI: { - SelectionFields: [ ID, price, currency_code ], - LineItem: [ - {Value: title}, - {Value: author, Label:'{i18n>Author}'}, - {Value: genre.name}, - {Value: price}, - {Value: currency.symbol, Label:' '}, - ] - }, -); +annotate CatalogService.Books with @(UI : { + SelectionFields : [ + ID, + price, + currency_code + ], + LineItem : [ + { + Value : ID, + Label : '{i18n>Title}' + }, + { + Value : author.ID, + Label : '{i18n>Author}' + }, + {Value : genre.name}, + {Value : price}, + { + Value : currency.symbol, + Label : ' ' + }, + ] +}, ); diff --git a/fiori/app/browse/webapp/manifest.json b/fiori/app/browse/webapp/manifest.json index 4a2e0a62..f6f9b348 100644 --- a/fiori/app/browse/webapp/manifest.json +++ b/fiori/app/browse/webapp/manifest.json @@ -1,11 +1,14 @@ { - "_version": "1.8.0", + "_version": "1.28.0", "sap.app": { "id": "bookshop", "type": "application", "title": "Browse Books", "description": "Sample Application", "i18n": "i18n/i18n.properties", + "applicationVersion": { + "version": "1.0.0" + }, "dataSources": { "CatalogService": { "uri": "/browse/", @@ -15,14 +18,43 @@ } } }, - "-sourceTemplate": { + "sourceTemplate": { "id": "ui5template.basicSAPUI5ApplicationProject", "-id": "ui5template.smartTemplate", - "-version": "1.40.12" + "version": "1.40.12" + }, + "crossNavigation": { + "inbounds": { + "intent1": { + "signature": { + "parameters": { + "Books.ID":{ + "renameTo": "ID" + }, + "Authors.books.ID": { + "renameTo": "ID" + } + }, + "additionalParameters": "ignored" + }, + "semanticObject": "Books", + "action": "display", + "title": "{{appTitle}}", + "info": "{{appInfo}}", + "subTitle": "{{appSubTitle}}", + "icon": "sap-icon://course-book", + "indicatorDataSource": { + "dataSource": "CatalogService", + "path": "Books/$count", + "refresh": 1800 + } + } + } } }, "sap.ui5": { "dependencies": { + "minUI5Version": "1.81.0", "libs": { "sap.fe.templates": {} } @@ -68,6 +100,7 @@ "options": { "settings": { "entitySet": "Books", + "initialLoad": true, "navigation": { "Books": { "detail": { @@ -97,7 +130,12 @@ }, "sap.ui": { "technology": "UI5", - "fullWidth": false + "fullWidth": false, + "deviceTypes":{ + "desktop": true, + "tablet": true, + "phone": true + } }, "sap.fiori": { "registrationIds": [], diff --git a/fiori/app/common.cds b/fiori/app/common.cds index 9139f717..7337c56a 100644 --- a/fiori/app/common.cds +++ b/fiori/app/common.cds @@ -1,5 +1,5 @@ /* - Common Annotations shared by all apps + Common Annotations shared by all apps */ using { sap.capire.bookshop as my } from '@capire/bookstore'; @@ -10,39 +10,52 @@ using { sap.common } from '@capire/common'; // Books Lists // annotate my.Books with @( - Common.SemanticKey: [title], - UI: { - Identification: [{Value:title}], - SelectionFields: [ ID, author_ID, price, currency_code ], - LineItem: [ - {Value: ID}, - {Value: title}, - {Value: author.name, Label:'{i18n>Author}'}, - {Value: genre.name}, - {Value: stock}, - {Value: price}, - {Value: currency.symbol, Label:' '}, - ] - } + Common.SemanticKey : [ID], + UI : { + Identification : [{Value : title}], + SelectionFields : [ + ID, + author_ID, + price, + currency_code + ], + LineItem : [ + { + Value : ID, + Label : '{i18n>Title}' + }, + { + Value : author.ID, + Label : '{i18n>Author}' + }, + {Value : genre.name}, + {Value : stock}, + {Value : price}, + { + Value : currency.symbol, + Label : ' ' + }, + ] + } ) { - author @ValueList.entity:'Authors'; + ID @Common: { + SemanticObject : 'Books', + Text: title, + TextArrangement : #TextOnly + }; + author @ValueList.entity : 'Authors'; }; //////////////////////////////////////////////////////////////////////////// // // Books Details // -annotate my.Books with @( - UI: { - HeaderInfo: { - TypeName: '{i18n>Book}', - TypeNamePlural: '{i18n>Books}', - Title: {Value: title}, - Description: {Value: author.name} - }, - } -); - +annotate my.Books with @(UI : {HeaderInfo : { + TypeName : '{i18n>Book}', + TypeNamePlural : '{i18n>Books}', + Title : {Value : title}, + Description : {Value : author.name} +}, }); //////////////////////////////////////////////////////////////////////////// @@ -50,13 +63,19 @@ annotate my.Books with @( // Books Elements // annotate my.Books with { - ID @title:'{i18n>ID}' @UI.HiddenFilter; - title @title:'{i18n>Title}'; - genre @title:'{i18n>Genre}' @Common: { Text: genre.name, TextArrangement: #TextOnly }; - author @title:'{i18n>Author}' @Common: { Text: author.name, TextArrangement: #TextOnly }; - price @title:'{i18n>Price}' @Measures.ISOCurrency: currency_code; - stock @title:'{i18n>Stock}'; - descr @UI.MultiLineText; + ID @title : '{i18n>ID}'; + title @title : '{i18n>Title}'; + genre @title : '{i18n>Genre}' @Common : { + Text : genre.name, + TextArrangement : #TextOnly + }; + author @title : '{i18n>Author}' @Common : { + Text : author.name, + TextArrangement : #TextOnly + }; + price @title : '{i18n>Price}' @Measures.ISOCurrency : currency_code; + stock @title : '{i18n>Stock}'; + descr @UI.MultiLineText; } //////////////////////////////////////////////////////////////////////////// @@ -64,42 +83,45 @@ annotate my.Books with { // Genres List // annotate my.Genres with @( - Common.SemanticKey: [name], - UI: { - SelectionFields: [ name ], - LineItem:[ - {Value: name}, - {Value: parent.name, Label: 'Main Genre'}, - ], - } + Common.SemanticKey : [name], + UI : { + SelectionFields : [name], + LineItem : [ + {Value : name}, + { + Value : parent.name, + Label : 'Main Genre' + }, + ], + } ); //////////////////////////////////////////////////////////////////////////// // // Genre Details // -annotate my.Genres with @( - UI: { - Identification: [{Value:name}], - HeaderInfo: { - TypeName: '{i18n>Genre}', - TypeNamePlural: '{i18n>Genres}', - Title: {Value: name}, - Description: {Value: ID} - }, - Facets: [ - {$Type: 'UI.ReferenceFacet', Label: '{i18n>SubGenres}', Target: 'children/@UI.LineItem'}, - ], - } -); +annotate my.Genres with @(UI : { + Identification : [{Value : name}], + HeaderInfo : { + TypeName : '{i18n>Genre}', + TypeNamePlural : '{i18n>Genres}', + Title : {Value : name}, + Description : {Value : ID} + }, + Facets : [{ + $Type : 'UI.ReferenceFacet', + Label : '{i18n>SubGenres}', + Target : 'children/@UI.LineItem' + }, ], +}); //////////////////////////////////////////////////////////////////////////// // // Genres Elements // annotate my.Genres with { - ID @title: '{i18n>ID}'; - name @title: '{i18n>Genre}'; + ID @title : '{i18n>ID}'; + name @title : '{i18n>Genre}'; } //////////////////////////////////////////////////////////////////////////// @@ -107,38 +129,42 @@ annotate my.Genres with { // Authors List // annotate my.Authors with @( - Common.SemanticKey: [name], - UI: { - Identification: [{Value:name}], - SelectionFields: [ name ], - LineItem:[ - {Value: ID}, - {Value: name}, - {Value: dateOfBirth}, - {Value: dateOfDeath}, - {Value: placeOfBirth}, - {Value: placeOfDeath}, - ], - } -); + Common.SemanticKey : [ID], + UI : { + Identification : [{Value : name}], + SelectionFields : [name], + LineItem : [ + {Value : ID}, + {Value : dateOfBirth}, + {Value : dateOfDeath}, + {Value : placeOfBirth}, + {Value : placeOfDeath}, + ], + } +) { + ID @Common: { + SemanticObject : 'Authors', + Text: name, + TextArrangement : #TextOnly, + }; +}; //////////////////////////////////////////////////////////////////////////// // // Author Details // -annotate my.Authors with @( - UI: { - HeaderInfo: { - TypeName: '{i18n>Author}', - TypeNamePlural: '{i18n>Authors}', - Title: {Value: name}, - Description: {Value: dateOfBirth} - }, - Facets: [ - {$Type: 'UI.ReferenceFacet', Target: 'books/@UI.LineItem'}, - ], - } -); +annotate my.Authors with @(UI : { + HeaderInfo : { + TypeName : '{i18n>Author}', + TypeNamePlural : '{i18n>Authors}', + Title : {Value : name}, + Description : {Value : dateOfBirth} + }, + Facets : [{ + $Type : 'UI.ReferenceFacet', + Target : 'books/@UI.LineItem' + }, ], +}); //////////////////////////////////////////////////////////////////////////// @@ -146,12 +172,12 @@ annotate my.Authors with @( // Authors Elements // annotate my.Authors with { - ID @title:'{i18n>ID}' @UI.HiddenFilter; - name @title:'{i18n>Name}'; - dateOfBirth @title:'{i18n>DateOfBirth}'; - dateOfDeath @title:'{i18n>DateOfDeath}'; - placeOfBirth @title:'{i18n>PlaceOfBirth}'; - placeOfDeath @title:'{i18n>PlaceOfDeath}'; + ID @title : '{i18n>ID}'; + name @title : '{i18n>Name}'; + dateOfBirth @title : '{i18n>DateOfBirth}'; + dateOfDeath @title : '{i18n>DateOfDeath}'; + placeOfBirth @title : '{i18n>PlaceOfBirth}'; + placeOfDeath @title : '{i18n>PlaceOfDeath}'; } //////////////////////////////////////////////////////////////////////////// @@ -159,99 +185,105 @@ annotate my.Authors with { // Languages List // annotate common.Languages with @( - Common.SemanticKey: [code], - Identification: [{Value:code}], - UI: { - SelectionFields: [ name, descr ], - LineItem:[ - {Value: code}, - {Value: name}, - ], - } + Common.SemanticKey : [code], + Identification : [{Value : code}], + UI : { + SelectionFields : [ + name, + descr + ], + LineItem : [ + {Value : code}, + {Value : name}, + ], + } ); //////////////////////////////////////////////////////////////////////////// // // Language Details // -annotate common.Languages with @( - UI: { - HeaderInfo: { - TypeName: '{i18n>Language}', - TypeNamePlural: '{i18n>Languages}', - Title: {Value: name}, - Description: {Value: descr} - }, - Facets: [ - {$Type: 'UI.ReferenceFacet', Label: '{i18n>Details}', Target: '@UI.FieldGroup#Details'}, - ], - FieldGroup#Details: { - Data: [ - {Value: code}, - {Value: name}, - {Value: descr} - ] - }, - } -); +annotate common.Languages with @(UI : { + HeaderInfo : { + TypeName : '{i18n>Language}', + TypeNamePlural : '{i18n>Languages}', + Title : {Value : name}, + Description : {Value : descr} + }, + Facets : [{ + $Type : 'UI.ReferenceFacet', + Label : '{i18n>Details}', + Target : '@UI.FieldGroup#Details' + }, ], + FieldGroup #Details : {Data : [ + {Value : code}, + {Value : name}, + {Value : descr} + ]}, +}); //////////////////////////////////////////////////////////////////////////// // // Currencies List // annotate common.Currencies with @( - Common.SemanticKey: [code], - Identification: [{Value:code}], - UI: { - SelectionFields: [ name, descr ], - LineItem:[ - {Value: descr}, - {Value: symbol}, - {Value: code}, - ], - } + Common.SemanticKey : [code], + Identification : [{Value : code}], + UI : { + SelectionFields : [ + name, + descr + ], + LineItem : [ + {Value : descr}, + {Value : symbol}, + {Value : code}, + ], + } ); //////////////////////////////////////////////////////////////////////////// // // Currency Details // -annotate common.Currencies with @( - UI: { - HeaderInfo: { - TypeName: '{i18n>Currency}', - TypeNamePlural: '{i18n>Currencies}', - Title: {Value: descr}, - Description: {Value: code} - }, - Facets: [ - {$Type: 'UI.ReferenceFacet', Label: '{i18n>Details}', Target: '@UI.FieldGroup#Details'}, - {$Type: 'UI.ReferenceFacet', Label: '{i18n>Extended}', Target: '@UI.FieldGroup#Extended'}, - ], - FieldGroup#Details: { - Data: [ - {Value: name}, - {Value: symbol}, - {Value: code}, - {Value: descr} - ] - }, - FieldGroup#Extended: { - Data: [ - {Value: numcode}, - {Value: minor}, - {Value: exponent} - ] - }, - } -); +annotate common.Currencies with @(UI : { + HeaderInfo : { + TypeName : '{i18n>Currency}', + TypeNamePlural : '{i18n>Currencies}', + Title : {Value : descr}, + Description : {Value : code} + }, + Facets : [ + { + $Type : 'UI.ReferenceFacet', + Label : '{i18n>Details}', + Target : '@UI.FieldGroup#Details' + }, + { + $Type : 'UI.ReferenceFacet', + Label : '{i18n>Extended}', + Target : '@UI.FieldGroup#Extended' + }, + ], + FieldGroup #Details : {Data : [ + {Value : name}, + {Value : symbol}, + {Value : code}, + {Value : descr} + ]}, + FieldGroup #Extended : {Data : [ + {Value : numcode}, + {Value : minor}, + {Value : exponent} + ]}, +}); //////////////////////////////////////////////////////////////////////////// // // Currencies Elements // annotate common.Currencies with { - numcode @title:'{i18n>NumCode}'; - minor @title:'{i18n>MinorUnit}'; - exponent @title:'{i18n>Exponent}'; + numcode @title : '{i18n>NumCode}'; + minor @title : '{i18n>MinorUnit}'; + exponent @title : '{i18n>Exponent}'; } diff --git a/fiori/app/fiori-apps.html b/fiori/app/fiori-apps.html index 6c229e6b..0a452268 100644 --- a/fiori/app/fiori-apps.html +++ b/fiori/app/fiori-apps.html @@ -10,32 +10,7 @@ diff --git a/fiori/app/services.cds b/fiori/app/services.cds index e59f69f8..6f96e3b9 100644 --- a/fiori/app/services.cds +++ b/fiori/app/services.cds @@ -4,6 +4,6 @@ using from './admin/fiori-service'; using from './browse/fiori-service'; +using from './authors/fiori-service'; using from './common'; - using from '@capire/bookstore/srv/mashup'; diff --git a/test/localized-data.test.js b/test/localized-data.test.js index 4d399786..316ae9e4 100644 --- a/test/localized-data.test.js +++ b/test/localized-data.test.js @@ -11,39 +11,39 @@ describe('Localized Data', () => { }) it('supports sap-language param', async () => { - const { data } = await GET(`/browse/Books?$select=title,author` + '&sap-language=de') + const { data } = await GET(`/browse/Books?$select=title,authorName` + '&sap-language=de') expect(data.value).to.containSubset([ - { title: 'Sturmhöhe', author: 'Emily Brontë' }, - { title: 'Jane Eyre', author: 'Charlotte Brontë' }, - { title: 'The Raven', author: 'Edgar Allen Poe' }, - { title: 'Eleonora', author: 'Edgar Allen Poe' }, - { title: 'Catweazle', author: 'Richard Carpenter' }, + { title: 'Sturmhöhe', authorName: 'Emily Brontë' }, + { title: 'Jane Eyre', authorName: 'Charlotte Brontë' }, + { title: 'The Raven', authorName: 'Edgar Allen Poe' }, + { title: 'Eleonora', authorName: 'Edgar Allen Poe' }, + { title: 'Catweazle', authorName: 'Richard Carpenter' }, ]) }) it('supports accept-language header', async () => { - const { data } = await GET(`/browse/Books?$select=title,author`, { + const { data } = await GET(`/browse/Books?$select=title,authorName`, { headers: { 'Accept-Language': 'de' }, }) expect(data.value).to.containSubset([ - { title: 'Sturmhöhe', author: 'Emily Brontë' }, - { title: 'Jane Eyre', author: 'Charlotte Brontë' }, - { title: 'The Raven', author: 'Edgar Allen Poe' }, - { title: 'Eleonora', author: 'Edgar Allen Poe' }, - { title: 'Catweazle', author: 'Richard Carpenter' }, + { title: 'Sturmhöhe', authorName: 'Emily Brontë' }, + { title: 'Jane Eyre', authorName: 'Charlotte Brontë' }, + { title: 'The Raven', authorName: 'Edgar Allen Poe' }, + { title: 'Eleonora', authorName: 'Edgar Allen Poe' }, + { title: 'Catweazle', authorName: 'Richard Carpenter' }, ]) }) it('supports queries with $expand', async () => { - const { data } = await GET(`/browse/Books?&$select=title,author&$expand=currency`, { + const { data } = await GET(`/browse/Books?&$select=title,authorName&$expand=currency`, { headers: { 'Accept-Language': 'de' }, }) expect(data.value).to.containSubset([ - { title: 'Sturmhöhe', author: 'Emily Brontë', currency: { name: 'Pfund' } }, - { title: 'Jane Eyre', author: 'Charlotte Brontë', currency: { name: 'Pfund' } }, - { title: 'The Raven', author: 'Edgar Allen Poe', currency: { name: 'US-Dollar' } }, - { title: 'Eleonora', author: 'Edgar Allen Poe', currency: { name: 'US-Dollar' } }, - { title: 'Catweazle', author: 'Richard Carpenter', currency: { name: 'Yen' } }, + { title: 'Sturmhöhe', authorName: 'Emily Brontë', currency: { name: 'Pfund' } }, + { title: 'Jane Eyre', authorName: 'Charlotte Brontë', currency: { name: 'Pfund' } }, + { title: 'The Raven', authorName: 'Edgar Allen Poe', currency: { name: 'US-Dollar' } }, + { title: 'Eleonora', authorName: 'Edgar Allen Poe', currency: { name: 'US-Dollar' } }, + { title: 'Catweazle', authorName: 'Richard Carpenter', currency: { name: 'Yen' } }, ]) }) diff --git a/test/odata.test.js b/test/odata.test.js index 43b90791..ff1945f2 100644 --- a/test/odata.test.js +++ b/test/odata.test.js @@ -19,13 +19,13 @@ describe('OData Protocol', () => { it('supports $search in multiple fields', async () => { const { data } = await GET `/browse/Books ${{ - params: { $search: 'Po', $select: `title,author` }, + params: { $search: 'Po', $select: `title,authorName` }, }}` expect(data.value).to.eql([ - { ID: 201, title: 'Wuthering Heights', author: 'Emily Brontë' }, - { ID: 207, title: 'Jane Eyre', author: 'Charlotte Brontë' }, - { ID: 251, title: 'The Raven', author: 'Edgar Allen Poe' }, - { ID: 252, title: 'Eleonora', author: 'Edgar Allen Poe' }, + { ID: 201, title: 'Wuthering Heights', authorName: 'Emily Brontë' }, + { ID: 207, title: 'Jane Eyre', authorName: 'Charlotte Brontë' }, + { ID: 251, title: 'The Raven', authorName: 'Edgar Allen Poe' }, + { ID: 252, title: 'Eleonora', authorName: 'Edgar Allen Poe' }, ]) })