0
votes

As I deploy Monitor app as a SAPUI5 app in Fiori launchpad in Cloud Foundry, I encountered an error:

404 Not Found: https://sapui5.hana.ondemand.com/resources/sap/ui/iot/controls/IoTChart.js

My Configuration in 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 &amp; Gas Volume" subheaderTitle="Unit: Degree &amp; M3"/>

I have tried to read "https://xxx-flp-sandbox.cfapps.sap.hana.ondemand.com/resources/sap/ui/iot/controls/IoTChart.js" in Controller.js, it is redirected to "https://sapuiiot-sb.cfapps.sap.hana.ondemand.com/sap/ui/iot/controls/IoTChart.js" successfully, which proved the route in xs-app.json worked.

So my question is, it seems if sap.ui.iot.controls is required in XML View, it will always called with domain: https://sapui5.hana.ondemand.com without pass route in xs-app.js.

This project is run successfully in webIDE, because in neo-app.json, it defined a route, which redirect all /resource/, request is always in webIDE host, but in cloud foundry, it is in sapui5.hana.ondemand host

Any Suggestion?


Tried:

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");
1

1 Answers

0
votes

Solved by add one line in Component.js:

init : function() {
    jQuery.sap.registerModulePath("sap.ui.iot", "../../../../resources/sap/ui/iot");
}

Besides, "sap.ui.iot" still cannot declared at rootView.view.xml, because by that time, path is not registered. But new sap.ui.controls.IoTChart() can be used in controller