Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions bookshop/app/travel_tree/webapp/Component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sap.ui.define(["sap/fe/core/AppComponent"], function (Component) {
"use strict";
return Component.extend("sap.fe.cap.travel_tree.Component", {
metadata: { manifest: "json" },
});
});
48 changes: 48 additions & 0 deletions bookshop/app/travel_tree/webapp/View.view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<mvc:View
xmlns="sap.ui.table"
xmlns:m="sap.m"
xmlns:mvc="sap.ui.core.mvc">

<TreeTable
id="treeTable"
visibleRowCount="100"
selectionMode="Single"
enableColumnReordering="false"
rows="{
path : '/GenresView',
parameters : {
countMode: 'Inline'
}
}">

<columns>

<Column label="Description">
<template>
<m:Text text="{name}" wrapping="false" />
</template>
</Column>

<Column label="HierarchyLevel">
<template>
<m:Text text="{level}" wrapping="false" />
</template>
</Column>

<Column label="NodeID">
<template>
<m:Text text="{ID}" wrapping="false" />
</template>
</Column>

<Column label="ParentNodeID">
<template>
<m:Text text="{parent}" wrapping="false" />
</template>
</Column>

</columns>

</TreeTable>

</mvc:View>
40 changes: 40 additions & 0 deletions bookshop/app/travel_tree/webapp/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title></title>
<style>
html,
body,
body > div,
#container,
#container-uiarea {
height: 100%;
}
</style>
<script
id="sap-ui-bootstrap"
src="https://ui5.sap.com/1.110.1/resources/sap-ui-core.js"
data-sap-ui-theme="sap_horizon"
data-sap-ui-oninit="module:sap/ui/core/ComponentSupport"
data-sap-ui-resourceroots='{ "sap.fe.cap.travel_tree": "./" }'
data-sap-ui-compatVersion="edge"
data-sap-ui-async="true"
data-sap-ui-preload="async"
data-sap-ui-flexibilityServices=""
data-sap-ui-frameOptions="trusted"
data-sap-ui-libs="sap.m, sap.fe.core"
></script>
</head>
<body class="sapUiBody sapUiSizeCompact" id="content">
<div
data-sap-ui-component
data-name="sap.fe.cap.travel_tree"
data-id="container"
data-settings='{"id" : "sap.fe.cap.travel_tree"}'
data-handle-validation="true"
></div>
</body>
</html>
133 changes: 133 additions & 0 deletions bookshop/app/travel_tree/webapp/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
{
"_version": "1.42.0",
"sap.app": {
"id": "sap.fe.cap.travel_tree",
"type": "application",
"title": "{{title}}",
"description": "{{description}}",
"i18n": {
"bundleName": "sap.fe.cap.travel_tree.i18n.i18n",
"supportedLocales": ["en", "de", "fr"],
"fallbackLocale": "en"
},
"applicationVersion": {
"version": "1.0.0"
},
"dataSources": {
"mainService": {
"uri": "v2/browse/",
"type": "OData",
"settings": {
"odataVersion": "2.0"
}
}
},
"resources": "resources.json",
"sourceTemplate": {
"id": "@sap/generator-fiori:lrop",
"version": "1.7.5",
"toolsId": "14e5ba92-7ef6-40ce-9b6b-9eff19d0c9a2"
},
"crossNavigation": {
"inbounds": {
"travel-alp-inbound": {
"signature": {
"parameters": {},
"additionalParameters": "allowed"
},
"semanticObject": "booking",
"action": "process",
"title": "Analyze Travels",
"subTitle": "Analyze travels",
"icon": "sap-icon://flight"
}
}
}
},
"sap.ui": {
"technology": "UI5",
"icons": {
"icon": "sap-icon://flight",
"favIcon": "sap-icon://flight",
"phone": "sap-icon://flight",
"phone@2": "sap-icon://flight",
"tablet": "sap-icon://flight",
"tablet@2": "sap-icon://flight"
},
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
}
},
"sap.ui5": {
"flexEnabled": true,
"dependencies": {
"minUI5Version": "1.108.10",
"libs": {
"sap.m": {},
"sap.ui.core": {},
"sap.ui.table": {},
"sap.ushell": {},
"sap.fe.templates": {}
}
},
"contentDensities": {
"compact": true,
"cozy": true
},
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "sap.fe.cap.travel_analytics.i18n.i18n",
"supportedLocales": ["en", "de", "fr"],
"fallbackLocale": "en"
}
},
"": {
"dataSource": "mainService",
"preload": true,
"settings": {
"synchronizationMode": "None",
"operationMode": "Server",
"autoExpandSelect": true,
"earlyRequests": true
}
},
"@i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"uri": "i18n/i18n.properties"
}
},
"resources": {
"css": []
},
"routing": {
"config": {},
"routes": [
{
"pattern": ":?query:",
"name": "BookingTree",
"target": "BookingTree"
}
],
"targets": {
"BookingTree": {
"type": "XML",
"id": "BookingTree",
"viewName": "sap.fe.cap.travel_tree.View",
"async": true
}
}
}
},
"sap.fiori": {
"registrationIds": [],
"archeType": "transactional"
},
"sap.cloud": {
"public": true,
"service": "sap.fe.cap.sflight"
}
}
68 changes: 47 additions & 21 deletions bookshop/db/schema.cds
Original file line number Diff line number Diff line change
@@ -1,31 +1,57 @@
using { Currency, managed, sap } from '@sap/cds/common';
using {
Currency,
managed,
sap
} from '@sap/cds/common';

