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(); this.getRouter().initialize();
z2ui5.oRouter = this.getRouter(); z2ui5.oRouter = this.getRouter();
this.setModel(Models.createDeviceModel(), "device"); z2ui5.oDeviceModel = Models.createDeviceModel();
this.setModel(z2ui5.oDeviceModel, "device");
z2ui5.oConfig = {}; z2ui5.oConfig = {};
z2ui5.oConfig.ComponentData = this.getComponentData(); z2ui5.oConfig.ComponentData = this.getComponentData();

View File

@ -5,7 +5,7 @@ sap.ui.define(["sap/ui/core/mvc/Controller",
onInit: async function () { onInit: async function () {
z2ui5.oModel2 = this.getView().getModel(""); z2ui5.oOwnerComponent = this.getOwnerComponent();
z2ui5.oConfig.pathname = this.getView().getModel("http").sServiceUrl; z2ui5.oConfig.pathname = this.getView().getModel("http").sServiceUrl;
if (z2ui5?.checkLocal == true ) { if (z2ui5?.checkLocal == true ) {
z2ui5.oConfig.pathname = window.location.href; 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(); BusyIndicator.show();
z2ui5.oBody = {}; z2ui5.oBody = {};
if (args[0][3] || z2ui5.oController == this ) { 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"); var oModel = z2ui5.oView.getModel( "http");
}else{ }else{
oModel = z2ui5.oView.getModel(); 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) { async displayView(xml, viewModel) {
let oview_model = new JSONModel(viewModel); let oview_model = new JSONModel(viewModel);
var oModel = oview_model; var oModel = oview_model;
if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL == true){ if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL){
oModel = z2ui5.oModel2; oModel = z2ui5.oOwnerComponent.getModel(z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL);
} }
z2ui5.oView = await XMLView.create({ z2ui5.oView = await XMLView.create({
definition: xml, 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"); 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"); z2ui5.oView.setModel(oview_model, "http");
} }
this._oApp.removeAllPages(); this._oApp.removeAllPages();

View File

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

View File

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

View File

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

View File

@ -33,7 +33,8 @@ CLASS z2ui5_cl_app_component_js IMPLEMENTATION.
` }` && |\n| && ` }` && |\n| &&
` this.getRouter().initialize();` && |\n| && ` this.getRouter().initialize();` && |\n| &&
` z2ui5.oRouter = this.getRouter();` && |\n| && ` z2ui5.oRouter = this.getRouter();` && |\n| &&
` this.setModel(Models.createDeviceModel(), "device");` && |\n| && ` z2ui5.oDeviceModel = Models.createDeviceModel();` && |\n| &&
` this.setModel(z2ui5.oDeviceModel, "device");` && |\n| &&
`` && |\n| && `` && |\n| &&
` z2ui5.oConfig = {};` && |\n| && ` z2ui5.oConfig = {};` && |\n| &&
` z2ui5.oConfig.ComponentData = this.getComponentData();` && |\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"` && ` "toolsId": "3a966e20-9635-4c28-8861-d1b66f79f1de"` &&
` },` && ` },` &&
` "dataSources": {` && ` "dataSources": {` &&
` "mainService": {` && ` "test": {` &&
` "uri": "/sap/opu/odata/DMO/API_TRAVEL_U_V2/",` && ` "uri": "/sap/opu/odata/DMO/API_TRAVEL_U_V2/",` &&
` "type": "OData",` && ` "type": "OData",` &&
` "settings": {` && ` "settings": {` &&
@ -103,8 +103,8 @@ CLASS z2ui5_cl_app_manifest_json IMPLEMENTATION.
` }` && ` }` &&
` },` && ` },` &&
` "models": {` && ` "models": {` &&
` "": {` && ` "test": {` &&
` "dataSource": "mainService",` && ` "dataSource": "test",` &&
` "preload": true,` && ` "preload": true,` &&
` "settings": {}` && ` "settings": {}` &&
` },` && ` },` &&

View File

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

View File

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