From 71c6b56bd4e8cda8ac5b3a0105b11ac0ed36226e Mon Sep 17 00:00:00 2001 From: i329347 Date: Wed, 16 Apr 2025 13:33:47 +0530 Subject: [PATCH 1/6] changes wrt wzlep --- app/incidents/package.json | 15 +- app/incidents/ui5-deploy.yaml | 20 +++ app/incidents/webapp/manifest.json | 8 +- app/incidents/xs-app.json | 18 +++ app/router/package.json | 12 ++ app/router/xs-app.json | 10 ++ mta.yaml | 174 ++++++++++++++++++++++ mtx/sidecar/package.json | 32 ++++ package.json | 28 +++- workzone/cdm.json | 229 +++++++++++++++++++++++++++++ xs-security.json | 76 ++++++++++ 11 files changed, 611 insertions(+), 11 deletions(-) create mode 100644 app/incidents/ui5-deploy.yaml create mode 100644 app/incidents/xs-app.json create mode 100644 app/router/package.json create mode 100644 app/router/xs-app.json create mode 100644 mta.yaml create mode 100644 mtx/sidecar/package.json create mode 100644 workzone/cdm.json create mode 100644 xs-security.json diff --git a/app/incidents/package.json b/app/incidents/package.json index b5734208..73e55665 100644 --- a/app/incidents/package.json +++ b/app/incidents/package.json @@ -9,7 +9,18 @@ ], "main": "webapp/index.html", "scripts": { - "deploy-config": "npx -p @sap/ux-ui5-tooling fiori add deploy-config cf" + "deploy-config": "npx -p @sap/ux-ui5-tooling fiori add deploy-config cf", + "build": "ui5 build preload --clean-dest --config ui5-deploy.yaml", + "build-local": "ui5 build preload --clean-dest", + "start": "ui5 serve" }, - "devDependencies": { } + "devDependencies": { + "@ui5/cli": "^4", + "ui5-task-zipper": "^3" + }, + "ui5": { + "dependencies": [ + "ui5-task-zipper" + ] + } } diff --git a/app/incidents/ui5-deploy.yaml b/app/incidents/ui5-deploy.yaml new file mode 100644 index 00000000..d689c915 --- /dev/null +++ b/app/incidents/ui5-deploy.yaml @@ -0,0 +1,20 @@ +# yaml-language-server: $schema=https://sap.github.io/ui5-tooling/schema/ui5.yaml.json +specVersion: '3.1' +metadata: + name: incidents +type: application +resources: + configuration: + propertiesFileSourceEncoding: UTF-8 +builder: + resources: + excludes: + - "/test/**" + - "/localService/**" + customTasks: + - name: ui5-task-zipper + afterTask: generateVersionInfo + configuration: + archiveName: incidents + additionalFiles: + - xs-app.json diff --git a/app/incidents/webapp/manifest.json b/app/incidents/webapp/manifest.json index beb63f8b..c867be99 100644 --- a/app/incidents/webapp/manifest.json +++ b/app/incidents/webapp/manifest.json @@ -29,7 +29,7 @@ }, "dataSources": { "mainService": { - "uri": "/odata/v4/processor/", + "uri": "odata/v4/processor/", "type": "OData", "settings": { "annotations": [], @@ -168,5 +168,9 @@ "sap.fiori": { "registrationIds": [], "archeType": "transactional" + }, + "sap.cloud": { + "public": true, + "service": "ga.service" } -} \ No newline at end of file +} diff --git a/app/incidents/xs-app.json b/app/incidents/xs-app.json new file mode 100644 index 00000000..c1ddbba6 --- /dev/null +++ b/app/incidents/xs-app.json @@ -0,0 +1,18 @@ +{ + "welcomeFile": "/index.html", + "authenticationMethod": "route", + "routes": [ + { + "source": "^/?odata/(.*)$", + "target": "/odata/$1", + "destination": "srv-api", + "csrfProtection": true, + "authenticationType": "xsuaa" + }, + { + "source": "^(.*)$", + "target": "$1", + "service": "html5-apps-repo-rt" + } + ] +} diff --git a/app/router/package.json b/app/router/package.json new file mode 100644 index 00000000..019442f7 --- /dev/null +++ b/app/router/package.json @@ -0,0 +1,12 @@ +{ + "name": "approuter", + "dependencies": { + "@sap/approuter": "^19.0.0" + }, + "engines": { + "node": "^20" + }, + "scripts": { + "start": "node node_modules/@sap/approuter/approuter.js" + } +} diff --git a/app/router/xs-app.json b/app/router/xs-app.json new file mode 100644 index 00000000..53334cef --- /dev/null +++ b/app/router/xs-app.json @@ -0,0 +1,10 @@ +{ + "routes": [ + { + "source": "^(.*)$", + "target": "$1", + "service": "html5-apps-repo-rt", + "authenticationType": "xsuaa" + } + ] +} diff --git a/mta.yaml b/mta.yaml new file mode 100644 index 00000000..5d077ea1 --- /dev/null +++ b/mta.yaml @@ -0,0 +1,174 @@ +_schema-version: 3.3.0 +ID: ga +version: 1.0.0 +description: "A simple CAP project." +parameters: + enable-parallel-deployments: true + deploy_mode: html5-repo + workzoneServicePlan: local-entry-point + workzoneServiceName: build-workzone-standard + lepExposureId: ga.service + workzoneServiceProviderId: ga-${org}-${space} +build-parameters: + before-all: + - builder: custom + commands: + - npm ci + - mkdir -p app/resources + - cp workzone/cdm.json app/resources/cdm.json + - npx cds build --production +modules: + - name: ga-srv + type: nodejs + path: gen/srv + parameters: + instances: 1 + buildpack: nodejs_buildpack + build-parameters: + builder: npm-ci + provides: + - name: srv-api # required by consumers of CAP services (e.g. approuter) + properties: + srv-url: ${default-url} + requires: + - name: ga-db + - name: ga-auth + + - name: ga + type: approuter.nodejs + path: app/router + parameters: + keep-existing-routes: true + disk-quota: 256M + memory: 256M + properties: + TENANT_HOST_PATTERN: "^(.*)-${default-uri}" + OWN_SAP_CLOUD_SERVICE: "[\"gaservice\"]" + requires: + - name: srv-api + group: destinations + properties: + name: srv-api # must be used in xs-app.json as well + url: ~{srv-url} + forwardAuthToken: true + - name: incidents-build-workzone-service + - name: mtx-api + group: destinations + properties: + name: mtx-api # must be used in xs-app.json as well + url: ~{mtx-url} + - name: ga-html5-runtime + - name: ga-auth + provides: + - name: app-api + properties: + app-protocol: ${protocol} + app-uri: ${default-uri} + + - name: ga-mtx + type: nodejs + path: gen/mtx/sidecar + requires: + - name: app-api + properties: + SUBSCRIPTION_URL: ~{app-protocol}://\${tenant_subdomain}-~{app-uri} + - name: ga-db + - name: ga-html5-repo-host + - name: ga-html5-runtime + - name: incidents-build-workzone-service + - name: ga-auth + - name: ga-registry + + build-parameters: + builder: npm-ci + parameters: + instances: 1 + memory: 256M + disk-quota: 512M + provides: + - name: mtx-api + properties: + mtx-url: ${default-url} + + - name: ga-app-deployer + type: com.sap.application.content + path: app + requires: + - name: ga-html5-repo-host + parameters: + content-target: true + - name: incidents-build-workzone-service + build-parameters: + build-result: resources + requires: + - name: gaincidents + artifacts: + - incidents.zip + target-path: resources + + - name: gaincidents + type: html5 + path: app/incidents + build-parameters: + build-result: dist + builder: custom + commands: + - npm ci + - npm run build + supported-platforms: + [] + +resources: + - name: ga-db + type: org.cloudfoundry.managed-service + parameters: + service: service-manager + service-plan: container + + - name: ga-html5-repo-host + type: org.cloudfoundry.managed-service + parameters: + service: html5-apps-repo + service-plan: app-host + - name: ga-html5-runtime + type: org.cloudfoundry.managed-service + parameters: + service: html5-apps-repo + service-plan: app-runtime + - name: ga-registry + type: org.cloudfoundry.managed-service + requires: + - name: mtx-api + parameters: + service: saas-registry + service-plan: application + config: + xsappname: ga-${org}-${space} + appName: ga-${org}-${space} + displayName: ga + description: A simple CAP project. + category: 'Category' + appUrls: + getDependencies: ~{mtx-api/mtx-url}/-/cds/saas-provisioning/dependencies + onSubscription: ~{mtx-api/mtx-url}/-/cds/saas-provisioning/tenant/{tenantId} + onSubscriptionAsync: true + onUnSubscriptionAsync: true + onUpdateDependenciesAsync: true + callbackTimeoutMillis: 300000 # Increase if your deployments are taking longer than that + - name: incidents-build-workzone-service + parameters: + config: + providerId: ga-${org}-${space} + exposureId: ga.service + service-plan: local-entry-point + service: build-workzone-standard + type: org.cloudfoundry.managed-service + - name: ga-auth + type: org.cloudfoundry.managed-service + parameters: + service: xsuaa + service-plan: application + path: ./xs-security.json + config: + xsappname: ga-${org}-${space} + tenant-mode: shared diff --git a/mtx/sidecar/package.json b/mtx/sidecar/package.json new file mode 100644 index 00000000..67db51b5 --- /dev/null +++ b/mtx/sidecar/package.json @@ -0,0 +1,32 @@ +{ + "name": "incidents-mtx", + "dependencies": { + "@cap-js/hana": "^1", + "@sap/cds": "^8", + "@sap/cds-mtxs": "^2", + "@sap/xssec": "^4", + "express": "^4" + }, + "devDependencies": { + "@cap-js/sqlite": "^1" + }, + "scripts": { + "start": "cds-serve" + }, + "cds": { + "profile": "mtx-sidecar", + "requires": { + "html5-host": true, + "html5-runtime": true, + "launchpad": { + "vcap": { + "label": "build-workzone-standard", + "plan": "local-entry-point" + }, + "subscriptionDependency": { + "uaa": "xsappname" + } + } + } + } +} diff --git a/package.json b/package.json index 91b2e9f3..d2b755ca 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@capire/incidents", + "name": "ga", "version": "1.0.0", "calesi": { "@cap-js/audit-logging": "*", @@ -12,15 +12,19 @@ "dummy": 0 }, "dependencies": { - "@sap/cds": ">=8", + "@cap-js/hana": "^1.8.0", + "@sap/cds": "8.8.2", + "@sap/cds-mtxs": "^2", + "@sap/hana-client": "^2.24.21", + "@sap/xssec": "^4", "express": "^4" }, "devDependencies": { "@cap-js/cds-test": "^0", - "@cap-js/audit-logging": "^0.8.3", "@cap-js/change-tracking": "^1.0.6", - "@cap-js/attachments": "^2", - "@cap-js/sqlite": "^1.0.1" + "@cap-js/sqlite": "^1.0.1", + "@sap/cds-dk": "^8.8.2", + "@sap/ux-specification": "^1.108.4" }, "scripts": { "watch": "cds watch", @@ -53,8 +57,18 @@ } } } + }, + "html5-runtime": true, + "destinations": false, + "workzone": false, + "[production]": { + "multitenancy": true, + "auth": { + "kind": "xsuaa" + } } - } + }, + "profile": "with-mtx-sidecar" }, "private": true -} \ No newline at end of file +} diff --git a/workzone/cdm.json b/workzone/cdm.json new file mode 100644 index 00000000..0afca884 --- /dev/null +++ b/workzone/cdm.json @@ -0,0 +1,229 @@ +[ + { + "_version": "3.0", + "identification": { + "id": "Incidents_GA", + "title": "{{title}}", + "entityType": "role" + }, + "payload": { + "catalogs": [ + { + "id": "lepCatalog" + } + ], + "spaces": [ + { + "id": "lepSpace" + } + ], + "apps": [ + { + "id": "ns.incidents" + } + ] + }, + "texts": [ + { + "locale": "en", + "textDictionary": { + "title": "LEP Role" + } + }, + { + "locale": "", + "textDictionary": { + "title": "LEP Role" + } + } + ] + }, + { + "_version": "3.0", + "identification": { + "id": "lepCatalog", + "title": "{{title}}", + "entityType": "catalog" + }, + "payload": { + "viz": [ + { + "appId": "ns.incidents", + "vizId": "intent1" + } + ] + }, + "texts": [ + { + "locale": "en", + "textDictionary": { + "title": "LEP Catalog" + } + }, + { + "locale": "", + "textDictionary": { + "title": "LEP Catalog" + } + } + ] + }, + { + "_version": "3.1.0", + "identification": { + "id": "lepSpace", + "title": "{{title}}", + "description": "{{description}}", + "entityType": "space" + }, + "payload": { + "contentNodes": [ + { + "type": "workpage", + "id": "lepWorkpage" + } + ] + }, + "texts": [ + { + "locale": "en", + "textDictionary": { + "title": "LEP Space", + "description": "LEP Space" + } + }, + { + "locale": "", + "textDictionary": { + "title": "LEP Space", + "description": "LEP Space" + } + } + ] + }, + { + "_version": "3.2.0", + "identification": { + "id": "lepWorkpage", + "entityType": "workpage", + "title": "{{title}}", + "description": "{{description}}" + }, + "payload": { + "workpageConfig": { + "title": "{{title}}" + }, + "rows": [ + { + "id": "row-1", + "rowConfig": {}, + "columns": [ + { + "id": "col-11", + "columnConfig": { + "columnWidth": 8 + }, + "cells": [ + { + "id": "cell-111", + "cellConfig": {}, + "widgets": [ + { + "id": "widg-1111", + "viz": { + "appId": "ns.incidents", + "vizId": "intent1" + } + } + ] + } + ] + } + ] + } + ] + }, + "texts": [ + { + "locale": "en", + "textDictionary": { + "title": "LEP Workpage (New Experience)", + "description": "LEP Workpage (New Experience)" + } + }, + { + "locale": "", + "textDictionary": { + "title": "LEP Workpage (New Experience)", + "description": "LEP Workpage (New Experience)" + } + } + ] + }, + { + "_version": "3.1.0", + "identification": { + "id": "lepPage", + "entityType": "page", + "title": "{{title}}", + "description": "{{description}}" + }, + "payload": { + "sections": [ + { + "id": "section1", + "title": "{{sections.section1.title}}", + "viz": [ + { + "appId": "ns.incidents", + "displayFormatHint": "default", + "vizId": "intent1" + } + ] + } + ] + }, + "texts": [ + { + "locale": "", + "textDictionary": { + "description": "LEP Workpage (Old Experience)", + "sections.section1.title": "LEP Workpage (Old Experience) Section", + "title": "LEP Workpage (Old Experience)" + } + }, + { + "locale": "en", + "textDictionary": { + "description": "LEP Workpage (Old Experience)", + "sections.section1.title": "LEP Workpage (Old Experience) Section", + "title": "LEP Workpage (Old Experience)" + } + } + ] + }, + { + "_version": "3.2.0", + "identification": { + "id": "lepSite", + "entityType": "site" + }, + "payload": { + "siteConfig": { + "title": "SAP Fiori launchpad site on Cloud Foundry", + "alias": "lepSite", + "displaySettings": { + "launchpadViewMode": "SpacesAndWorkPages" + }, + "userCapabilities": { + "supportedLanguages": [ + "en" + ] + }, + "browserSettings": { + "asynchronousModuleLoading": true + } + } + } + } + ] \ No newline at end of file diff --git a/xs-security.json b/xs-security.json new file mode 100644 index 00000000..1601320c --- /dev/null +++ b/xs-security.json @@ -0,0 +1,76 @@ +{ + "scopes": [ + { + "name": "$XSAPPNAME.support", + "description": "support" + }, + { + "name": "$XSAPPNAME.admin", + "description": "admin" + }, + { + "name": "uaa.user", + "description": "UAA" + }, + + { + "name": "$XSAPPNAME.Callback", + "description": "Subscription via SaaS Registry", + "grant-as-authority-to-apps": [ + "$XSAPPNAME(application,sap-provisioning,tenant-onboarding)" + ] + }, + { + "name": "$XSAPPNAME.mtcallback", + "description": "Subscription via SaaS Registry", + "grant-as-authority-to-apps": [ + "$XSAPPNAME(application,sap-provisioning,tenant-onboarding)" + ] + } + ], + "attributes": [], + "role-templates": [ + { + "name": "Token_Exchange", + "description": "UAA", + "scope-references": [ + "uaa.user" + ] + }, + { + "name": "MultitenancyCallbackRoleTemplate", + "description": "Call callback-services of applications", + "scope-references": [ + "$XSAPPNAME.Callback" + ] + }, + { + "name": "support", + "description": "generated", + "scope-references": [ + "$XSAPPNAME.support" + ], + "attribute-references": [] + }, + { + "name": "admin", + "description": "generated", + "scope-references": [ + "$XSAPPNAME.admin" + ], + "attribute-references": [] + } + ], + "role-collections": [ + { + "name": "Incidents_GA", + "description": "Grant Administrative access to LEP", + "role-template-references": [ + "$XSAPPNAME.Token_Exchange", + "$XSAPPNAME.MultitenancyCallbackRoleTemplate", + "$XSAPPNAME.support", + "$XSAPPNAME.admin" + ] + } + ] +} From e5de4ed79fca7e3ad0bcfe37794c29c70144221b Mon Sep 17 00:00:00 2001 From: Gopal Anand <32189444+gopalanand333@users.noreply.github.com> Date: Tue, 17 Jun 2025 14:21:18 +0530 Subject: [PATCH 2/6] Update xs-app.json --- app/router/xs-app.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/router/xs-app.json b/app/router/xs-app.json index 53334cef..a9166a59 100644 --- a/app/router/xs-app.json +++ b/app/router/xs-app.json @@ -4,7 +4,7 @@ "source": "^(.*)$", "target": "$1", "service": "html5-apps-repo-rt", - "authenticationType": "xsuaa" + "authenticationType": "ias" } ] } From ae64e38b7068f33db826ebd9c3eacc7f3328896e Mon Sep 17 00:00:00 2001 From: Gopal Anand <32189444+gopalanand333@users.noreply.github.com> Date: Tue, 17 Jun 2025 14:23:27 +0530 Subject: [PATCH 3/6] Update xs-app.json --- app/router/xs-app.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/router/xs-app.json b/app/router/xs-app.json index a9166a59..53334cef 100644 --- a/app/router/xs-app.json +++ b/app/router/xs-app.json @@ -4,7 +4,7 @@ "source": "^(.*)$", "target": "$1", "service": "html5-apps-repo-rt", - "authenticationType": "ias" + "authenticationType": "xsuaa" } ] } From 4f67c13dc713f5b3631b979693e87191759c0052 Mon Sep 17 00:00:00 2001 From: i329347 Date: Thu, 19 Jun 2025 16:11:46 +0530 Subject: [PATCH 4/6] feat: add welcomeFile to xs-app.json and enable cookie backward compatibility in mta.yaml --- app/router/xs-app.json | 1 + mta.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/app/router/xs-app.json b/app/router/xs-app.json index 53334cef..66644225 100644 --- a/app/router/xs-app.json +++ b/app/router/xs-app.json @@ -1,4 +1,5 @@ { + "welcomeFile": "cp.portal/site", "routes": [ { "source": "^(.*)$", diff --git a/mta.yaml b/mta.yaml index 5d077ea1..a371bdfd 100644 --- a/mta.yaml +++ b/mta.yaml @@ -44,6 +44,7 @@ modules: properties: TENANT_HOST_PATTERN: "^(.*)-${default-uri}" OWN_SAP_CLOUD_SERVICE: "[\"gaservice\"]" + COOKIE_BACKWARD_COMPATIBILITY: true requires: - name: srv-api group: destinations From 7e973e8001c47c244c7e79e1ed1c0b1ff80ca0a2 Mon Sep 17 00:00:00 2001 From: i329347 Date: Tue, 5 Aug 2025 12:43:57 +0530 Subject: [PATCH 5/6] chore: update dependencies and remove workzone service parameters in mta.yaml --- mta.yaml | 4 ---- mtx/sidecar/package.json | 8 ++++---- package.json | 14 +++++++------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/mta.yaml b/mta.yaml index a371bdfd..d5c1e141 100644 --- a/mta.yaml +++ b/mta.yaml @@ -5,10 +5,6 @@ description: "A simple CAP project." parameters: enable-parallel-deployments: true deploy_mode: html5-repo - workzoneServicePlan: local-entry-point - workzoneServiceName: build-workzone-standard - lepExposureId: ga.service - workzoneServiceProviderId: ga-${org}-${space} build-parameters: before-all: - builder: custom diff --git a/mtx/sidecar/package.json b/mtx/sidecar/package.json index 67db51b5..9a00016c 100644 --- a/mtx/sidecar/package.json +++ b/mtx/sidecar/package.json @@ -1,14 +1,14 @@ { "name": "incidents-mtx", "dependencies": { - "@cap-js/hana": "^1", - "@sap/cds": "^8", - "@sap/cds-mtxs": "^2", + "@cap-js/hana": "^2", + "@sap/cds": "^9", + "@sap/cds-mtxs": "^3", "@sap/xssec": "^4", "express": "^4" }, "devDependencies": { - "@cap-js/sqlite": "^1" + "@cap-js/sqlite": "^2" }, "scripts": { "start": "cds-serve" diff --git a/package.json b/package.json index d2b755ca..e2730e23 100644 --- a/package.json +++ b/package.json @@ -12,18 +12,18 @@ "dummy": 0 }, "dependencies": { - "@cap-js/hana": "^1.8.0", - "@sap/cds": "8.8.2", - "@sap/cds-mtxs": "^2", - "@sap/hana-client": "^2.24.21", + "@cap-js/hana": "^2", + "@sap/cds": "^9", + "@sap/cds-mtxs": "^3", + "@sap/hana-client": "^2", "@sap/xssec": "^4", "express": "^4" }, "devDependencies": { - "@cap-js/cds-test": "^0", + "@cap-js/cds-test": "latest", "@cap-js/change-tracking": "^1.0.6", - "@cap-js/sqlite": "^1.0.1", - "@sap/cds-dk": "^8.8.2", + "@cap-js/sqlite": "latest", + "@sap/cds-dk": "^9", "@sap/ux-specification": "^1.108.4" }, "scripts": { From b8cf1018bd2166decdd4cd1e7ded2d6f59ba4f1d Mon Sep 17 00:00:00 2001 From: i329347 Date: Wed, 6 Aug 2025 11:41:59 +0530 Subject: [PATCH 6/6] local multitenancy --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index e2730e23..47710db7 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,9 @@ ], "cds": { "requires": { + "[local-multitenancy]": { + "multitenancy": true + }, "auth": { "[development]": { "users": {