[英]How to use custom control in Fiori launchpad of Cloud Foundry
在Cloud Foundry的Fiori启动板上将Monitor应用程序部署为SAPUI5应用程序时,遇到错误:
找不到404: https : //sapui5.hana.ondemand.com/resources/sap/ui/iot/controls/IoTChart.js
我在FLP中的配置:
/xs-app.json:
{
"source": "^/resources/sap/ui/iot/(.*)$",
"destination": "IOTAS_CONTROLS",
"target": "/sap/ui/iot/$1"
}
/mtad.yaml
modules:
requires:
- name: IOTAS_CONTROLS
group: destinations
properties:
forwardAuthToken: true
strictSSL: false
name: IOTAS_CONTROLS
url: ~{url}
resources:
- name: IOTAS_CONTROLS
properties:
url: https://sapuiiot-sb.cfapps.sap.hana.ondemand.com
/Main.view.xml
<mvc:View
controllerName="monitor.controller.Main"
xmlns:iot="sap.ui.iot.controls"
xmlns:iotele="sap.ui.iot.elements"
xmlns:action="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1"
displayBlock="false">
<iot:IoTChart noOfHours="1" headerTitle="Temperature & Gas Volume" subheaderTitle="Unit: Degree & M3"/>
我试图阅读Controller.js
“ https://xxx-flp-sandbox.cfapps.sap.hana.ondemand.com/resources/sap/ui/iot/controls/IoTChart.js ”,它被重定向到“ https://sapuiiot-sb.cfapps.sap.hana.ondemand.com/sap/ui/iot/controls/IoTChart.js “成功,证明了xs-app.json
的路由有效。
所以我的问题是,似乎如果XML View中需要sap.ui.iot.controls
,它将始终使用域: https://sapui5.hana.ondemand.com
: sap.ui.iot.controls
进行调用,而在xs-app.js中没有通过路由。
此项目在webIDE中成功运行,因为在neo-app.json
,它定义了一条路由,该路由将所有/resource/
重定向,请求始终在webIDE主机中,而在Cloud Foundry中,它在sapui5.hana.ondemand
主机中
有什么建议吗?
尝试过:
jQuery.sap.registerResourcePath("iotChart", "../../../../resources/sap/ui/iot/library")
jQuery.sap.require("iotChart")
//Still load host sapui5.hana.ondemand.com
var core=sap.ui.getCore();
core.loadLibrary("sap.ui.iot.controls");
通过在Component.js中添加一行来解决:
init : function() {
jQuery.sap.registerModulePath("sap.ui.iot", "../../../../resources/sap/ui/iot");
}
此外,“ sap.ui.iot”仍然不能在rootView.view.xml上声明,因为到那时,路径尚未注册。 但是new sap.ui.controls.IoTChart()
可以在控制器中使用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.