diff --git a/app/webapp/cc/Server.js b/app/webapp/cc/Server.js index 3819f3df..bfa94378 100644 --- a/app/webapp/cc/Server.js +++ b/app/webapp/cc/Server.js @@ -105,13 +105,15 @@ sap.ui.define(["sap/ui/core/BusyIndicator", "sap/m/MessageBox" } ; if (z2ui5.oResponse.PARAMS?.S_FOLLOW_UP_ACTION?.CUSTOM_JS) { setTimeout(() => { - let mParams = z2ui5.oResponse?.PARAMS.S_FOLLOW_UP_ACTION.CUSTOM_JS.split("'"); + for ( let i = 0; i < z2ui5.oResponse?.PARAMS.S_FOLLOW_UP_ACTION.CUSTOM_JS.length ; i++ ){ + let mParams = z2ui5.oResponse?.PARAMS.S_FOLLOW_UP_ACTION.CUSTOM_JS[i].split("'"); let mParamsEF = mParams.filter((val, index) => index % 2) if (mParamsEF.length) { z2ui5.oController.eF.apply(undefined, mParamsEF); } else { Function("return " + mParams[0])(); } + } }, 100); }; z2ui5.oController.showMessage('S_MSG_TOAST', z2ui5.oResponse.PARAMS); diff --git a/app/webapp/controller/App.controller.js b/app/webapp/controller/App.controller.js index 46ab74b4..bba211f1 100644 --- a/app/webapp/controller/App.controller.js +++ b/app/webapp/controller/App.controller.js @@ -12,7 +12,7 @@ sap.ui.define(["sap/ui/core/mvc/Controller", }; z2ui5.oController = new Controller(); - z2ui5.oController.setApp(this.getView().byId("app")); + z2ui5.oApp = this.getView().byId("app"); z2ui5.oControllerNest = new Controller(); z2ui5.oControllerNest2 = new Controller(); diff --git a/app/webapp/controller/View1.controller.js b/app/webapp/controller/View1.controller.js index eac84f1d..6ea7bcb7 100644 --- a/app/webapp/controller/View1.controller.js +++ b/app/webapp/controller/View1.controller.js @@ -1,9 +1,9 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/model/json/JSONModel", "sap/ui/core/BusyIndicator", "sap/m/MessageBox", "sap/m/MessageToast", "sap/ui/core/Fragment", "sap/m/BusyDialog", - "sap/ui/VersionInfo", "z2ui5/cc/Server", + "sap/ui/VersionInfo", "z2ui5/cc/Server", "sap/ui/model/odata/v2/ODataModel", ], function (Controller, XMLView, JSONModel, BusyIndicator, MessageBox, MessageToast, Fragment, mBusyDialog, VersionInfo, - Server) { + Server, ODataModel) { "use strict"; return Controller.extend("z2ui5.controller.View1", { @@ -242,12 +242,12 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/ } break; case 'SET_ODATA_MODEL': - sap.ui.require([ - "sap/ui/model/odata/v2/ODataModel" - ], async (ODataModel) => { + // sap.ui.require([ + // "sap/ui/model/odata/v2/ODataModel" + // ], async (ODataModel) => { var oModel = new ODataModel({ serviceUrl : args[1] }); z2ui5.oView.setModel( oModel , args[2] ); - }); + // }); break; case 'DOWNLOAD_B64_FILE': var a = document.createElement("a"); @@ -455,14 +455,12 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/ } } }, - setApp(oApp) { - this._oApp = oApp; - }, async displayView(xml, viewModel) { let oview_model = new JSONModel(viewModel); var oModel = oview_model; if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL){ - oModel = z2ui5.oOwnerComponent.getModel(z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL); + oModel = new ODataModel({ serviceUrl : z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL }); + // oModel = z2ui5.oOwnerComponent.getModel(z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL); } z2ui5.oView = await XMLView.create({ definition: xml, @@ -481,8 +479,8 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/ if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL){ z2ui5.oView.setModel(oview_model, "http"); } - this._oApp.removeAllPages(); - this._oApp.insertPage(z2ui5.oView); + z2ui5.oApp.removeAllPages(); + z2ui5.oApp.insertPage(z2ui5.oView); }, }) }); \ No newline at end of file diff --git a/app/webapp/manifest.json b/app/webapp/manifest.json index eff9ee1f..ed575565 100644 --- a/app/webapp/manifest.json +++ b/app/webapp/manifest.json @@ -15,15 +15,6 @@ "toolsId": "3a966e20-9635-4c28-8861-d1b66f79f1de" }, "dataSources": { - "test": { - "uri": "/sap/opu/odata/DMO/API_TRAVEL_U_V2/", - "type": "OData", - "settings": { - "annotations": [], - "localUri": "localService/metadata.xml", - "odataVersion": "2.0" - } - }, "http": { "uri": "/sap/bc/z2ui5", "type": "OData", @@ -83,11 +74,6 @@ } }, "models": { - "test": { - "dataSource": "test", - "preload": true, - "settings": {} - }, "http": { "dataSource": "http", "preload": true, diff --git a/src/01/02/z2ui5_cl_core_action.clas.abap b/src/01/02/z2ui5_cl_core_action.clas.abap index 08b8c5f0..2fcc6f9e 100644 --- a/src/01/02/z2ui5_cl_core_action.clas.abap +++ b/src/01/02/z2ui5_cl_core_action.clas.abap @@ -91,8 +91,9 @@ CLASS z2ui5_cl_core_action IMPLEMENTATION. CATCH cx_root INTO DATA(x). RAISE EXCEPTION TYPE z2ui5_cx_util_error - EXPORTING val = |App with name { mo_http_post->ms_request-s_control-app_start } not found...| - previous = x. + EXPORTING + val = |App with name { mo_http_post->ms_request-s_control-app_start } not found...| + previous = x. ENDTRY. ENDMETHOD. @@ -166,10 +167,9 @@ CLASS z2ui5_cl_core_action IMPLEMENTATION. result->ms_next-s_set-s_popover-check_update_model = abap_false. IF ms_next-s_set-s_follow_up_action IS NOT INITIAL. - " .eB(['POPUP_CONFIRM']) - " TODO: variable is assigned but never used (ABAP cleaner) - SPLIT ms_next-s_set-s_follow_up_action-custom_js AT `.eB(['` INTO DATA(lv_dummy) - result->ms_actual-event. + DATA(lv_action) = ms_next-s_set-s_follow_up_action-custom_js[ 1 ]. + SPLIT lv_action AT `.eB(['` INTO DATA(lv_dummy) + result->ms_actual-event. SPLIT result->ms_actual-event AT `']` INTO result->ms_actual-event lv_dummy. ENDIF. result->ms_actual-r_data = ms_next-r_data. diff --git a/src/01/02/z2ui5_cl_core_client.clas.abap b/src/01/02/z2ui5_cl_core_client.clas.abap index 9ae24bba..916667ea 100644 --- a/src/01/02/z2ui5_cl_core_client.clas.abap +++ b/src/01/02/z2ui5_cl_core_client.clas.abap @@ -27,7 +27,8 @@ CLASS z2ui5_cl_core_client IMPLEMENTATION. METHOD z2ui5_if_client~follow_up_action. - mo_action->ms_next-s_set-s_follow_up_action-custom_js = val. +* mo_action->ms_next-s_set-s_follow_up_action-custom_js = val. + insert val into table mo_action->ms_next-s_set-s_follow_up_action-custom_js. ENDMETHOD. diff --git a/src/01/02/z2ui5_if_core_types.intf.abap b/src/01/02/z2ui5_if_core_types.intf.abap index 70585d37..e5beca66 100644 --- a/src/01/02/z2ui5_if_core_types.intf.abap +++ b/src/01/02/z2ui5_if_core_types.intf.abap @@ -132,7 +132,7 @@ INTERFACE z2ui5_if_core_types closeonbrowsernavigation TYPE string, END OF s_msg_toast, BEGIN OF s_follow_up_action, - custom_js TYPE string, + custom_js TYPE string_table, END OF s_follow_up_action, * handler_attrs TYPE ty_s_http_handler_attributes, s_stateful TYPE ty_s_http_res-s_stateful, diff --git a/src/01/03/z2ui5_cl_app_app_js.clas.abap b/src/01/03/z2ui5_cl_app_app_js.clas.abap index ba0f7b68..182c9c9f 100644 --- a/src/01/03/z2ui5_cl_app_app_js.clas.abap +++ b/src/01/03/z2ui5_cl_app_app_js.clas.abap @@ -32,7 +32,7 @@ CLASS z2ui5_cl_app_app_js IMPLEMENTATION. ` };` && |\n| && `` && |\n| && ` z2ui5.oController = new Controller();` && |\n| && - ` z2ui5.oController.setApp(this.getView().byId("app"));` && |\n| && + ` z2ui5.oApp = this.getView().byId("app");` && |\n| && `` && |\n| && ` z2ui5.oControllerNest = new Controller();` && |\n| && ` z2ui5.oControllerNest2 = new Controller();` && |\n| && diff --git a/src/01/03/z2ui5_cl_app_manifest_json.clas.abap b/src/01/03/z2ui5_cl_app_manifest_json.clas.abap index c109cf4e..4041e783 100644 --- a/src/01/03/z2ui5_cl_app_manifest_json.clas.abap +++ b/src/01/03/z2ui5_cl_app_manifest_json.clas.abap @@ -35,15 +35,6 @@ CLASS z2ui5_cl_app_manifest_json IMPLEMENTATION. ` "toolsId": "3a966e20-9635-4c28-8861-d1b66f79f1de"` && ` },` && ` "dataSources": {` && - ` "test": {` && - ` "uri": "/sap/opu/odata/DMO/API_TRAVEL_U_V2/",` && - ` "type": "OData",` && - ` "settings": {` && - ` "annotations": [],` && - ` "localUri": "localService/metadata.xml",` && - ` "odataVersion": "2.0"` && - ` }` && - ` },` && ` "http": {` && ` "uri": "/sap/bc/z2ui5",` && ` "type": "OData",` && @@ -103,11 +94,6 @@ CLASS z2ui5_cl_app_manifest_json IMPLEMENTATION. ` }` && ` },` && ` "models": {` && - ` "test": {` && - ` "dataSource": "test",` && - ` "preload": true,` && - ` "settings": {}` && - ` },` && ` "http": {` && ` "dataSource": "http",` && ` "preload": true,` && diff --git a/src/01/03/z2ui5_cl_app_server_js.clas.abap b/src/01/03/z2ui5_cl_app_server_js.clas.abap index 7e151ee4..cd19fc46 100644 --- a/src/01/03/z2ui5_cl_app_server_js.clas.abap +++ b/src/01/03/z2ui5_cl_app_server_js.clas.abap @@ -125,13 +125,15 @@ CLASS z2ui5_cl_app_server_js IMPLEMENTATION. ` }` && |\n| && ` ; if (z2ui5.oResponse.PARAMS?.S_FOLLOW_UP_ACTION?.CUSTOM_JS) {` && |\n| && ` setTimeout(() => {` && |\n| && - ` let mParams = z2ui5.oResponse?.PARAMS.S_FOLLOW_UP_ACTION.CUSTOM_JS.split("'");` && |\n| && + ` for ( let i = 0; i < z2ui5.oResponse?.PARAMS.S_FOLLOW_UP_ACTION.CUSTOM_JS.length ; i++ ){` && |\n| && + ` let mParams = z2ui5.oResponse?.PARAMS.S_FOLLOW_UP_ACTION.CUSTOM_JS[i].split("'");` && |\n| && ` let mParamsEF = mParams.filter((val, index) => index % 2)` && |\n| && ` if (mParamsEF.length) {` && |\n| && ` z2ui5.oController.eF.apply(undefined, mParamsEF);` && |\n| && ` } else {` && |\n| && ` Function("return " + mParams[0])();` && |\n| && ` }` && |\n| && + ` }` && |\n| && ` }, 100);` && |\n| && ` };` && |\n| && ` z2ui5.oController.showMessage('S_MSG_TOAST', z2ui5.oResponse.PARAMS);` && |\n| && diff --git a/src/01/03/z2ui5_cl_app_view1_js.clas.abap b/src/01/03/z2ui5_cl_app_view1_js.clas.abap index 1c06deac..6f8d514f 100644 --- a/src/01/03/z2ui5_cl_app_view1_js.clas.abap +++ b/src/01/03/z2ui5_cl_app_view1_js.clas.abap @@ -20,10 +20,10 @@ CLASS z2ui5_cl_app_view1_js IMPLEMENTATION. result = `sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/model/json/JSONModel",` && |\n| && ` "sap/ui/core/BusyIndicator", "sap/m/MessageBox", "sap/m/MessageToast", "sap/ui/core/Fragment", "sap/m/BusyDialog",` && |\n| && - ` "sap/ui/VersionInfo", "z2ui5/cc/Server",` && |\n| && + ` "sap/ui/VersionInfo", "z2ui5/cc/Server", "sap/ui/model/odata/v2/ODataModel",` && |\n| && `],` && |\n| && ` function (Controller, XMLView, JSONModel, BusyIndicator, MessageBox, MessageToast, Fragment, mBusyDialog, VersionInfo,` && |\n| && - ` Server) {` && |\n| && + ` Server, ODataModel) {` && |\n| && ` "use strict";` && |\n| && ` return Controller.extend("z2ui5.controller.View1", {` && |\n| && `` && |\n| && @@ -262,12 +262,12 @@ CLASS z2ui5_cl_app_view1_js IMPLEMENTATION. ` }` && |\n| && ` break;` && |\n| && ` case 'SET_ODATA_MODEL':` && |\n| && - ` sap.ui.require([` && |\n| && - ` "sap/ui/model/odata/v2/ODataModel"` && |\n| && - ` ], async (ODataModel) => {` && |\n| && + ` // sap.ui.require([` && |\n| && + ` // "sap/ui/model/odata/v2/ODataModel"` && |\n| && + ` // ], async (ODataModel) => {` && |\n| && ` var oModel = new ODataModel({ serviceUrl : args[1] });` && |\n| && ` z2ui5.oView.setModel( oModel , args[2] );` && |\n| && - ` });` && |\n| && + ` // });` && |\n| && ` break;` && |\n| && ` case 'DOWNLOAD_B64_FILE':` && |\n| && ` var a = document.createElement("a");` && |\n| && @@ -475,14 +475,12 @@ CLASS z2ui5_cl_app_view1_js IMPLEMENTATION. ` }` && |\n| && ` }` && |\n| && ` },` && |\n| && - ` setApp(oApp) {` && |\n| && - ` this._oApp = oApp;` && |\n| && - ` },` && |\n| && ` async displayView(xml, viewModel) {` && |\n| && ` let oview_model = new JSONModel(viewModel);` && |\n| && ` var oModel = oview_model;` && |\n| && ` if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL){` && |\n| && - ` oModel = z2ui5.oOwnerComponent.getModel(z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL);` && |\n| && + ` oModel = new ODataModel({ serviceUrl : z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL });` && |\n| && + ` // oModel = z2ui5.oOwnerComponent.getModel(z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL);` && |\n| && ` }` && |\n| && ` z2ui5.oView = await XMLView.create({` && |\n| && ` definition: xml,` && |\n| && @@ -501,8 +499,8 @@ CLASS z2ui5_cl_app_view1_js IMPLEMENTATION. ` if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL){` && |\n| && ` z2ui5.oView.setModel(oview_model, "http");` && |\n| && ` }` && |\n| && - ` this._oApp.removeAllPages();` && |\n| && - ` this._oApp.insertPage(z2ui5.oView);` && |\n| && + ` z2ui5.oApp.removeAllPages();` && |\n| && + ` z2ui5.oApp.insertPage(z2ui5.oView);` && |\n| && ` },` && |\n| && ` })` && |\n| && ` });` && |\n| &&