Skip to content

Commit

Permalink
refactoring debug tools (abap2UI5#1445)
Browse files Browse the repository at this point in the history
* refactoring debug tools

* update
  • Loading branch information
oblomov-dev authored Sep 22, 2024
1 parent 498cdc7 commit 6c0843c
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 82 deletions.
7 changes: 4 additions & 3 deletions src/01/02/z2ui5_cl_core_http_get.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ CLASS z2ui5_cl_core_http_get IMPLEMENTATION.
result = VALUE #(
t_param = VALUE #(
( n = `TITLE` v = `abap2UI5` )
( n = `SET_SIZE_LIMIT` v = `100` )
)
t_config = VALUE #(
* ( n = `src` v = `https://sdk.openui5.org/1.71.67/resources/sap-ui-core.js` )
Expand Down Expand Up @@ -90,7 +89,7 @@ CLASS z2ui5_cl_core_http_get IMPLEMENTATION.
z2ui5_cl_cc_util=>get_js( ) &&
z2ui5_cl_cc_favicon=>get_js( ) &&
z2ui5_cl_cc_dirty=>get_js( ) &&
z2ui5_cl_cc_debug_tool=>get_js( ) &&
* z2ui5_cl_cc_debug_tool=>get_js( ) &&
` `.

ENDMETHOD.
Expand Down Expand Up @@ -146,14 +145,16 @@ CLASS z2ui5_cl_core_http_get IMPLEMENTATION.
` function onInitComponent(){` && |\n| &&
` sap.ui.require.preload({` && |\n| &&
` "z2ui5/manifest.json": '` && NEW z2ui5_cl_core_ui5_app( )->manifest_json( ) && ` ',` && |\n| &&
` "z2ui5/Component.js": function(){` && NEW z2ui5_cl_core_ui5_app( )->component_js( ) && lv_add_js && | sap.z2ui5.JSON_MODEL_LIMIT = { cs_config-t_param[ n = 'SET_SIZE_LIMIT' ]-v };| && ` },` && |\n| &&
` "z2ui5/Component.js": function(){` && NEW z2ui5_cl_core_ui5_app( )->component_js( ) && lv_add_js && ` },` && |\n| &&
` "z2ui5/css/style.css": function(){` && NEW z2ui5_cl_core_ui5_app( )->css_style_css( ) && `},` && |\n| &&
` "z2ui5/model/models.js": function(){` && NEW z2ui5_cl_core_ui5_app( )->model_models_js( ) && `},` && |\n| &&
` "z2ui5/i18n/i18n.properties": '` && NEW z2ui5_cl_core_ui5_app( )->i18n_i18n_properties( ) && `' ,` && |\n| &&
` "z2ui5/view/App.view.xml": '` && NEW z2ui5_cl_core_ui5_app( )->view_app_xml( ) && `' ,` && |\n| &&
` "z2ui5/controller/App.controller.js": function(){` && NEW z2ui5_cl_core_ui5_app( )->controller_app_js( ) && `},` && |\n| &&
` "z2ui5/view/View1.view.xml": '` && NEW z2ui5_cl_core_ui5_app( )->view_view1_xml( ) && `' ,` && |\n| &&
` "z2ui5/controller/View1.controller.js": function(){` && NEW z2ui5_cl_core_ui5_app( )->controller_view1_js( ) && `},` && |\n| &&
` "z2ui5/cc/DebugTool.fragment.xml": '` && z2ui5_cl_cc_debug_tool=>get_xml( ) && `' ,` && |\n| &&
` "z2ui5/cc/DebugTool.js": function(){` && z2ui5_cl_cc_debug_tool=>get_js( ) && `},` && |\n| &&
` });` && |\n| &&
` sap.ui.require(["sap/ui/core/ComponentSupport"], function(ComponentSupport){` && |\n| &&
` ComponentSupport.run();` && |\n| &&
Expand Down
35 changes: 21 additions & 14 deletions src/01/02/z2ui5_cl_core_ui5_app.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ CLASS z2ui5_cl_core_ui5_app IMPLEMENTATION.

