diff --git a/fiori/app/appconfig/fioriSandboxConfig.json b/fiori/app/appconfig/fioriSandboxConfig.json index a95f01f5..1bc4eb93 100644 --- a/fiori/app/appconfig/fioriSandboxConfig.json +++ b/fiori/app/appconfig/fioriSandboxConfig.json @@ -19,6 +19,14 @@ "title": "Browse Books", "targetURL": "#Books-display" } + }, + { + "id": "BrowseGenres", + "tileType": "sap.ushell.ui.tile.StaticTile", + "properties": { + "title": "Browse Genres (OData v2)", + "targetURL": "#Genres-display" + } } ] }, @@ -107,6 +115,24 @@ "url": "/admin-authors/webapp" } }, + "BrowseGenres": { + "semanticObject": "Genres", + "action": "display", + "title": "Browse Genres", + "signature": { + "parameters": { + "Genre.ID": { + "renameTo": "ID" + } + }, + "additionalParameters": "ignored" + }, + "resolutionResult": { + "applicationType": "SAPUI5", + "additionalInformation": "SAPUI5.Component=genres", + "url": "/genres/webapp" + } + }, "ManageBooks": { "semanticObject": "Books", "action": "manage", diff --git a/fiori/app/genres/fiori-service.cds b/fiori/app/genres/fiori-service.cds new file mode 100644 index 00000000..1a3bd159 --- /dev/null +++ b/fiori/app/genres/fiori-service.cds @@ -0,0 +1,21 @@ +namespace sap.capire.bookshop; + +using { sap.capire.bookshop } from '@capire/bookstore/srv/mashup'; + +entity GenreHierarchy : bookshop.Genres { + hierarchyLevel : Integer default 0; + drillState : String default 'leaf'; + parent : Association to GenreHierarchy; + children : Composition of many GenreHierarchy on children.parent = $self; +} + +annotate bookshop.GenreHierarchy { + ID @sap.hierarchy.node.for; + parent @sap.hierarchy.parent.node.for; + hierarchyLevel @sap.hierarchy.level.for; + drillState @sap.hierarchy.drill.state.for; +} + +extend service CatalogService with { + @readonly entity GenreHierarchy as projection on bookshop.GenreHierarchy; +} diff --git a/fiori/app/genres/webapp/Component.js b/fiori/app/genres/webapp/Component.js new file mode 100644 index 00000000..a8c2a9d6 --- /dev/null +++ b/fiori/app/genres/webapp/Component.js @@ -0,0 +1,7 @@ +sap.ui.define(["sap/suite/ui/generic/template/lib/AppComponent"], (AppComponent) => + AppComponent.extend("genres.Component", { + metadata: { + manifest: "json", + }, + }) +); diff --git a/fiori/app/genres/webapp/i18n/i18n.properties b/fiori/app/genres/webapp/i18n/i18n.properties new file mode 100644 index 00000000..b42a7a23 --- /dev/null +++ b/fiori/app/genres/webapp/i18n/i18n.properties @@ -0,0 +1,4 @@ +#XTIT +appTitle=Genres +#XTXT +appDescription=Browse Genres diff --git a/fiori/app/genres/webapp/manifest.json b/fiori/app/genres/webapp/manifest.json new file mode 100644 index 00000000..25d5d8f9 --- /dev/null +++ b/fiori/app/genres/webapp/manifest.json @@ -0,0 +1,155 @@ +{ + "_version": "1.8.0", + "sap.app": { + "id": "genres", + "type": "application", + "i18n": "i18n/i18n.properties", + "applicationVersion": { + "version": "1.0.0" + }, + "title": "Browse Genres Hierarchy (OData v2)", + "description": "{{appDescription}}", + "tags": { + "keywords": [] + }, + "crossNavigation": { + "inbounds": { + "appShow": { + "title": "{{appTitle}}", + "semanticObject": "GenreHierarchy", + "action": "display", + "deviceTypes": { + "desktop": true, + "tablet": true, + "phone": true + }, + "icon": "sap-icon://settings", + "size": "1x1" + } + }, + "outbounds": {} + }, + "ach": "", + "resources": "resources.json", + "dataSources": { + "main": { + "uri": "/v2/browse", + "type": "OData", + "settings": { + "annotations": ["localAnnotations"], + "localUri": "localService/metadata.xml" + } + }, + "localAnnotations": { + "type": "ODataAnnotation", + "uri": "annotations/localAnnotations.xml", + "settings": { + "localUri": "annotations/localAnnotations.xml" + } + } + }, + "offline": false, + "sourceTemplate": { + "id": "ui5template.smartTemplate", + "version": "1.40.12" + } + }, + "sap.ui": { + "technology": "UI5", + "icons": { + "icon": "", + "favIcon": "", + "phone": "", + "phone@2": "", + "tablet": "", + "tablet@2": "" + }, + "deviceTypes": { + "desktop": true, + "tablet": true, + "phone": true + }, + "supportedThemes": ["sap_hcb", "sap_belize", "sap_belize_deep", "sap_fiori_3"] + }, + "sap.ui5": { + "resources": { + "js": [], + "css": [] + }, + "dependencies": { + "minUI5Version": "1.65.6", + "libs": {}, + "components": {} + }, + "models": { + "i18n": { + "type": "sap.ui.model.resource.ResourceModel", + "uri": "i18n/i18n.properties" + }, + "@i18n": { + "type": "sap.ui.model.resource.ResourceModel", + "uri": "i18n/i18n.properties" + }, + "json": { + "type": "sap.ui.model.json.JSONModel" + }, + "i18n|sap.suite.ui.generic.template.ListReport|Genres": { + "type": "sap.ui.model.resource.ResourceModel", + "uri": "i18n/ListReport/Genres/i18n.properties" + }, + "": { + "dataSource": "main", + "preload": true, + "settings": { + "useBatch": true, + "defaultBindingMode": "TwoWay", + "defaultCountMode": "Inline", + "refreshAfterChange": true, + "metadataUrlParams": { + "sap-value-list": "none" + } + } + } + }, + "contentDensities": { + "compact": true, + "cozy": true + } + }, + "sap.ui.generic.app": { + "_version": "1.3.0", + "settings": { + "forceGlobalRefresh": false, + "useColumnLayoutForSmartForm": false, + "showBasicSearch": false + }, + "pages": { + "ListReport|Genres": { + "entitySet": "GenreHierarchy", + "component": { + "name": "sap.suite.ui.generic.template.ListReport", + "list": true, + "settings": { + "condensedTableLayout": true, + "smartVariantManagement": true, + "tableType": "TreeTable", + "enableTableFilterInPageVariant": true, + "dataLoadSettings": { + "loadDataOnAppLaunch": "always" + } + } + } + } + } + }, + "sap.fiori": { + "registrationIds": [], + "archeType": "transactional" + }, + "sap.platform.hcp": { + "uri": "" + }, + "sap.platform.cf": { + "oAuthScopes": [] + } +} diff --git a/fiori/app/services.cds b/fiori/app/services.cds index 3ab3f083..a27c8868 100644 --- a/fiori/app/services.cds +++ b/fiori/app/services.cds @@ -5,5 +5,6 @@ using from './admin-authors/fiori-service'; using from './admin-books/fiori-service'; using from './browse/fiori-service'; +using from './genres/fiori-service'; using from './common'; using from '@capire/bookstore/srv/mashup'; diff --git a/fiori/db/data/sap.capire.bookshop-GenreHierarchy.csv b/fiori/db/data/sap.capire.bookshop-GenreHierarchy.csv new file mode 100644 index 00000000..f0d3743e --- /dev/null +++ b/fiori/db/data/sap.capire.bookshop-GenreHierarchy.csv @@ -0,0 +1,16 @@ +ID;parent_ID;name;hierarchyLevel;drillState +10;;Fiction;0;expanded +11;10;Drama;1;leaf +12;10;Poetry;1;leaf +13;10;Fantasy;1;leaf +14;10;Science Fiction;1;leaf +15;10;Romance;1;leaf +16;10;Mystery;1;leaf +17;10;Thriller;1;leaf +18;10;Dystopia;1;leaf +20;;Non-Fiction;0;expanded +19;10;Fairy Tale;1;leaf +21;20;Biography;1;expanded +22;21;Autobiography;2;leaf +23;20;Essay;1;leaf +24;20;Speech;1;leaf diff --git a/fiori/server.js b/fiori/server.js index f9c211af..1679d4a5 100644 --- a/fiori/server.js +++ b/fiori/server.js @@ -1 +1,5 @@ -module.exports = require('@capire/bookstore/server.js') +const cds = require("@sap/cds"); +const proxy = require("@sap/cds-odata-v2-adapter-proxy"); +cds.on("bootstrap", app => app.use(proxy())); + +module.exports = require('@capire/bookstore/server.js') \ No newline at end of file diff --git a/samples.md b/samples.md index ad897763..a6d18feb 100644 --- a/samples.md +++ b/samples.md @@ -74,6 +74,10 @@ Each sub directory essentially is an individual npm package arranged in an [all- - Support for [Fiori Draft](https://cap.cloud.sap/docs/guides/fiori#draft) - Support for [Value Helps](https://cap.cloud.sap/docs/guides/fiori#value-help) - Serving SAP Fiori apps locally +- Fiori Elements V2 + - OData V2 using CDS OData V2 Adapter Proxy + - List Report (type `TreeTable`) + - `@sap.hierarchy` annotations