startup params (#637)

* startup params

* abaplint fix

* bugfix unit test
This commit is contained in:
oblomov 2023-11-10 15:00:52 +01:00 committed by GitHub
parent 59a5de9617
commit 9096bc32d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 59 additions and 9 deletions

View File

@ -136,6 +136,7 @@ ENDCLASS.
CLASS z2ui5_cl_fw_handler IMPLEMENTATION.
METHOD app_set_next.
app->id = COND #( WHEN app->id IS INITIAL THEN z2ui5_cl_fw_utility=>func_get_uuid_32( ) ELSE app->id ).
@ -157,6 +158,7 @@ CLASS z2ui5_cl_fw_handler IMPLEMENTATION.
ENDMETHOD.
METHOD request_begin.
so_body = z2ui5_cl_fw_utility_json=>factory( body ).
@ -164,10 +166,55 @@ CLASS z2ui5_cl_fw_handler IMPLEMENTATION.
TRY.
DATA(location) = so_body->get_attribute( `OLOCATION` ).
ss_config-body = body.
ss_config-search = location->get_attribute( `SEARCH` )->get_val( ).
ss_config-origin = location->get_attribute( `ORIGIN` )->get_val( ).
ss_config-pathname = location->get_attribute( `PATHNAME` )->get_val( ).
ss_config-version = location->get_attribute( `VERSION` )->get_val( ).
TRY.
ss_config-search = location->get_attribute( `SEARCH` )->get_val( ).
CATCH cx_root.
ENDTRY.
TRY.
ss_config-origin = location->get_attribute( `ORIGIN` )->get_val( ).
CATCH cx_root.
ENDTRY.
TRY.
ss_config-pathname = location->get_attribute( `PATHNAME` )->get_val( ).
CATCH cx_root.
ENDTRY.
TRY.
ss_config-version = location->get_attribute( `VERSION` )->get_val( ).
CATCH cx_root.
ENDTRY.
TRY.
ss_config-check_launchpad_active = location->get_attribute( `CHECK_LAUNCHPAD_ACTIVE` )->get_val( ).
CATCH cx_root.
ENDTRY.
TRY.
FIELD-SYMBOLS <struc> TYPE any.
DATA(ls_params) = location->get_attribute( `STARTUP_PARAMETERS` )->get_val_ref( ).
ASSIGN ls_params->* TO <struc>.
DATA(lt_comp) = z2ui5_cl_fw_utility=>rtti_get_t_comp_by_struc( <struc> ).
LOOP AT lt_comp INTO DATA(ls_comp).
FIELD-SYMBOLS <val_ref> TYPE REF TO data.
FIELD-SYMBOLS <tab> TYPE table.
FIELD-SYMBOLS <val2> TYPE data.
ASSIGN COMPONENT ls_comp-name OF STRUCTURE <struc> TO <val_ref>.
ASSIGN <val_ref>->* TO <tab>.
ASSIGN <tab>[ 1 ] TO <val_ref>.
ASSIGN <val_ref>->* TO <val2>.
INSERT VALUE #( n = ls_comp-name v = <val2> ) INTO TABLE ss_config-t_startup_params.
ENDLOOP.
CATCH cx_root.
ENDTRY.
CATCH cx_root.
ENDTRY.
ss_config-view_model_edit_name = z2ui5_cl_fw_binding=>cv_model_edit_name.
@ -407,6 +454,4 @@ CLASS z2ui5_cl_fw_handler IMPLEMENTATION.
result->ms_db-app->id = result->ms_db-id.
ENDMETHOD.
ENDCLASS.

View File

@ -259,7 +259,7 @@ CLASS Z2UI5_CL_FW_HTTP_HANDLER IMPLEMENTATION.
` const hash = ( oCrossAppNavigator.hrefForExternal({` && |\n| &&
` target: args[1],` && |\n| &&
` params: args[2]` && |\n| &&
` })) || "";` && |\n| &&
` } )) || "";` && |\n| &&
|\n| &&
` if (args[3] === 'EXT') {` && |\n| &&
|\n| &&
@ -461,7 +461,7 @@ CLASS Z2UI5_CL_FW_HTTP_HANDLER IMPLEMENTATION.
` sap.m.MessageBox[sap.z2ui5.oResponse.PARAMS.S_MSG_BOX.TYPE](sap.z2ui5.oResponse.PARAMS.S_MSG_BOX.TEXT);` && |\n| &&
` }` && |\n| &&
` if (sap.z2ui5.oResponse.SEARCH != "") {` && |\n| &&
` history.replaceState(null, null, sap.z2ui5.oResponse.SEARCH );` && |\n| &&
` history.replaceState(null, null, window.location.pathname + '?' + sap.z2ui5.oResponse.SEARCH );` && |\n| &&
` }` && |\n| &&
` if (sap.z2ui5.oResponse.PARAMS.S_MESSAGE_MANAGER.CHECK_CLEAR == true) {` && |\n| &&
` sap.ui.getCore().getMessageManager().removeAllMessages(); ` && |\n| &&
@ -493,11 +493,14 @@ CLASS Z2UI5_CL_FW_HTTP_HANDLER IMPLEMENTATION.
` sap.z2ui5.checkNestAfter = false;` && |\n| &&
` sap.z2ui5.checkNestAfter2 = false;` && |\n| &&
|\n| &&
` debugger;` && |\n| &&
` sap.z2ui5.oBody.OLOCATION = {` && |\n| &&
` ORIGIN: window.location.origin,` && |\n| &&
` PATHNAME: sap.z2ui5.pathname,` && |\n| &&
` SEARCH: window.location.search,` && |\n| &&
` VERSION: sap.ui.getVersionInfo().gav,` && |\n| &&
` CHECK_LAUNCHPAD_ACTIVE: sap.ushell !== undefined,` && |\n| &&
` STARTUP_PARAMETERS: sap.z2ui5.startupParameters,` && |\n| &&
` };` && |\n| &&
` if(sap.z2ui5.search) { sap.z2ui5.oBody.OLOCATION.SEARCH = sap.z2ui5.search; }` && |\n| &&
|\n| &&
@ -528,7 +531,7 @@ CLASS Z2UI5_CL_FW_HTTP_HANDLER IMPLEMENTATION.
` var oViewNest2 = sap.ui.xmlview({ viewContent: xml });` && |\n| &&
` sap.z2ui5.oControllerNest = oViewNest.getController();` && |\n| &&
` sap.z2ui5.oControllerNest2 = oViewNest.getController();` && |\n| &&
` sap.z2ui5.checkLogActive = ` && z2ui5_cl_fw_utility=>boolean_abap_2_json( check_logging ) && `;` && |\n| &&
` sap.z2ui5.checkLogActive = ` && z2ui5_cl_fw_utility=>boolean_abap_2_json( check_logging ) && `;` && |\n| &&
` sap.z2ui5.oBody = {};` && |\n| &&
` sap.z2ui5.oBody.APP_START = sap.z2ui5.APP_START;` && |\n| &&
` sap.z2ui5.oController.Roundtrip();` && |\n| &&

View File

@ -44,6 +44,8 @@ INTERFACE z2ui5_if_client
pathname TYPE string,
search TYPE string,
body TYPE string,
CHECK_LAUNCHPAD_ACTIVE TYPE abap_bool,
t_startup_params type ty_t_name_value,
END OF ty_s_config.
TYPES: