Merge pull request #291 from gregorwolf/navigation
Demo for Semantic Navigation using the local Fiori Launchpad
This commit is contained in:
@@ -1,16 +1,42 @@
|
|||||||
using {sap.capire.bookshop as my} from '../db/schema';
|
using {sap.capire.bookshop as my} from '../db/schema';
|
||||||
|
|
||||||
service CatalogService @(path : '/browse') {
|
service CatalogService @(path : '/browse') {
|
||||||
|
|
||||||
/** For displaying lists of Books */
|
/**
|
||||||
@readonly entity ListOfBooks as projection on Books
|
* For displaying lists of Books
|
||||||
excluding { descr };
|
*/
|
||||||
|
@readonly
|
||||||
|
entity ListOfBooks as projection on Books excluding {
|
||||||
|
descr
|
||||||
|
};
|
||||||
|
|
||||||
/** For display in details pages */
|
/**
|
||||||
@readonly entity Books as projection on my.Books { *,
|
* For display in details pages
|
||||||
author.name as author
|
*/
|
||||||
} excluding { createdBy, modifiedBy };
|
@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'
|
@requires : 'authenticated-user'
|
||||||
action submitOrder ( book: Books:ID, quantity: Integer ) returns { stock: Integer };
|
action submitOrder(book : Books:ID, quantity : Integer) returns {
|
||||||
event OrderedBook : { book: Books:ID; quantity: Integer; buyer: String };
|
stock : Integer
|
||||||
|
};
|
||||||
|
|
||||||
|
event OrderedBook : {
|
||||||
|
book : Books:ID;
|
||||||
|
quantity : Integer;
|
||||||
|
buyer : String
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,6 +73,7 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"settings" : {
|
"settings" : {
|
||||||
"entitySet" : "Books",
|
"entitySet" : "Books",
|
||||||
|
"initialLoad": true,
|
||||||
"navigation" : {
|
"navigation" : {
|
||||||
"Books" : {
|
"Books" : {
|
||||||
"detail" : {
|
"detail" : {
|
||||||
|
|||||||
142
fiori/app/appconfig/fioriSandboxConfig.json
Normal file
142
fiori/app/appconfig/fioriSandboxConfig.json
Normal file
@@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
30
fiori/app/authors/fiori-service.cds
Normal file
30
fiori/app/authors/fiori-service.cds
Normal file
@@ -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},
|
||||||
|
]},
|
||||||
|
});
|
||||||
7
fiori/app/authors/webapp/Component.js
Normal file
7
fiori/app/authors/webapp/Component.js
Normal file
@@ -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 */
|
||||||
11
fiori/app/authors/webapp/i18n/i18n.properties
Normal file
11
fiori/app/authors/webapp/i18n/i18n.properties
Normal file
@@ -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
|
||||||
141
fiori/app/authors/webapp/manifest.json
Normal file
141
fiori/app/authors/webapp/manifest.json
Normal file
@@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,47 +4,57 @@ using CatalogService from '@capire/bookstore';
|
|||||||
//
|
//
|
||||||
// Books Object Page
|
// Books Object Page
|
||||||
//
|
//
|
||||||
annotate CatalogService.Books with @(
|
annotate CatalogService.Books with @(UI : {
|
||||||
UI: {
|
|
||||||
HeaderInfo : {
|
HeaderInfo : {
|
||||||
TypeName : 'Book',
|
TypeName : 'Book',
|
||||||
TypeNamePlural : 'Books',
|
TypeNamePlural : 'Books',
|
||||||
Description: {Value: author}
|
Description : {Value : authorName}
|
||||||
},
|
},
|
||||||
HeaderFacets: [
|
HeaderFacets : [{
|
||||||
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Description}', Target: '@UI.FieldGroup#Descr'},
|
$Type : 'UI.ReferenceFacet',
|
||||||
],
|
Label : '{i18n>Description}',
|
||||||
Facets: [
|
Target : '@UI.FieldGroup#Descr'
|
||||||
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Details}', Target: '@UI.FieldGroup#Price'},
|
}, ],
|
||||||
],
|
Facets : [{
|
||||||
FieldGroup#Descr: {
|
$Type : 'UI.ReferenceFacet',
|
||||||
Data: [
|
Label : '{i18n>Details}',
|
||||||
{Value: descr},
|
Target : '@UI.FieldGroup#Price'
|
||||||
]
|
}, ],
|
||||||
},
|
FieldGroup #Descr : {Data : [{Value : descr}, ]},
|
||||||
FieldGroup#Price: {
|
FieldGroup #Price : {Data : [
|
||||||
Data: [
|
|
||||||
{Value : price},
|
{Value : price},
|
||||||
{Value: currency.symbol, Label: '{i18n>Currency}'},
|
{
|
||||||
]
|
Value : currency.symbol,
|
||||||
|
Label : '{i18n>Currency}'
|
||||||
},
|
},
|
||||||
}
|
]},
|
||||||
);
|
});
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Books Object Page
|
// Books Object Page
|
||||||
//
|
//
|
||||||
annotate CatalogService.Books with @(
|
annotate CatalogService.Books with @(UI : {
|
||||||
UI: {
|
SelectionFields : [
|
||||||
SelectionFields: [ ID, price, currency_code ],
|
ID,
|
||||||
|
price,
|
||||||
|
currency_code
|
||||||
|
],
|
||||||
LineItem : [
|
LineItem : [
|
||||||
{Value: title},
|
{
|
||||||
{Value: author, Label:'{i18n>Author}'},
|
Value : ID,
|
||||||
|
Label : '{i18n>Title}'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Value : author.ID,
|
||||||
|
Label : '{i18n>Author}'
|
||||||
|
},
|
||||||
{Value : genre.name},
|
{Value : genre.name},
|
||||||
{Value : price},
|
{Value : price},
|
||||||
{Value: currency.symbol, Label:' '},
|
{
|
||||||
]
|
Value : currency.symbol,
|
||||||
|
Label : ' '
|
||||||
},
|
},
|
||||||
);
|
]
|
||||||
|
}, );
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
{
|
{
|
||||||
"_version": "1.8.0",
|
"_version": "1.28.0",
|
||||||
"sap.app": {
|
"sap.app": {
|
||||||
"id": "bookshop",
|
"id": "bookshop",
|
||||||
"type": "application",
|
"type": "application",
|
||||||
"title": "Browse Books",
|
"title": "Browse Books",
|
||||||
"description": "Sample Application",
|
"description": "Sample Application",
|
||||||
"i18n": "i18n/i18n.properties",
|
"i18n": "i18n/i18n.properties",
|
||||||
|
"applicationVersion": {
|
||||||
|
"version": "1.0.0"
|
||||||
|
},
|
||||||
"dataSources": {
|
"dataSources": {
|
||||||
"CatalogService": {
|
"CatalogService": {
|
||||||
"uri": "/browse/",
|
"uri": "/browse/",
|
||||||
@@ -15,14 +18,43 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"-sourceTemplate": {
|
"sourceTemplate": {
|
||||||
"id": "ui5template.basicSAPUI5ApplicationProject",
|
"id": "ui5template.basicSAPUI5ApplicationProject",
|
||||||
"-id": "ui5template.smartTemplate",
|
"-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": {
|
"sap.ui5": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"minUI5Version": "1.81.0",
|
||||||
"libs": {
|
"libs": {
|
||||||
"sap.fe.templates": {}
|
"sap.fe.templates": {}
|
||||||
}
|
}
|
||||||
@@ -68,6 +100,7 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"settings": {
|
"settings": {
|
||||||
"entitySet": "Books",
|
"entitySet": "Books",
|
||||||
|
"initialLoad": true,
|
||||||
"navigation": {
|
"navigation": {
|
||||||
"Books": {
|
"Books": {
|
||||||
"detail": {
|
"detail": {
|
||||||
@@ -97,7 +130,12 @@
|
|||||||
},
|
},
|
||||||
"sap.ui": {
|
"sap.ui": {
|
||||||
"technology": "UI5",
|
"technology": "UI5",
|
||||||
"fullWidth": false
|
"fullWidth": false,
|
||||||
|
"deviceTypes":{
|
||||||
|
"desktop": true,
|
||||||
|
"tablet": true,
|
||||||
|
"phone": true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"sap.fiori": {
|
"sap.fiori": {
|
||||||
"registrationIds": [],
|
"registrationIds": [],
|
||||||
|
|||||||
@@ -10,21 +10,39 @@ using { sap.common } from '@capire/common';
|
|||||||
// Books Lists
|
// Books Lists
|
||||||
//
|
//
|
||||||
annotate my.Books with @(
|
annotate my.Books with @(
|
||||||
Common.SemanticKey: [title],
|
Common.SemanticKey : [ID],
|
||||||
UI : {
|
UI : {
|
||||||
Identification : [{Value : title}],
|
Identification : [{Value : title}],
|
||||||
SelectionFields: [ ID, author_ID, price, currency_code ],
|
SelectionFields : [
|
||||||
|
ID,
|
||||||
|
author_ID,
|
||||||
|
price,
|
||||||
|
currency_code
|
||||||
|
],
|
||||||
LineItem : [
|
LineItem : [
|
||||||
{Value: ID},
|
{
|
||||||
{Value: title},
|
Value : ID,
|
||||||
{Value: author.name, Label:'{i18n>Author}'},
|
Label : '{i18n>Title}'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Value : author.ID,
|
||||||
|
Label : '{i18n>Author}'
|
||||||
|
},
|
||||||
{Value : genre.name},
|
{Value : genre.name},
|
||||||
{Value : stock},
|
{Value : stock},
|
||||||
{Value : price},
|
{Value : price},
|
||||||
{Value: currency.symbol, Label:' '},
|
{
|
||||||
|
Value : currency.symbol,
|
||||||
|
Label : ' '
|
||||||
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
|
ID @Common: {
|
||||||
|
SemanticObject : 'Books',
|
||||||
|
Text: title,
|
||||||
|
TextArrangement : #TextOnly
|
||||||
|
};
|
||||||
author @ValueList.entity : 'Authors';
|
author @ValueList.entity : 'Authors';
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -32,17 +50,12 @@ annotate my.Books with @(
|
|||||||
//
|
//
|
||||||
// Books Details
|
// Books Details
|
||||||
//
|
//
|
||||||
annotate my.Books with @(
|
annotate my.Books with @(UI : {HeaderInfo : {
|
||||||
UI: {
|
|
||||||
HeaderInfo: {
|
|
||||||
TypeName : '{i18n>Book}',
|
TypeName : '{i18n>Book}',
|
||||||
TypeNamePlural : '{i18n>Books}',
|
TypeNamePlural : '{i18n>Books}',
|
||||||
Title : {Value : title},
|
Title : {Value : title},
|
||||||
Description : {Value : author.name}
|
Description : {Value : author.name}
|
||||||
},
|
}, });
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -50,10 +63,16 @@ annotate my.Books with @(
|
|||||||
// Books Elements
|
// Books Elements
|
||||||
//
|
//
|
||||||
annotate my.Books with {
|
annotate my.Books with {
|
||||||
ID @title:'{i18n>ID}' @UI.HiddenFilter;
|
ID @title : '{i18n>ID}';
|
||||||
title @title : '{i18n>Title}';
|
title @title : '{i18n>Title}';
|
||||||
genre @title:'{i18n>Genre}' @Common: { Text: genre.name, TextArrangement: #TextOnly };
|
genre @title : '{i18n>Genre}' @Common : {
|
||||||
author @title:'{i18n>Author}' @Common: { Text: author.name, TextArrangement: #TextOnly };
|
Text : genre.name,
|
||||||
|
TextArrangement : #TextOnly
|
||||||
|
};
|
||||||
|
author @title : '{i18n>Author}' @Common : {
|
||||||
|
Text : author.name,
|
||||||
|
TextArrangement : #TextOnly
|
||||||
|
};
|
||||||
price @title : '{i18n>Price}' @Measures.ISOCurrency : currency_code;
|
price @title : '{i18n>Price}' @Measures.ISOCurrency : currency_code;
|
||||||
stock @title : '{i18n>Stock}';
|
stock @title : '{i18n>Stock}';
|
||||||
descr @UI.MultiLineText;
|
descr @UI.MultiLineText;
|
||||||
@@ -69,7 +88,10 @@ annotate my.Genres with @(
|
|||||||
SelectionFields : [name],
|
SelectionFields : [name],
|
||||||
LineItem : [
|
LineItem : [
|
||||||
{Value : name},
|
{Value : name},
|
||||||
{Value: parent.name, Label: 'Main Genre'},
|
{
|
||||||
|
Value : parent.name,
|
||||||
|
Label : 'Main Genre'
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -78,8 +100,7 @@ annotate my.Genres with @(
|
|||||||
//
|
//
|
||||||
// Genre Details
|
// Genre Details
|
||||||
//
|
//
|
||||||
annotate my.Genres with @(
|
annotate my.Genres with @(UI : {
|
||||||
UI: {
|
|
||||||
Identification : [{Value : name}],
|
Identification : [{Value : name}],
|
||||||
HeaderInfo : {
|
HeaderInfo : {
|
||||||
TypeName : '{i18n>Genre}',
|
TypeName : '{i18n>Genre}',
|
||||||
@@ -87,11 +108,12 @@ annotate my.Genres with @(
|
|||||||
Title : {Value : name},
|
Title : {Value : name},
|
||||||
Description : {Value : ID}
|
Description : {Value : ID}
|
||||||
},
|
},
|
||||||
Facets: [
|
Facets : [{
|
||||||
{$Type: 'UI.ReferenceFacet', Label: '{i18n>SubGenres}', Target: 'children/@UI.LineItem'},
|
$Type : 'UI.ReferenceFacet',
|
||||||
],
|
Label : '{i18n>SubGenres}',
|
||||||
}
|
Target : 'children/@UI.LineItem'
|
||||||
);
|
}, ],
|
||||||
|
});
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -107,38 +129,42 @@ annotate my.Genres with {
|
|||||||
// Authors List
|
// Authors List
|
||||||
//
|
//
|
||||||
annotate my.Authors with @(
|
annotate my.Authors with @(
|
||||||
Common.SemanticKey: [name],
|
Common.SemanticKey : [ID],
|
||||||
UI : {
|
UI : {
|
||||||
Identification : [{Value : name}],
|
Identification : [{Value : name}],
|
||||||
SelectionFields : [name],
|
SelectionFields : [name],
|
||||||
LineItem : [
|
LineItem : [
|
||||||
{Value : ID},
|
{Value : ID},
|
||||||
{Value: name},
|
|
||||||
{Value : dateOfBirth},
|
{Value : dateOfBirth},
|
||||||
{Value : dateOfDeath},
|
{Value : dateOfDeath},
|
||||||
{Value : placeOfBirth},
|
{Value : placeOfBirth},
|
||||||
{Value : placeOfDeath},
|
{Value : placeOfDeath},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
);
|
) {
|
||||||
|
ID @Common: {
|
||||||
|
SemanticObject : 'Authors',
|
||||||
|
Text: name,
|
||||||
|
TextArrangement : #TextOnly,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Author Details
|
// Author Details
|
||||||
//
|
//
|
||||||
annotate my.Authors with @(
|
annotate my.Authors with @(UI : {
|
||||||
UI: {
|
|
||||||
HeaderInfo : {
|
HeaderInfo : {
|
||||||
TypeName : '{i18n>Author}',
|
TypeName : '{i18n>Author}',
|
||||||
TypeNamePlural : '{i18n>Authors}',
|
TypeNamePlural : '{i18n>Authors}',
|
||||||
Title : {Value : name},
|
Title : {Value : name},
|
||||||
Description : {Value : dateOfBirth}
|
Description : {Value : dateOfBirth}
|
||||||
},
|
},
|
||||||
Facets: [
|
Facets : [{
|
||||||
{$Type: 'UI.ReferenceFacet', Target: 'books/@UI.LineItem'},
|
$Type : 'UI.ReferenceFacet',
|
||||||
],
|
Target : 'books/@UI.LineItem'
|
||||||
}
|
}, ],
|
||||||
);
|
});
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -146,7 +172,7 @@ annotate my.Authors with @(
|
|||||||
// Authors Elements
|
// Authors Elements
|
||||||
//
|
//
|
||||||
annotate my.Authors with {
|
annotate my.Authors with {
|
||||||
ID @title:'{i18n>ID}' @UI.HiddenFilter;
|
ID @title : '{i18n>ID}';
|
||||||
name @title : '{i18n>Name}';
|
name @title : '{i18n>Name}';
|
||||||
dateOfBirth @title : '{i18n>DateOfBirth}';
|
dateOfBirth @title : '{i18n>DateOfBirth}';
|
||||||
dateOfDeath @title : '{i18n>DateOfDeath}';
|
dateOfDeath @title : '{i18n>DateOfDeath}';
|
||||||
@@ -162,7 +188,10 @@ annotate common.Languages with @(
|
|||||||
Common.SemanticKey : [code],
|
Common.SemanticKey : [code],
|
||||||
Identification : [{Value : code}],
|
Identification : [{Value : code}],
|
||||||
UI : {
|
UI : {
|
||||||
SelectionFields: [ name, descr ],
|
SelectionFields : [
|
||||||
|
name,
|
||||||
|
descr
|
||||||
|
],
|
||||||
LineItem : [
|
LineItem : [
|
||||||
{Value : code},
|
{Value : code},
|
||||||
{Value : name},
|
{Value : name},
|
||||||
@@ -174,26 +203,24 @@ annotate common.Languages with @(
|
|||||||
//
|
//
|
||||||
// Language Details
|
// Language Details
|
||||||
//
|
//
|
||||||
annotate common.Languages with @(
|
annotate common.Languages with @(UI : {
|
||||||
UI: {
|
|
||||||
HeaderInfo : {
|
HeaderInfo : {
|
||||||
TypeName : '{i18n>Language}',
|
TypeName : '{i18n>Language}',
|
||||||
TypeNamePlural : '{i18n>Languages}',
|
TypeNamePlural : '{i18n>Languages}',
|
||||||
Title : {Value : name},
|
Title : {Value : name},
|
||||||
Description : {Value : descr}
|
Description : {Value : descr}
|
||||||
},
|
},
|
||||||
Facets: [
|
Facets : [{
|
||||||
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Details}', Target: '@UI.FieldGroup#Details'},
|
$Type : 'UI.ReferenceFacet',
|
||||||
],
|
Label : '{i18n>Details}',
|
||||||
FieldGroup#Details: {
|
Target : '@UI.FieldGroup#Details'
|
||||||
Data: [
|
}, ],
|
||||||
|
FieldGroup #Details : {Data : [
|
||||||
{Value : code},
|
{Value : code},
|
||||||
{Value : name},
|
{Value : name},
|
||||||
{Value : descr}
|
{Value : descr}
|
||||||
]
|
]},
|
||||||
},
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -203,7 +230,10 @@ annotate common.Currencies with @(
|
|||||||
Common.SemanticKey : [code],
|
Common.SemanticKey : [code],
|
||||||
Identification : [{Value : code}],
|
Identification : [{Value : code}],
|
||||||
UI : {
|
UI : {
|
||||||
SelectionFields: [ name, descr ],
|
SelectionFields : [
|
||||||
|
name,
|
||||||
|
descr
|
||||||
|
],
|
||||||
LineItem : [
|
LineItem : [
|
||||||
{Value : descr},
|
{Value : descr},
|
||||||
{Value : symbol},
|
{Value : symbol},
|
||||||
@@ -216,8 +246,7 @@ annotate common.Currencies with @(
|
|||||||
//
|
//
|
||||||
// Currency Details
|
// Currency Details
|
||||||
//
|
//
|
||||||
annotate common.Currencies with @(
|
annotate common.Currencies with @(UI : {
|
||||||
UI: {
|
|
||||||
HeaderInfo : {
|
HeaderInfo : {
|
||||||
TypeName : '{i18n>Currency}',
|
TypeName : '{i18n>Currency}',
|
||||||
TypeNamePlural : '{i18n>Currencies}',
|
TypeNamePlural : '{i18n>Currencies}',
|
||||||
@@ -225,26 +254,29 @@ annotate common.Currencies with @(
|
|||||||
Description : {Value : code}
|
Description : {Value : code}
|
||||||
},
|
},
|
||||||
Facets : [
|
Facets : [
|
||||||
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Details}', Target: '@UI.FieldGroup#Details'},
|
{
|
||||||
{$Type: 'UI.ReferenceFacet', Label: '{i18n>Extended}', Target: '@UI.FieldGroup#Extended'},
|
$Type : 'UI.ReferenceFacet',
|
||||||
|
Label : '{i18n>Details}',
|
||||||
|
Target : '@UI.FieldGroup#Details'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$Type : 'UI.ReferenceFacet',
|
||||||
|
Label : '{i18n>Extended}',
|
||||||
|
Target : '@UI.FieldGroup#Extended'
|
||||||
|
},
|
||||||
],
|
],
|
||||||
FieldGroup#Details: {
|
FieldGroup #Details : {Data : [
|
||||||
Data: [
|
|
||||||
{Value : name},
|
{Value : name},
|
||||||
{Value : symbol},
|
{Value : symbol},
|
||||||
{Value : code},
|
{Value : code},
|
||||||
{Value : descr}
|
{Value : descr}
|
||||||
]
|
]},
|
||||||
},
|
FieldGroup #Extended : {Data : [
|
||||||
FieldGroup#Extended: {
|
|
||||||
Data: [
|
|
||||||
{Value : numcode},
|
{Value : numcode},
|
||||||
{Value : minor},
|
{Value : minor},
|
||||||
{Value : exponent}
|
{Value : exponent}
|
||||||
]
|
]},
|
||||||
},
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -10,32 +10,7 @@
|
|||||||
<script>
|
<script>
|
||||||
window["sap-ushell-config"] = {
|
window["sap-ushell-config"] = {
|
||||||
defaultRenderer: "fiori2",
|
defaultRenderer: "fiori2",
|
||||||
applications: {
|
applications: {}
|
||||||
"browse-books": {
|
|
||||||
title: "Browse Books",
|
|
||||||
description: "w/ SAP Fiori Elements",
|
|
||||||
additionalInformation: "SAPUI5.Component=bookshop",
|
|
||||||
applicationType : "URL",
|
|
||||||
url: "/browse/webapp",
|
|
||||||
navigationMode: "embedded"
|
|
||||||
},
|
|
||||||
"manage-books": {
|
|
||||||
title: "Manage Books",
|
|
||||||
description: "w/ SAP Fiori Elements",
|
|
||||||
additionalInformation: "SAPUI5.Component=admin",
|
|
||||||
applicationType : "URL",
|
|
||||||
url: "/admin/webapp",
|
|
||||||
navigationMode: "embedded"
|
|
||||||
},
|
|
||||||
"manage-orders": {
|
|
||||||
title: "Manage Orders",
|
|
||||||
description: "w/ SAP Fiori Elements",
|
|
||||||
additionalInformation: "SAPUI5.Component=orders",
|
|
||||||
applicationType : "URL",
|
|
||||||
url: "/orders/webapp",
|
|
||||||
navigationMode: "embedded"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,6 @@
|
|||||||
|
|
||||||
using from './admin/fiori-service';
|
using from './admin/fiori-service';
|
||||||
using from './browse/fiori-service';
|
using from './browse/fiori-service';
|
||||||
|
using from './authors/fiori-service';
|
||||||
using from './common';
|
using from './common';
|
||||||
|
|
||||||
using from '@capire/bookstore/srv/mashup';
|
using from '@capire/bookstore/srv/mashup';
|
||||||
|
|||||||
@@ -11,39 +11,39 @@ describe('Localized Data', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('supports sap-language param', async () => {
|
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([
|
expect(data.value).to.containSubset([
|
||||||
{ title: 'Sturmhöhe', author: 'Emily Brontë' },
|
{ title: 'Sturmhöhe', authorName: 'Emily Brontë' },
|
||||||
{ title: 'Jane Eyre', author: 'Charlotte Brontë' },
|
{ title: 'Jane Eyre', authorName: 'Charlotte Brontë' },
|
||||||
{ title: 'The Raven', author: 'Edgar Allen Poe' },
|
{ title: 'The Raven', authorName: 'Edgar Allen Poe' },
|
||||||
{ title: 'Eleonora', author: 'Edgar Allen Poe' },
|
{ title: 'Eleonora', authorName: 'Edgar Allen Poe' },
|
||||||
{ title: 'Catweazle', author: 'Richard Carpenter' },
|
{ title: 'Catweazle', authorName: 'Richard Carpenter' },
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('supports accept-language header', async () => {
|
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' },
|
headers: { 'Accept-Language': 'de' },
|
||||||
})
|
})
|
||||||
expect(data.value).to.containSubset([
|
expect(data.value).to.containSubset([
|
||||||
{ title: 'Sturmhöhe', author: 'Emily Brontë' },
|
{ title: 'Sturmhöhe', authorName: 'Emily Brontë' },
|
||||||
{ title: 'Jane Eyre', author: 'Charlotte Brontë' },
|
{ title: 'Jane Eyre', authorName: 'Charlotte Brontë' },
|
||||||
{ title: 'The Raven', author: 'Edgar Allen Poe' },
|
{ title: 'The Raven', authorName: 'Edgar Allen Poe' },
|
||||||
{ title: 'Eleonora', author: 'Edgar Allen Poe' },
|
{ title: 'Eleonora', authorName: 'Edgar Allen Poe' },
|
||||||
{ title: 'Catweazle', author: 'Richard Carpenter' },
|
{ title: 'Catweazle', authorName: 'Richard Carpenter' },
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('supports queries with $expand', async () => {
|
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' },
|
headers: { 'Accept-Language': 'de' },
|
||||||
})
|
})
|
||||||
expect(data.value).to.containSubset([
|
expect(data.value).to.containSubset([
|
||||||
{ title: 'Sturmhöhe', author: 'Emily Brontë', currency: { name: 'Pfund' } },
|
{ title: 'Sturmhöhe', authorName: 'Emily Brontë', currency: { name: 'Pfund' } },
|
||||||
{ title: 'Jane Eyre', author: 'Charlotte Brontë', currency: { name: 'Pfund' } },
|
{ title: 'Jane Eyre', authorName: 'Charlotte Brontë', currency: { name: 'Pfund' } },
|
||||||
{ title: 'The Raven', author: 'Edgar Allen Poe', currency: { name: 'US-Dollar' } },
|
{ title: 'The Raven', authorName: 'Edgar Allen Poe', currency: { name: 'US-Dollar' } },
|
||||||
{ title: 'Eleonora', author: 'Edgar Allen Poe', currency: { name: 'US-Dollar' } },
|
{ title: 'Eleonora', authorName: 'Edgar Allen Poe', currency: { name: 'US-Dollar' } },
|
||||||
{ title: 'Catweazle', author: 'Richard Carpenter', currency: { name: 'Yen' } },
|
{ title: 'Catweazle', authorName: 'Richard Carpenter', currency: { name: 'Yen' } },
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -19,13 +19,13 @@ describe('OData Protocol', () => {
|
|||||||
|
|
||||||
it('supports $search in multiple fields', async () => {
|
it('supports $search in multiple fields', async () => {
|
||||||
const { data } = await GET `/browse/Books ${{
|
const { data } = await GET `/browse/Books ${{
|
||||||
params: { $search: 'Po', $select: `title,author` },
|
params: { $search: 'Po', $select: `title,authorName` },
|
||||||
}}`
|
}}`
|
||||||
expect(data.value).to.eql([
|
expect(data.value).to.eql([
|
||||||
{ ID: 201, title: 'Wuthering Heights', author: 'Emily Brontë' },
|
{ ID: 201, title: 'Wuthering Heights', authorName: 'Emily Brontë' },
|
||||||
{ ID: 207, title: 'Jane Eyre', author: 'Charlotte Brontë' },
|
{ ID: 207, title: 'Jane Eyre', authorName: 'Charlotte Brontë' },
|
||||||
{ ID: 251, title: 'The Raven', author: 'Edgar Allen Poe' },
|
{ ID: 251, title: 'The Raven', authorName: 'Edgar Allen Poe' },
|
||||||
{ ID: 252, title: 'Eleonora', author: 'Edgar Allen Poe' },
|
{ ID: 252, title: 'Eleonora', authorName: 'Edgar Allen Poe' },
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user