namespace sap.capire.bookshop;

entity Books : managed {
key ID : Integer;
title : localized String(111);
descr : localized String(1111);
author : Association to Authors;
genre : Association to Genres;
stock : Integer;
price : Decimal;
currency : Currency;
image : LargeBinary @Core.MediaType : 'image/png';
key ID : Integer;
title : localized String(111);
descr : localized String(1111);
author : Association to Authors;
genre : Association to Genres;
stock : Integer;
price : Decimal;
currency : Currency;
image : LargeBinary @Core.MediaType: 'image/png';
}

entity Authors : managed {
key ID : Integer;
name : String(111);
dateOfBirth : Date;
dateOfDeath : Date;
placeOfBirth : String;
placeOfDeath : String;
books : Association to many Books on books.author = $self;
key ID : Integer;
name : String(111);
dateOfBirth : Date;
dateOfDeath : Date;
placeOfBirth : String;
placeOfDeath : String;
books : Association to many Books
on books.author = $self;
}

/** Hierarchically organized Code List for Genres */
/**
* Hierarchically organized Code List for Genres
*/
entity Genres : sap.common.CodeList {
key ID : Integer;
parent : Association to Genres;
children : Composition of many Genres on children.parent = $self;
@sap.hierarchy.node.for : 'ID'
key ID : Integer;

@sap.hierarchy.parent.node.for: 'ID'
parent_ID : Integer;

children : Composition of many Genres
on children.parent_ID = $self.ID;
}

entity GenresView as
select from Genres {
ID,
name,
parent_ID as parent,
@sap.hierarchy.level.for : 'ID'
(CASE WHEN parent_ID IS NULL THEN 0 ELSE 1 END) as level:Integer,
@sap.hierarchy.drill.state.for : 'ID'
(CASE WHEN $self.child_count>0 THEN 'collapsed' ELSE 'leaf' END) as expand:String,
@sap.hierarchy.node.descendant.count.for: 'ID'
(SELECT COUNT(1) as count FROM Genres as C WHERE C.parent_ID=Genres.ID) as child_count:Integer
};
2 changes: 1 addition & 1 deletion bookshop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"scripts": {
"genres": "cds serve test/genres.cds",
"start": "cds run",
"watch": "cds watch"
"watch": "CDS_ENV=better-sqlite cds watch"
},
"cds": {
"requires": {
Expand Down
2 changes: 2 additions & 0 deletions bookshop/srv/cat-service.cds
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ service CatalogService @(path:'/browse') {
author.name as author
} excluding { createdBy, modifiedBy };

entity GenresView as projection on my.GenresView;

@requires: 'authenticated-user'
action submitOrder ( book: Books:ID, quantity: Integer ) returns { stock: Integer };
event OrderedBook : { book: Books:ID; quantity: Integer; buyer: String };
Expand Down
4 changes: 4 additions & 0 deletions bookshop/srv/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const proxy = require('@sap/cds-odata-v2-adapter-proxy')
const cds = require('@sap/cds')
cds.on('bootstrap', app => app.use(proxy()))
module.exports = cds.server