METHOD controller_app_js.

result = ` sap.ui.define(["sap/ui/core/mvc/Controller", "z2ui5/controller/View1.controller", "sap/ui/core/BusyIndicator"], function(BaseController, Controller, BusyIndicator){` && |\n| &&
result = ` sap.ui.define(["sap/ui/core/mvc/Controller", "z2ui5/controller/View1.controller", "sap/ui/core/BusyIndicator" , "z2ui5/cc/DebugTool" ], function(BaseController, Controller, BusyIndicator, DebugTool){` && |\n| &&
` return BaseController.extend("z2ui5.controller.App", {` && |\n| &&
` onInit: function(){` && |\n| &&
` BusyIndicator.show();` && |\n| &&
Expand All @@ -120,11 +120,12 @@ CLASS z2ui5_cl_core_ui5_app IMPLEMENTATION.
` sap.z2ui5.checkNestAfter = false;` && |\n| &&
` sap.z2ui5.oBody = { };` && |\n| &&
` sap.z2ui5.oController.setApp(this.getView());` && |\n| &&
` sap.z2ui5.oController.Roundtrip();` && |\n| &&
` sap.z2ui5.onBeforeRoundtrip = [];` && |\n| &&
` sap.z2ui5.onAfterRendering = [];` && |\n| &&
` sap.z2ui5.onBeforeEventFrontend = [];` && |\n| &&
` sap.z2ui5.onAfterRoundtrip = []; ` && |\n| &&
` sap.z2ui5.DebugTool = new DebugTool()` && |\n| &&
` sap.z2ui5.oController.Roundtrip();` && |\n| &&
` }` && |\n| &&
` });` && |\n| &&
` });`.
Expand Down Expand Up @@ -200,7 +201,7 @@ CLASS z2ui5_cl_core_ui5_app IMPLEMENTATION.
` controller: sap.z2ui5.oControllerPopup,` && |\n| &&
` id: "popupId"` && |\n| &&
` });` && |\n| &&
` oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` // oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` oFragment.setModel(oview_model);` && |\n| &&
` sap.z2ui5[viewProp] = oFragment;` && |\n| &&
` sap.z2ui5[viewProp].Fragment = Fragment;` && |\n| &&
Expand All @@ -215,7 +216,7 @@ CLASS z2ui5_cl_core_ui5_app IMPLEMENTATION.
` id: "popoverId"` && |\n| &&
` });` && |\n| &&
` let oview_model = new JSONModel(sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
` oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` // oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` oFragment.setModel(oview_model);` && |\n| &&
` sap.z2ui5[viewProp] = oFragment;` && |\n| &&
` sap.z2ui5[viewProp].Fragment = Fragment;` && |\n| &&
Expand Down Expand Up @@ -246,7 +247,7 @@ CLASS z2ui5_cl_core_ui5_app IMPLEMENTATION.
` controller: sap.z2ui5.oControllerNest,` && |\n| &&
` preprocessors: { xml: { models: { template: oview_model } } }` && |\n| &&
` });` && |\n| &&
` oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` // oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` oView.setModel(oview_model);` && |\n| &&
` let oParent = sap.z2ui5.oView.byId(sap.z2ui5.oResponse.PARAMS[viewNestId].ID);` && |\n| &&
` if (oParent) {` && |\n| &&
Expand All @@ -264,7 +265,7 @@ CLASS z2ui5_cl_core_ui5_app IMPLEMENTATION.
` controller: sap.z2ui5.oControllerNest2,` && |\n| &&
` preprocessors: { xml: { models: { template: oview_model } } }` && |\n| &&
` });` && |\n| &&
` oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` // oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` oView.setModel(oview_model);` && |\n| &&
` let oParent = sap.z2ui5.oView.byId(sap.z2ui5.oResponse.PARAMS[viewNestId].ID);` && |\n| &&
` if (oParent) {` && |\n| &&
Expand Down Expand Up @@ -325,7 +326,13 @@ CLASS z2ui5_cl_core_ui5_app IMPLEMENTATION.
` let oCrossAppNavigator;` && |\n| &&
` switch (args[0]) {` && |\n| &&
` case 'SET_SIZE_LIMIT':` && |\n| &&
` sap.z2ui5.JSON_MODEL_LIMIT = args[1];` && |\n| &&
` switch (args[2]) { ` && |\n| &&
` case 'MAIN': sap.z2ui5.oView.getModel().setSizeLimit( parseInt( args[1] ) ); sap.z2ui5.oView.getModel().refresh(true); break; ` && |\n| &&
` case 'NEST': sap.z2ui5.oViewNest.getModel().setSizeLimit( parseInt( args[1] ) ); sap.z2ui5.oViewNest.getModel().refresh(true); break; ` && |\n| &&
` case 'NEST2': sap.z2ui5.oViewNest2.getModel().setSizeLimit( parseInt( args[1] ) ); sap.z2ui5.oViewNest2.getModel().refresh(true); break; ` && |\n| &&
` case 'POPUP': sap.z2ui5.oPopup.getModel().setSizeLimit( parseInt( args[1] ) ); sap.z2ui5.oPopup.getModel().refresh(true); break; ` && |\n| &&
` case 'POPOVER': sap.z2ui5.oPopover.getModel().setSizeLimit( parseInt( args[1] ) ); sap.z2ui5.oPopover.getModel().refresh(true); break; ` && |\n| &&
` }` && |\n| &&
` break;` && |\n| &&
` case 'DOWNLOAD_B64_FILE':` && |\n| &&
` var a = document.createElement("a");` && |\n| &&
Expand Down Expand Up @@ -455,7 +462,7 @@ CLASS z2ui5_cl_core_ui5_app IMPLEMENTATION.
` if (sap.z2ui5.oResponse.PARAMS == undefined) { return; }` && |\n| &&
` if (sap.z2ui5.oResponse.PARAMS[paramKey]?.CHECK_UPDATE_MODEL) {` && |\n| &&
` let model = new JSONModel(sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
` model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` // model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` if (oView) { oView.setModel(model); }` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
Expand Down Expand Up @@ -553,7 +560,7 @@ CLASS z2ui5_cl_core_ui5_app IMPLEMENTATION.
` },` && |\n| &&
` async createView(xml, viewModel) {` && |\n| &&
` let oview_model = new JSONModel(viewModel);` && |\n| &&
` oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` // oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` sap.z2ui5.oView = await XMLView.create({` && |\n| &&
` definition: xml,` && |\n| &&
` models: oview_model,` && |\n| &&
Expand All @@ -562,13 +569,13 @@ CLASS z2ui5_cl_core_ui5_app IMPLEMENTATION.
` preprocessors: { xml: { models: { template: oview_model } } }` && |\n| &&
` });` && |\n| &&
` sap.z2ui5.oView.setModel(sap.z2ui5.oDeviceModel, "device");` && |\n| &&
` if (sap.z2ui5.oParent) {` && |\n| &&
` sap.z2ui5.oParent.removeAllPages();` && |\n| &&
` sap.z2ui5.oParent.insertPage(sap.z2ui5.oView);` && |\n| &&
` } else {` && |\n| &&
` // if (sap.z2ui5.oParent) {` && |\n| &&
` // sap.z2ui5.oParent.removeAllPages();` && |\n| &&
` // sap.z2ui5.oParent.insertPage(sap.z2ui5.oView);` && |\n| &&
` // } else {` && |\n| &&
` this._oApp.byId("viewContainer").insertPage(sap.z2ui5.oView);` && |\n| &&
` // this._oApp.byId("viewContainer").addItem(sap.z2ui5.oView);` && |\n| &&
` }` && |\n| &&
` // }` && |\n| &&
` },` && |\n| &&
` async readHttp() {` && |\n| &&
|\n| &&
Expand Down
Loading

0 comments on commit 6c0843c

Please sign in to comment.