[英]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.