You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 13, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: exercises/09/readme.md
+8-67Lines changed: 8 additions & 67 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,68 +38,9 @@ If there isn't anything that can be sensibly served in the `app/` directory it w
38
38

39
39
40
40
41
-
### 2. Add a new module to the project descriptor
41
+
### 2. Add a Fiori sandbox environment to the UI index page
42
42
43
-
This new `app/` directory contains all UI files and represents a new module in the context of what we're eventually going to deploy to the SAP Cloud Platform.
44
-
45
-
For this to work and be included in what we eventually deploy and run, we must add information to the main deployment descriptor file `mta.yaml` that holds information relating to this.
46
-
47
-
:point_right: Replace the content of your `mta.yaml` file with the following lines. (Basically only the `bookshop-ui` module was added, but the formatting of `yaml` files is very unforgiving, so just copy / paste the entire content from here and replace everything, to keep things simple!)
48
-
```
49
-
_schema-version: 2.0.0
50
-
ID: bookshop
51
-
version: 1.0.0
52
-
modules:
53
-
- name: bookshop-db
54
-
type: hdb
55
-
path: db
56
-
parameters:
57
-
memory: 256M
58
-
disk-quota: 256M
59
-
requires:
60
-
- name: bookshop-db-hdi-container
61
-
- name: bookshop-srv
62
-
type: nodejs
63
-
path: srv
64
-
parameters:
65
-
memory: 512M
66
-
disk-quota: 256M
67
-
provides:
68
-
- name: srv_api
69
-
properties:
70
-
url: ${default-url}
71
-
requires:
72
-
- name: bookshop-db-hdi-container
73
-
- name: bookshop-ui
74
-
type: nodejs
75
-
path: app
76
-
parameters:
77
-
memory: 256M
78
-
disk-quota: 256M
79
-
requires:
80
-
- name: srv_api
81
-
group: destinations
82
-
properties:
83
-
forwardAuthToken: true
84
-
strictSSL: true
85
-
name: srv_api
86
-
url: ~{url}
87
-
resources:
88
-
- name: bookshop-db-hdi-container
89
-
type: com.sap.xs.hdi-container
90
-
properties:
91
-
hdi-container-name: ${service-name}
92
-
parameters:
93
-
service: hana
94
-
95
-
```
96
-
97
-
This snippet not only describes the runtime environment of the new module, it also injects the URL of the deployed `srv` module during deploy time.
98
-
99
-
100
-
### 3. Add a Fiori sandbox environment to the UI index page
101
-
102
-
Let's now get back to the HTML in the `index.html` file. To create a sandbox Fiori launchpad we'll need the UI5 runtime as well as artefacts from the `test-resources` area of the toolkit.
43
+
Let's now add a bit more to the contents of the `index.html` file. To create a sandbox Fiori launchpad we'll need the UI5 runtime as well as artefacts from the `test-resources` area of the toolkit.
103
44
104
45
> While you have `cds watch` running, you may notice that it's not looking out for changes to HTML files, but that doesn't actually matter, as with HTML changes, the server doesn't need to be restarted. So you can make these following changes and simply switch over to the browser to refresh.
105
46
@@ -143,7 +84,7 @@ Reloading the browser tab should now show the beginnings of something recognizab
### 4. Introduce a basic UI app to the Fiori launchpad
87
+
### 3. Introduce a basic UI app to the Fiori launchpad
147
88
148
89
Now we have the launchpad as a container for our app, let's introduce it gradually.
149
90
@@ -173,7 +114,7 @@ Reloading the index page in the browser should show something like this:
173
114

174
115
175
116
176
-
### 5. Create the app artefacts
117
+
### 4. Create the app artefacts
177
118
178
119
As we can see from the configuration we've just added, we're suggesting the app is a Component-based app (where the component name is "bookshop") and is to be found at (relative) URL `/webapp`. Let's flesh that out in terms of directories and files now.
179
120
@@ -292,7 +233,7 @@ Now you can open the "Browse Books" app and see the beginnings of a list report.
292
233
293
234

294
235
295
-
### 6. Create a CDS index file
236
+
### 5. Create a CDS index file
296
237
297
238
This is the point where you can introduce an `index.cds` file which controls which services are exposed.
298
239
@@ -305,7 +246,7 @@ using from './service';
305
246
> At this point you can actually reload the UI; while you will see some semblance of an app when you select the tile in the launchpad, the app's display will be mostly empty.
306
247
307
248
308
-
### 7. Add annotations for the service
249
+
### 6. Add annotations for the service
309
250
310
251
Now let's look at important content that will help us join together in our minds the two complementary worlds of CAP and Fiori. This content is to be added to `index.cds` and controls what gets served to Fiori frontends, via annotations that form a rich layer of metadata over the top of the service.
311
252
@@ -348,7 +289,7 @@ annotate CatalogService.Authors with {
348
289
> You may see some warnings that there are no texts for the internationalization (i18n) identifiers. We'll fix this shortly, you can ignore the warnings for now.
349
290
350
291
351
-
### 8. Test the app
292
+
### 7. Test the app
352
293
353
294
The app should be ready to invoke. Reload the Fiori launchpad and select the tile. It should open up into a nice List Report style Fiori Elements app - all driven from the service's annotations:
354
295
@@ -357,7 +298,7 @@ The app should be ready to invoke. Reload the Fiori launchpad and select the til
357
298
Well done!
358
299
359
300
360
-
### 9. Add base internationalization texts
301
+
### 8. Add base internationalization texts
361
302
362
303
Just to round things off, add some i18n texts - they're referred to in various annotation sections, and it will make the app look a little more polished.
0 commit comments