on 08-11-2021 9:08 AM
I have created an SAPUI5 application with standalone approuter in BAS (Business Application Studio) on a Cloud Foundry environment.
I want to link the Run Configuration to the theming service I've created in order to launch the app locally with a custom theme.
Steps I've taken:
{
"source": "^/comsapuitheming.runtime/(.*)$",
"target": "$1",
"service": "com.sap.ui.theming",
"endpoint": "runtime",
"authenticationType": "xsuaa",
"csrfProtection": false,
"scope": [
"$XSAPPNAME.User"
]
},
The Run Configuration launches the following script
fiori run --open 'index.html?sap-client=100'
but when the application is launched all the theming resources are not loaded by chrome.
Can someone help me?
Thanks,
Pietro
Hello pietro_modi42,
I was able to reproduce the issue locally in BAS. Unfortunately I must say that currently it is not possible to run application locally with linked theming service.
However I can propose a workaround. You can export your theme and then run it locally together with your application.
To do so you need to do the following:
1. Export your theme. By exporting expand the "Optional Settings (for Experts)" and select "Source Files + CSS Resources + Base Theme Resources".
2. Copy the zip file into your BAS workspace and extract it to e.g. "/home/user/projects/<mytheme>"
3. Assuming you have the following configuration in your index.html
data-sap-ui-versionedLibCss="true"
data-sap-ui-theme="<mytheme>"
data-sap-ui-theme-roots='{
"<mytheme>": "/comsapuitheming.runtime/themeroot/v1/UI5"
}'
then you need to add the following configuration into the "ui5.yaml"
- name: fiori-tools-servestatic
afterMiddleware: compression
configuration:
paths:
- path: "/comsapuitheming.runtime/themeroot/v1/"
src: "/home/user/projects/<mytheme>"
fallthrough: false
4. Now if you execute
npx fiori run --open index.html
the application should start with your custom theme.
Hope this helps!
Best regards,
Zdravko
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello zdravko.georgiev ,
first of all thank you for your help on this issue.
The workaround you proposed is surely a step forward but I believe it should be still possible to use CF services like the theming one in locally run applications, like the old non-UI5-tooling system allowed me to.
Do you know if there will be a "fiori-tools-cfservice" middleware in the near future offered by SAP?
Could you in case put forward an internal request to implement something like this?
I'm working in a highly customized application scenario where changes to the theme (CSS section) are not uncommon.
Best regards,
Pietro
Hi pietro_modi42,
thanks a lot for you feedback! I will forward your query to the responsible team.
Best regards,
Zdravko
Hi Pietro,
there is maybe one thing that you can try, so that you won't need to download the theme locally. Theoretically what you can do is to create a destination in BTP that points to your theming service. In the destination you will need to set as Authentication "OAuth2ClientCredentials" and provide the Client ID and the Client Secret of your theming service. Finally you will need to update the "ui5.yaml" so that the theming service requests can be forwarded to the destination.
Do you have access to your BTP account? Is creating a destination an option for you?
Best regards,
Zdravko
Hi zdravko.georgiev,
sorry for the late reply. Yes I have access to the BTP development subaccount and I am able to create new destinations.
This is what I've done:
Unfortunately I don't know how to update the ui5.yaml file with the request forwarding. I've tried looking the documentation to no avail. Can you help me on that?
Best regards,
Pietro
HI pietro_modi42,
you need to add one additional backend in the "ui5.yaml". You should add the following under backend
- path: /comsapuitheming.runtime
pathPrefix: /
url: https://theming-runtime.cfapps.eu10.hana.ondemand.com
destination: Theming
Hope this helps!
Best regards,
Zdravko
Hi Enrico, based on the screenshots I believe that the configuration in the yaml file is not correct.
Please see here an example on how to define multiple backends https://www.npmjs.com/package/@sap/ux-ui5-tooling#connecting-to-multiple-back-end-systems. Please pay attention to the indentation, it is very important in yaml files!
Hope this helps!
Best regards,
Zdravko
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.