Skip to content

Commit 1c3262d

Browse files
committed
feat: add Star Wars Shows Fiori webapp with Episode sub-navigation
1 parent 9ff5888 commit 1c3262d

5 files changed

Lines changed: 242 additions & 0 deletions

File tree

cap/app/show/webapp/Component.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
sap.ui.define(['sap/fe/core/AppComponent'], (AppComponent) => {
2+
'use strict';
3+
4+
return AppComponent.extend("star.wars.show.Component", {
5+
metadata: {
6+
manifest: "json"
7+
}
8+
})
9+
})
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This is the resource bundle for show
2+
3+
#Texts for manifest.json
4+
5+
#XTIT: Application name
6+
appTitle=Star Wars Shows
7+
8+
#YDES: Application description
9+
appDescription=Star Wars Shows

cap/app/show/webapp/index.html

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
6+
<meta charset="UTF-8" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
8+
<title>{{appTitle}}</title>
9+
10+
<script>
11+
window['sap-ushell-config'] = {
12+
defaultRenderer: 'fiori2',
13+
applications: {
14+
'star-wars-show': {
15+
title: 'Star Wars Shows',
16+
description: 'Star Wars Shows',
17+
additionalInformation: 'SAPUI5.Component=star.wars.show',
18+
applicationType: 'URL',
19+
url: './',
20+
navigationMode: 'embedded'
21+
}
22+
},
23+
bootstrapPlugins: {
24+
RuntimeAuthoringPlugin: {
25+
component: "sap.ushell.plugins.rta",
26+
config: {
27+
validateAppVersion: false,
28+
},
29+
},
30+
PersonalizePlugin: {
31+
component: "sap.ushell.plugins.rta-personalize",
32+
config: {
33+
validateAppVersion: false,
34+
},
35+
},
36+
}
37+
}
38+
</script>
39+
<script src="https://ui5.sap.com/1.141.3/test-resources/sap/ushell/bootstrap/sandbox.js"></script>
40+
<script>
41+
function themeCalc() {
42+
try {
43+
let theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "sap_horizon_dark" :
44+
"sap_horizon"
45+
return theme
46+
} catch (ex) {
47+
console.warn("window.matchMedia not supported - keep default theme")
48+
return "sap_horizon"
49+
}
50+
}
51+
52+
function ui5Bootstrap() {
53+
return new Promise((resolve, reject) => {
54+
const s = document.createElement('script')
55+
s.setAttribute('src', "https://ui5.sap.com/1.141.3/resources/sap-ui-core.js")
56+
s.setAttribute('id', "sap-ui-bootstrap")
57+
s.setAttribute('data-sap-ui-libs', "sap.m, sap.ushell, sap.fe.templates")
58+
s.setAttribute('data-sap-ui-compatVersion', "edge")
59+
s.setAttribute('data-sapui-frameOptions', "allow")
60+
s.setAttribute('data-sapui-bindingSyntax', "complex")
61+
s.setAttribute('data-sap-ui-async', "true")
62+
s.setAttribute('data-sap-ui-resourceroots', '{"root": "./"}')
63+
s.setAttribute('data-sap-ui-onInit', "module:root/init")
64+
s.setAttribute('data-sap-ui-theme', themeCalc())
65+
document.head.appendChild(s)
66+
})
67+
}
68+
try {
69+
ui5Bootstrap()
70+
} catch (error) {
71+
console.log(error)
72+
}
73+
74+
</script>
75+
</head>
76+
77+
<body id="content" class="sapUiBody sapUiSizeCompact" role="application">
78+
<div data-sap-ui-component data-id="container" data-name="root" data-handle-validation="true">
79+
</div>
80+
</body>

cap/app/show/webapp/init.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* eslint-disable no-undef */
2+
/*eslint no-console: 0, no-unused-vars: 0, no-use-before-define: 0, no-redeclare: 0, no-shadow:0 */
3+
/*eslint-env es6 */
4+
sap.ui.require(["sap/ui/core/Core", "sap/ui/core/Component"], (oCore, Component) => {
5+
6+
sap.ushell.Container.createRenderer().placeAt('content')
7+
sap.ui
8+
.getCore()
9+
.getConfiguration()
10+
.setFlexibilityServices([{
11+
connector: "SessionStorageConnector"
12+
}])
13+
14+
})

