Smart control fix (#1609)
Some checks are pending
build_downport / build_downport (push) Waiting to run
build_frontend_classic / build_frontend_classic (push) Waiting to run
build_frontend_cloud / build_frontend_cloud (push) Waiting to run
js_transform / Code-Cleanup (push) Waiting to run
ui5lint / test (push) Waiting to run

* smart control fix

* update
This commit is contained in:
oblomov-dev 2024-12-03 12:44:25 +01:00 committed by GitHub
parent 620be93586
commit c1ab4e6658
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 22 additions and 20 deletions

View File

@ -13,7 +13,8 @@ sap.ui.define(["sap/ui/core/UIComponent", "z2ui5/model/models","z2ui5/cc/Server"
}
this.getRouter().initialize();
z2ui5.oRouter = this.getRouter();
this.setModel(Models.createDeviceModel(), "device");
z2ui5.oDeviceModel = Models.createDeviceModel();
this.setModel(z2ui5.oDeviceModel, "device");
z2ui5.oConfig = {};
z2ui5.oConfig.ComponentData = this.getComponentData();

View File

@ -5,7 +5,7 @@ sap.ui.define(["sap/ui/core/mvc/Controller",
onInit: async function () {
z2ui5.oModel2 = this.getView().getModel("");
z2ui5.oOwnerComponent = this.getOwnerComponent();
z2ui5.oConfig.pathname = this.getView().getModel("http").sServiceUrl;
if (z2ui5?.checkLocal == true ) {
z2ui5.oConfig.pathname = window.location.href;

View File

@ -346,7 +346,7 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/
BusyIndicator.show();
z2ui5.oBody = {};
if (args[0][3] || z2ui5.oController == this ) {
if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL == true ){
if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL){
var oModel = z2ui5.oView.getModel( "http");
}else{
oModel = z2ui5.oView.getModel();
@ -461,8 +461,8 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/
async displayView(xml, viewModel) {
let oview_model = new JSONModel(viewModel);
var oModel = oview_model;
if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL == true){
oModel = z2ui5.oModel2;
if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL){
oModel = z2ui5.oOwnerComponent.getModel(z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL);
}
z2ui5.oView = await XMLView.create({
definition: xml,
@ -478,7 +478,7 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/
}
});
z2ui5.oView.setModel(z2ui5.oDeviceModel, "device");
if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL == true){
if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL){
z2ui5.oView.setModel(oview_model, "http");
}
this._oApp.removeAllPages();

View File

@ -15,7 +15,7 @@
"toolsId": "3a966e20-9635-4c28-8861-d1b66f79f1de"
},
"dataSources": {
"mainService": {
"test": {
"uri": "/sap/opu/odata/DMO/API_TRAVEL_U_V2/",
"type": "OData",
"settings": {
@ -83,8 +83,8 @@
}
},
"models": {
"": {
"dataSource": "mainService",
"test": {
"dataSource": "test",
"preload": true,
"settings": {}
},

View File

@ -68,7 +68,7 @@ INTERFACE z2ui5_if_core_types
BEGIN OF ty_s_next_frontend,
BEGIN OF s_view,
xml TYPE string,
switchDefaultModel TYPE abap_bool,
switchDefaultModel TYPE string,
check_destroy TYPE abap_bool,
check_update_model TYPE abap_bool,
END OF s_view,

View File

@ -25,7 +25,7 @@ CLASS z2ui5_cl_app_app_js IMPLEMENTATION.
`` && |\n| &&
` onInit: async function () {` && |\n| &&
`` && |\n| &&
` z2ui5.oModel2 = this.getView().getModel("");` && |\n| &&
` z2ui5.oOwnerComponent = this.getOwnerComponent();` && |\n| &&
` z2ui5.oConfig.pathname = this.getView().getModel("http").sServiceUrl;` && |\n| &&
` if (z2ui5?.checkLocal == true ) {` && |\n| &&
` z2ui5.oConfig.pathname = window.location.href;` && |\n| &&

View File

@ -33,7 +33,8 @@ CLASS z2ui5_cl_app_component_js IMPLEMENTATION.
` }` && |\n| &&
` this.getRouter().initialize();` && |\n| &&
` z2ui5.oRouter = this.getRouter();` && |\n| &&
` this.setModel(Models.createDeviceModel(), "device");` && |\n| &&
` z2ui5.oDeviceModel = Models.createDeviceModel();` && |\n| &&
` this.setModel(z2ui5.oDeviceModel, "device");` && |\n| &&
`` && |\n| &&
` z2ui5.oConfig = {};` && |\n| &&
` z2ui5.oConfig.ComponentData = this.getComponentData();` && |\n| &&

View File

@ -35,7 +35,7 @@ CLASS z2ui5_cl_app_manifest_json IMPLEMENTATION.
` "toolsId": "3a966e20-9635-4c28-8861-d1b66f79f1de"` &&
` },` &&
` "dataSources": {` &&
` "mainService": {` &&
` "test": {` &&
` "uri": "/sap/opu/odata/DMO/API_TRAVEL_U_V2/",` &&
` "type": "OData",` &&
` "settings": {` &&
@ -103,8 +103,8 @@ CLASS z2ui5_cl_app_manifest_json IMPLEMENTATION.
` }` &&
` },` &&
` "models": {` &&
` "": {` &&
` "dataSource": "mainService",` &&
` "test": {` &&
` "dataSource": "test",` &&
` "preload": true,` &&
` "settings": {}` &&
` },` &&

View File

@ -366,7 +366,7 @@ CLASS z2ui5_cl_app_view1_js IMPLEMENTATION.
` BusyIndicator.show();` && |\n| &&
` z2ui5.oBody = {};` && |\n| &&
` if (args[0][3] || z2ui5.oController == this ) {` && |\n| &&
` if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL == true ){` && |\n| &&
` if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL){` && |\n| &&
` var oModel = z2ui5.oView.getModel( "http");` && |\n| &&
` }else{` && |\n| &&
` oModel = z2ui5.oView.getModel();` && |\n| &&
@ -481,8 +481,8 @@ CLASS z2ui5_cl_app_view1_js IMPLEMENTATION.
` async displayView(xml, viewModel) {` && |\n| &&
` let oview_model = new JSONModel(viewModel);` && |\n| &&
` var oModel = oview_model;` && |\n| &&
` if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL == true){` && |\n| &&
` oModel = z2ui5.oModel2;` && |\n| &&
` if (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| &&
@ -498,7 +498,7 @@ CLASS z2ui5_cl_app_view1_js IMPLEMENTATION.
` }` && |\n| &&
` });` && |\n| &&
` z2ui5.oView.setModel(z2ui5.oDeviceModel, "device");` && |\n| &&
` if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL == true){` && |\n| &&
` if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL){` && |\n| &&
` z2ui5.oView.setModel(oview_model, "http");` && |\n| &&
` }` && |\n| &&
` this._oApp.removeAllPages();` && |\n| &&

View File

@ -32,7 +32,7 @@ INTERFACE z2ui5_if_client
METHODS view_display
IMPORTING
val TYPE clike
switchDefaultModel TYPE abap_bool DEFAULT abap_false.
switchDefaultModel TYPE string OPTIONAL.
METHODS view_model_update.