cap/app/show/webapp/manifest.json

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
{
2+
"_version": "1.29.0",
3+
"sap.app": {
4+
"id": "star.wars.show",
5+
"type": "application",
6+
"i18n": "i18n/i18n.properties",
7+
"applicationVersion": { "version": "1.0.0" },
8+
"title": "{{appTitle}}",
9+
"description": "{{appDescription}}",
10+
"dataSources": {
11+
"mainService": {
12+
"uri": "/odata/v4/StarWarsShow/",
13+
"type": "OData",
14+
"settings": { "odataVersion": "4.0" }
15+
}
16+
},
17+
"offline": false,
18+
"resources": "resources.json"
19+
},
20+
"sap.ui": {
21+
"technology": "UI5",
22+
"deviceTypes": { "desktop": true, "tablet": true, "phone": true }
23+
},
24+
"sap.ui.generic.app": {
25+
"settings": {
26+
"objectPageHeaderType": "Dynamic",
27+
"showDraftToggle": true
28+
}
29+
},
30+
"sap.ui5": {
31+
"flexEnabled": true,
32+
"config": { "experimentalCAPScenario": true },
33+
"resources": { "js": [], "css": [] },
34+
"dependencies": {
35+
"minUI5Version": "1.76.0",
36+
"libs": { "sap.ui.core": {}, "sap.fe.templates": {} }
37+
},
38+
"models": {
39+
"i18n": {
40+
"type": "sap.ui.model.resource.ResourceModel",
41+
"uri": "i18n/i18n.properties"
42+
},
43+
"": {
44+
"dataSource": "mainService",
45+
"preload": true,
46+
"settings": {
47+
"synchronizationMode": "None",
48+
"operationMode": "Server",
49+
"autoExpandSelect": true,
50+
"earlyRequests": true
51+
}
52+
}
53+
},
54+
"routing": {
55+
"routes": [
56+
{
57+
"pattern": ":?query:",
58+
"name": "ShowList",
59+
"target": "ShowList"
60+
},
61+
{
62+
"pattern": "Show({key}):?query:",
63+
"name": "ShowObjectPage",
64+
"target": "ShowObjectPage"
65+
},
66+
{
67+
"pattern": "Show({key})/episodes({key2}):?query:",
68+
"name": "EpisodeObjectPage",
69+
"target": "EpisodeObjectPage"
70+
}
71+
],
72+
"targets": {
73+
"ShowList": {
74+
"type": "Component",
75+
"id": "ShowList",
76+
"name": "sap.fe.templates.ListReport",
77+
"options": {
78+
"settings": {
79+
"initialLoad": "Enabled",
80+
"entitySet": "Show",
81+
"variantManagement": "Page",
82+
"navigation": {
83+
"Show": { "detail": { "route": "ShowObjectPage" } }
84+
},
85+
"controlConfiguration": {
86+
"@com.sap.vocabularies.UI.v1.LineItem": {
87+
"tableSettings": {
88+
"type": "GridTable",
89+
"enableFullScreen": true,
90+
"personalization": { "column": true, "sort": true, "filter": true },
91+
"enableExport": true
92+
}
93+
}
94+
}
95+
}
96+
}
97+
},
98+
"ShowObjectPage": {
99+
"type": "Component",
100+
"id": "ShowObjectPage",
101+
"name": "sap.fe.templates.ObjectPage",
102+
"options": {
103+
"settings": {
104+
"entitySet": "Show",
105+
"navigation": {
106+
"episodes": { "detail": { "route": "EpisodeObjectPage" } }
107+
}
108+
}
109+
}
110+
},
111+
"EpisodeObjectPage": {
112+
"type": "Component",
113+
"id": "EpisodeObjectPage",
114+
"name": "sap.fe.templates.ObjectPage",
115+
"options": {
116+
"settings": {
117+
"entitySet": "Episode"
118+
}
119+
}
120+
}
121+
}
122+
},
123+
"contentDensities": { "compact": true, "cozy": true }
124+
},
125+
"sap.fiori": {
126+
"_version": "1.1.0",
127+
"registrationIds": [],
128+
"archeType": "transactional"
129+
}
130+
}

0 commit comments

Comments
 (0)