From 84c80a761cf702a666b734efd480b1c575d69681 Mon Sep 17 00:00:00 2001 From: Lars Hvam Date: Thu, 27 Aug 2020 07:51:51 +0200 Subject: [PATCH] refactoring, use interface for html (#3793) * refactoring, use interface for html replace uses of zcl_abapgit_html with zif_abapgit_html #3460 * replace additional uses of the A alias * This removes the A alias from the HTML class This removes the following alias, "a FOR zif_abapgit_html~a ." * fix syntax error --- src/ui/core/zcl_abapgit_html.clas.abap | 137 ++++++----- src/ui/zcl_abapgit_gui_chunk_lib.clas.abap | 175 +++++++------- .../zcl_abapgit_gui_page_debuginfo.clas.abap | 5 +- src/ui/zcl_abapgit_gui_page_diff.clas.abap | 223 +++++++++--------- src/ui/zcl_abapgit_gui_page_patch.clas.abap | 6 +- src/ui/zcl_abapgit_gui_page_stage.clas.abap | 74 +++--- .../zcl_abapgit_gui_page_view_repo.clas.abap | 32 +-- src/ui/zcl_abapgit_gui_repo_over.clas.abap | 13 +- 8 files changed, 336 insertions(+), 329 deletions(-) diff --git a/src/ui/core/zcl_abapgit_html.clas.abap b/src/ui/core/zcl_abapgit_html.clas.abap index 1b552e0e0..fcd0ad734 100644 --- a/src/ui/core/zcl_abapgit_html.clas.abap +++ b/src/ui/core/zcl_abapgit_html.clas.abap @@ -6,8 +6,6 @@ CLASS zcl_abapgit_html DEFINITION INTERFACES zif_abapgit_html . - ALIASES a - FOR zif_abapgit_html~a . ALIASES add FOR zif_abapgit_html~add . ALIASES add_a @@ -74,65 +72,6 @@ ENDCLASS. CLASS ZCL_ABAPGIT_HTML IMPLEMENTATION. - METHOD a. - - DATA: lv_class TYPE string, - lv_href TYPE string, - lv_click TYPE string, - lv_id TYPE string, - lv_style TYPE string, - lv_title TYPE string. - - lv_class = iv_class. - - IF iv_opt CA zif_abapgit_html=>c_html_opt-strong. - lv_class = lv_class && ' emphasis' ##NO_TEXT. - ENDIF. - IF iv_opt CA zif_abapgit_html=>c_html_opt-cancel. - lv_class = lv_class && ' attention' ##NO_TEXT. - ENDIF. - IF iv_opt CA zif_abapgit_html=>c_html_opt-crossout. - lv_class = lv_class && ' crossout grey' ##NO_TEXT. - ENDIF. - IF lv_class IS NOT INITIAL. - SHIFT lv_class LEFT DELETING LEADING space. - lv_class = | class="{ lv_class }"|. - ENDIF. - - lv_href = ' href="#"'. " Default, dummy - IF ( iv_act IS NOT INITIAL OR iv_typ = zif_abapgit_html=>c_action_type-dummy ) - AND iv_opt NA zif_abapgit_html=>c_html_opt-crossout. - CASE iv_typ. - WHEN zif_abapgit_html=>c_action_type-url. - lv_href = | href="{ iv_act }"|. - WHEN zif_abapgit_html=>c_action_type-sapevent. - lv_href = | href="sapevent:{ iv_act }"|. - WHEN zif_abapgit_html=>c_action_type-onclick. - lv_href = ' href="#"'. - lv_click = | onclick="{ iv_act }"|. - WHEN zif_abapgit_html=>c_action_type-dummy. - lv_href = ' href="#"'. - ENDCASE. - ENDIF. - - IF iv_id IS NOT INITIAL. - lv_id = | id="{ iv_id }"|. - ENDIF. - - IF iv_style IS NOT INITIAL. - lv_style = | style="{ iv_style }"|. - ENDIF. - - IF iv_title IS NOT INITIAL. - lv_title = | title="{ iv_title }"|. - ENDIF. - - rv_str = || - && |{ iv_txt }|. - - ENDMETHOD. - - METHOD add. DATA: lv_type TYPE c, @@ -165,14 +104,15 @@ CLASS ZCL_ABAPGIT_HTML IMPLEMENTATION. METHOD add_a. - add( a( iv_txt = iv_txt - iv_act = iv_act - iv_typ = iv_typ - iv_opt = iv_opt - iv_class = iv_class - iv_id = iv_id - iv_style = iv_style - iv_title = iv_title ) ). + add( zif_abapgit_html~a( + iv_txt = iv_txt + iv_act = iv_act + iv_typ = iv_typ + iv_opt = iv_opt + iv_class = iv_class + iv_id = iv_id + iv_style = iv_style + iv_title = iv_title ) ). ENDMETHOD. @@ -350,6 +290,65 @@ CLASS ZCL_ABAPGIT_HTML IMPLEMENTATION. ENDMETHOD. + METHOD zif_abapgit_html~a. + + DATA: lv_class TYPE string, + lv_href TYPE string, + lv_click TYPE string, + lv_id TYPE string, + lv_style TYPE string, + lv_title TYPE string. + + lv_class = iv_class. + + IF iv_opt CA zif_abapgit_html=>c_html_opt-strong. + lv_class = lv_class && ' emphasis' ##NO_TEXT. + ENDIF. + IF iv_opt CA zif_abapgit_html=>c_html_opt-cancel. + lv_class = lv_class && ' attention' ##NO_TEXT. + ENDIF. + IF iv_opt CA zif_abapgit_html=>c_html_opt-crossout. + lv_class = lv_class && ' crossout grey' ##NO_TEXT. + ENDIF. + IF lv_class IS NOT INITIAL. + SHIFT lv_class LEFT DELETING LEADING space. + lv_class = | class="{ lv_class }"|. + ENDIF. + + lv_href = ' href="#"'. " Default, dummy + IF ( iv_act IS NOT INITIAL OR iv_typ = zif_abapgit_html=>c_action_type-dummy ) + AND iv_opt NA zif_abapgit_html=>c_html_opt-crossout. + CASE iv_typ. + WHEN zif_abapgit_html=>c_action_type-url. + lv_href = | href="{ iv_act }"|. + WHEN zif_abapgit_html=>c_action_type-sapevent. + lv_href = | href="sapevent:{ iv_act }"|. + WHEN zif_abapgit_html=>c_action_type-onclick. + lv_href = ' href="#"'. + lv_click = | onclick="{ iv_act }"|. + WHEN zif_abapgit_html=>c_action_type-dummy. + lv_href = ' href="#"'. + ENDCASE. + ENDIF. + + IF iv_id IS NOT INITIAL. + lv_id = | id="{ iv_id }"|. + ENDIF. + + IF iv_style IS NOT INITIAL. + lv_style = | style="{ iv_style }"|. + ENDIF. + + IF iv_title IS NOT INITIAL. + lv_title = | title="{ iv_title }"|. + ENDIF. + + rv_str = || + && |{ iv_txt }|. + + ENDMETHOD. + + METHOD zif_abapgit_html~add_checkbox. add( checkbox( iv_id = iv_id diff --git a/src/ui/zcl_abapgit_gui_chunk_lib.clas.abap b/src/ui/zcl_abapgit_gui_chunk_lib.clas.abap index 6b4ff365d..8130565a5 100644 --- a/src/ui/zcl_abapgit_gui_chunk_lib.clas.abap +++ b/src/ui/zcl_abapgit_gui_chunk_lib.clas.abap @@ -9,9 +9,9 @@ CLASS zcl_abapgit_gui_chunk_lib DEFINITION BEGIN OF ty_event_signature, method TYPE string, name TYPE string, - END OF ty_event_signature. + END OF ty_event_signature . - CLASS-METHODS class_constructor. + CLASS-METHODS class_constructor . CLASS-METHODS render_error IMPORTING !ix_error TYPE REF TO zcx_abapgit_exception OPTIONAL @@ -46,75 +46,74 @@ CLASS zcl_abapgit_gui_chunk_lib DEFINITION IMPORTING !io_news TYPE REF TO zcl_abapgit_news RETURNING - VALUE(ro_html) TYPE REF TO zcl_abapgit_html + VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . CLASS-METHODS render_commit_popup IMPORTING - iv_content TYPE csequence - iv_id TYPE csequence - RETURNING - VALUE(ro_html) TYPE REF TO zcl_abapgit_html - RAISING - zcx_abapgit_exception . - CLASS-METHODS render_error_message_box - IMPORTING - ix_error TYPE REF TO zcx_abapgit_exception - RETURNING - VALUE(ro_html) TYPE REF TO zcl_abapgit_html. - CLASS-METHODS parse_change_order_by - IMPORTING - iv_query_str TYPE clike - RETURNING - VALUE(rv_order_by) TYPE string. - CLASS-METHODS parse_direction - IMPORTING - iv_query_str TYPE clike - RETURNING - VALUE(rv_order_descending) TYPE abap_bool. - CLASS-METHODS render_order_by_header_cells - IMPORTING - it_col_spec TYPE zif_abapgit_definitions=>tty_col_spec - iv_order_by TYPE string - iv_order_descending TYPE abap_bool - RETURNING - VALUE(ro_html) TYPE REF TO zcl_abapgit_html. - CLASS-METHODS render_warning_banner - IMPORTING - iv_text TYPE string - RETURNING - VALUE(ro_html) TYPE REF TO zcl_abapgit_html. - CLASS-METHODS render_infopanel - IMPORTING - iv_div_id TYPE string - iv_title TYPE string - iv_hide TYPE abap_bool DEFAULT abap_true - iv_hint TYPE string OPTIONAL - iv_scrollable TYPE abap_bool DEFAULT abap_true - io_content TYPE REF TO zif_abapgit_html - RETURNING - VALUE(ro_html) TYPE REF TO zcl_abapgit_html - RAISING - zcx_abapgit_exception . - CLASS-METHODS render_event_as_form - IMPORTING - is_event TYPE ty_event_signature - RETURNING - VALUE(ro_html) TYPE REF TO zcl_abapgit_html. - CLASS-METHODS render_repo_palette - IMPORTING - iv_action TYPE string + !iv_content TYPE csequence + !iv_id TYPE csequence + RETURNING + VALUE(ri_html) TYPE REF TO zif_abapgit_html + RAISING + zcx_abapgit_exception . + CLASS-METHODS render_error_message_box + IMPORTING + !ix_error TYPE REF TO zcx_abapgit_exception + RETURNING + VALUE(ro_html) TYPE REF TO zcl_abapgit_html . + CLASS-METHODS parse_change_order_by + IMPORTING + !iv_query_str TYPE clike + RETURNING + VALUE(rv_order_by) TYPE string . + CLASS-METHODS parse_direction + IMPORTING + !iv_query_str TYPE clike + RETURNING + VALUE(rv_order_descending) TYPE abap_bool . + CLASS-METHODS render_order_by_header_cells + IMPORTING + !it_col_spec TYPE zif_abapgit_definitions=>tty_col_spec + !iv_order_by TYPE string + !iv_order_descending TYPE abap_bool + RETURNING + VALUE(ri_html) TYPE REF TO zif_abapgit_html . + CLASS-METHODS render_warning_banner + IMPORTING + !iv_text TYPE string + RETURNING + VALUE(ro_html) TYPE REF TO zcl_abapgit_html . + CLASS-METHODS render_infopanel + IMPORTING + !iv_div_id TYPE string + !iv_title TYPE string + !iv_hide TYPE abap_bool DEFAULT abap_true + !iv_hint TYPE string OPTIONAL + !iv_scrollable TYPE abap_bool DEFAULT abap_true + !io_content TYPE REF TO zif_abapgit_html + RETURNING + VALUE(ri_html) TYPE REF TO zif_abapgit_html + RAISING + zcx_abapgit_exception . + CLASS-METHODS render_event_as_form + IMPORTING + !is_event TYPE ty_event_signature + RETURNING + VALUE(ro_html) TYPE REF TO zcl_abapgit_html . + CLASS-METHODS render_repo_palette + IMPORTING + !iv_action TYPE string RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . - CLASS-METHODS advanced_submenu - RETURNING VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar. - + RETURNING + VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar . CLASS-METHODS help_submenu - RETURNING VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar. - + RETURNING + VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar . PROTECTED SECTION. CLASS-METHODS render_repo_top_commit_hash IMPORTING @@ -290,18 +289,18 @@ CLASS ZCL_ABAPGIT_GUI_CHUNK_LIB IMPLEMENTATION. METHOD render_commit_popup. - CREATE OBJECT ro_html. + CREATE OBJECT ri_html TYPE zcl_abapgit_html. - ro_html->add( '
    ' ). - ro_html->add( |
  • | && |{ iv_content }| && |
  • | ). - ro_html->add( '
' ). + ri_html->add( '
    ' ). + ri_html->add( |
  • | && |{ iv_content }| && |
  • | ). + ri_html->add( '
' ). - ro_html = render_infopanel( + ri_html = render_infopanel( iv_div_id = |{ iv_id }| iv_title = 'Commit details' iv_hide = abap_true iv_scrollable = abap_false - io_content = ro_html ). + io_content = ri_html ). ENDMETHOD. @@ -432,7 +431,7 @@ CLASS ZCL_ABAPGIT_GUI_CHUNK_LIB IMPLEMENTATION. DATA lv_display TYPE string. DATA lv_class TYPE string. - CREATE OBJECT ro_html. + CREATE OBJECT ri_html TYPE zcl_abapgit_html. IF iv_hide = abap_true. " Initially hide lv_display = 'display:none'. @@ -443,11 +442,11 @@ CLASS ZCL_ABAPGIT_GUI_CHUNK_LIB IMPLEMENTATION. lv_class = lv_class && ' info-panel-fixed'. ENDIF. - ro_html->add( |
| ). + ri_html->add( |
| ). - ro_html->add( |
{ iv_title }| + ri_html->add( |
{ iv_title }| && '
' - && zcl_abapgit_html=>a( + && ri_html->a( iv_txt = '❌' iv_typ = zif_abapgit_html=>c_action_type-onclick iv_act = |toggleDisplay('{ iv_div_id }')| @@ -455,17 +454,17 @@ CLASS ZCL_ABAPGIT_GUI_CHUNK_LIB IMPLEMENTATION. && '
' ). IF iv_hint IS NOT INITIAL. - ro_html->add( '
' - && zcl_abapgit_html=>icon( iv_name = 'exclamation-triangle' - iv_class = 'pad-right' ) + ri_html->add( '
' + && ri_html->icon( iv_name = 'exclamation-triangle' + iv_class = 'pad-right' ) && iv_hint && '
' ). ENDIF. - ro_html->add( |
| ). - ro_html->add( io_content ). - ro_html->add( '
' ). - ro_html->add( '
' ). + ri_html->add( |
| ). + ri_html->add( io_content ). + ri_html->add( '
' ). + ri_html->add( '
' ). ENDMETHOD. @@ -530,7 +529,7 @@ CLASS ZCL_ABAPGIT_GUI_CHUNK_LIB IMPLEMENTATION. FIELD-SYMBOLS: LIKE LINE OF lt_log. - CREATE OBJECT ro_html. + CREATE OBJECT ri_html TYPE zcl_abapgit_html. IF io_news IS NOT BOUND OR io_news->has_news( ) = abap_false. RETURN. @@ -548,9 +547,9 @@ CLASS ZCL_ABAPGIT_GUI_CHUNK_LIB IMPLEMENTATION. ELSE. " < 0 lv_text = -text. ENDIF. - ro_html->add( |

{ lv_text }

| ). + ri_html->add( |

{ lv_text }

| ). ELSE. - ro_html->add( |
  • { -text }
  • | ). + ri_html->add( |
  • { -text }
  • | ). ENDIF. ENDLOOP. @@ -559,12 +558,12 @@ CLASS ZCL_ABAPGIT_GUI_CHUNK_LIB IMPLEMENTATION. lv_hint = 'Please note changes marked with "!"'. ENDIF. - ro_html = render_infopanel( + ri_html = render_infopanel( iv_div_id = 'news' iv_title = 'Announcement of the latest changes' iv_hint = lv_hint iv_hide = boolc( io_news->has_unseen( ) = abap_false ) - io_content = ro_html ). + io_content = ri_html ). ENDMETHOD. @@ -577,7 +576,7 @@ CLASS ZCL_ABAPGIT_GUI_CHUNK_LIB IMPLEMENTATION. FIELD-SYMBOLS LIKE LINE OF it_col_spec. - CREATE OBJECT ro_html. + CREATE OBJECT ri_html TYPE zcl_abapgit_html. LOOP AT it_col_spec ASSIGNING . " e.g. Created at [{ gv_time_zone }] @@ -594,18 +593,18 @@ CLASS ZCL_ABAPGIT_GUI_CHUNK_LIB IMPLEMENTATION. ENDIF. IF -tech_name = iv_order_by. IF iv_order_descending = abap_true. - lv_tmp = lv_tmp && zcl_abapgit_html=>a( + lv_tmp = lv_tmp && ri_html->a( iv_txt = lv_disp_name iv_act = |{ zif_abapgit_definitions=>c_action-direction }?direction=ASCENDING| iv_title = -title ). ELSE. - lv_tmp = lv_tmp && zcl_abapgit_html=>a( + lv_tmp = lv_tmp && ri_html->a( iv_txt = lv_disp_name iv_act = |{ zif_abapgit_definitions=>c_action-direction }?direction=DESCENDING| iv_title = -title ). ENDIF. ELSE. - lv_tmp = lv_tmp && zcl_abapgit_html=>a( + lv_tmp = lv_tmp && ri_html->a( iv_txt = lv_disp_name iv_act = |{ zif_abapgit_definitions=>c_action-change_order_by }?orderBy={ -tech_name }| iv_title = -title ). @@ -621,7 +620,7 @@ CLASS ZCL_ABAPGIT_GUI_CHUNK_LIB IMPLEMENTATION. ENDIF. lv_tmp = lv_tmp && ''. - ro_html->add( lv_tmp ). + ri_html->add( lv_tmp ). ENDLOOP. ENDMETHOD. diff --git a/src/ui/zcl_abapgit_gui_page_debuginfo.clas.abap b/src/ui/zcl_abapgit_gui_page_debuginfo.clas.abap index be82a18b8..440d8d071 100644 --- a/src/ui/zcl_abapgit_gui_page_debuginfo.clas.abap +++ b/src/ui/zcl_abapgit_gui_page_debuginfo.clas.abap @@ -48,8 +48,9 @@ CLASS zcl_abapgit_gui_page_debuginfo IMPLEMENTATION. lv_encode = zcl_abapgit_html_action_utils=>jump_encode( iv_obj_type = 'CLAS' iv_obj_name = |{ iv_class }| ). - rv_html = zcl_abapgit_html=>a( iv_txt = |{ iv_class }| - iv_act = |{ zif_abapgit_definitions=>c_action-jump }?{ lv_encode }| ). + rv_html = zcl_abapgit_html=>zif_abapgit_html~a( + iv_txt = |{ iv_class }| + iv_act = |{ zif_abapgit_definitions=>c_action-jump }?{ lv_encode }| ). ENDMETHOD. diff --git a/src/ui/zcl_abapgit_gui_page_diff.clas.abap b/src/ui/zcl_abapgit_gui_page_diff.clas.abap index 27a72fc58..a09688ded 100644 --- a/src/ui/zcl_abapgit_gui_page_diff.clas.abap +++ b/src/ui/zcl_abapgit_gui_page_diff.clas.abap @@ -42,78 +42,80 @@ CLASS zcl_abapgit_gui_page_diff DEFINITION METHODS zif_abapgit_gui_event_handler~on_event REDEFINITION. PROTECTED SECTION. - DATA mv_unified TYPE abap_bool VALUE abap_true ##NO_TEXT. - DATA mo_repo TYPE REF TO zcl_abapgit_repo. - DATA mt_diff_files TYPE tt_file_diff . - METHODS: - get_normalized_fname_with_path - IMPORTING - is_diff TYPE ty_file_diff - RETURNING - VALUE(rv_filename) TYPE string, - normalize_path - IMPORTING - iv_path TYPE string - RETURNING - VALUE(rv_normalized) TYPE string, - normalize_filename - IMPORTING - iv_filename TYPE string - RETURNING - VALUE(rv_normalized) TYPE string, - render_content REDEFINITION, - add_menu_end - IMPORTING - io_menu TYPE REF TO zcl_abapgit_html_toolbar , - calculate_diff - IMPORTING - is_file TYPE zif_abapgit_definitions=>ty_file OPTIONAL - is_object TYPE zif_abapgit_definitions=>ty_item OPTIONAL - it_files TYPE zif_abapgit_definitions=>ty_stage_tt OPTIONAL - RAISING - zcx_abapgit_exception, - add_menu_begin - IMPORTING - io_menu TYPE REF TO zcl_abapgit_html_toolbar, - render_table_head_non_unified - IMPORTING - io_html TYPE REF TO zcl_abapgit_html - is_diff TYPE ty_file_diff, - render_beacon_begin_of_row - IMPORTING - io_html TYPE REF TO zcl_abapgit_html - is_diff TYPE ty_file_diff, - render_diff_head_after_state - IMPORTING - io_html TYPE REF TO zcl_abapgit_html - is_diff TYPE ty_file_diff, - insert_nav - RETURNING - VALUE(rv_insert_nav) TYPE abap_bool, - render_line_split_row - IMPORTING - io_html TYPE REF TO zcl_abapgit_html - iv_filename TYPE string - is_diff_line TYPE zif_abapgit_definitions=>ty_diff - iv_index TYPE sy-tabix - iv_fstate TYPE char1 - iv_new TYPE string - iv_old TYPE string - RAISING - zcx_abapgit_exception, - build_menu - RETURNING - VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar. + DATA mv_unified TYPE abap_bool VALUE abap_true ##NO_TEXT. + DATA mo_repo TYPE REF TO zcl_abapgit_repo . + DATA mt_diff_files TYPE tt_file_diff . + + METHODS get_normalized_fname_with_path + IMPORTING + !is_diff TYPE ty_file_diff + RETURNING + VALUE(rv_filename) TYPE string . + METHODS normalize_path + IMPORTING + !iv_path TYPE string + RETURNING + VALUE(rv_normalized) TYPE string . + METHODS normalize_filename + IMPORTING + !iv_filename TYPE string + RETURNING + VALUE(rv_normalized) TYPE string . + METHODS add_menu_end + IMPORTING + !io_menu TYPE REF TO zcl_abapgit_html_toolbar . + METHODS calculate_diff + IMPORTING + !is_file TYPE zif_abapgit_definitions=>ty_file OPTIONAL + !is_object TYPE zif_abapgit_definitions=>ty_item OPTIONAL + !it_files TYPE zif_abapgit_definitions=>ty_stage_tt OPTIONAL + RAISING + zcx_abapgit_exception . + METHODS add_menu_begin + IMPORTING + !io_menu TYPE REF TO zcl_abapgit_html_toolbar . + METHODS render_table_head_non_unified + IMPORTING + !io_html TYPE REF TO zcl_abapgit_html + !is_diff TYPE ty_file_diff . + METHODS render_beacon_begin_of_row + IMPORTING + !io_html TYPE REF TO zcl_abapgit_html + !is_diff TYPE ty_file_diff . + METHODS render_diff_head_after_state + IMPORTING + !ii_html TYPE REF TO zif_abapgit_html + !is_diff TYPE ty_file_diff . + METHODS insert_nav + RETURNING + VALUE(rv_insert_nav) TYPE abap_bool . + METHODS render_line_split_row + IMPORTING + !io_html TYPE REF TO zcl_abapgit_html + !iv_filename TYPE string + !is_diff_line TYPE zif_abapgit_definitions=>ty_diff + !iv_index TYPE sy-tabix + !iv_fstate TYPE char1 + !iv_new TYPE string + !iv_old TYPE string + RAISING + zcx_abapgit_exception . + METHODS build_menu + RETURNING + VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar . + + METHODS render_content + REDEFINITION . PRIVATE SECTION. + CONSTANTS: BEGIN OF c_actions, toggle_unified TYPE string VALUE 'toggle_unified', END OF c_actions . - DATA mt_delayed_lines TYPE zif_abapgit_definitions=>ty_diffs_tt . DATA mv_repo_key TYPE zif_abapgit_persistence=>ty_repo-key . - DATA mv_seed TYPE string . " Unique page id to bind JS sessionStorage + DATA mv_seed TYPE string . " Unique page id to bind JS sessionStorage METHODS render_diff IMPORTING @@ -126,7 +128,7 @@ CLASS zcl_abapgit_gui_page_diff DEFINITION IMPORTING !is_diff TYPE ty_file_diff RETURNING - VALUE(ro_html) TYPE REF TO zcl_abapgit_html . + VALUE(ri_html) TYPE REF TO zif_abapgit_html . METHODS render_table_head IMPORTING !is_diff TYPE ty_file_diff @@ -173,33 +175,32 @@ CLASS zcl_abapgit_gui_page_diff DEFINITION !io_menu TYPE REF TO zcl_abapgit_html_toolbar . METHODS add_filter_sub_menu IMPORTING - io_menu TYPE REF TO zcl_abapgit_html_toolbar . + !io_menu TYPE REF TO zcl_abapgit_html_toolbar . METHODS render_lines IMPORTING - is_diff TYPE ty_file_diff + !is_diff TYPE ty_file_diff RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING - zcx_abapgit_exception. + zcx_abapgit_exception . METHODS render_table_head_unified IMPORTING - io_html TYPE REF TO zcl_abapgit_html. + !io_html TYPE REF TO zcl_abapgit_html . METHODS render_scripts RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING - zcx_abapgit_exception. + zcx_abapgit_exception . METHODS filter_diff_by_files IMPORTING - it_files TYPE zif_abapgit_definitions=>ty_stage_tt + !it_files TYPE zif_abapgit_definitions=>ty_stage_tt CHANGING - ct_diff_files TYPE tt_file_diff. - + !ct_diff_files TYPE tt_file_diff . ENDCLASS. -CLASS zcl_abapgit_gui_page_diff IMPLEMENTATION. +CLASS ZCL_ABAPGIT_GUI_PAGE_DIFF IMPLEMENTATION. METHOD add_filter_sub_menu. @@ -485,6 +486,28 @@ CLASS zcl_abapgit_gui_page_diff IMPLEMENTATION. ENDMETHOD. + METHOD filter_diff_by_files. + + FIELD-SYMBOLS: TYPE ty_file_diff. + + IF lines( it_files ) = 0. + RETURN. + ENDIF. + + " Diff only for specified files + LOOP AT ct_diff_files ASSIGNING . + + READ TABLE it_files TRANSPORTING NO FIELDS + WITH KEY file-filename = -filename. + IF sy-subrc <> 0. + DELETE TABLE ct_diff_files FROM . + ENDIF. + + ENDLOOP. + + ENDMETHOD. + + METHOD get_normalized_fname_with_path. rv_filename = normalize_path( is_diff-path ) @@ -642,11 +665,11 @@ CLASS zcl_abapgit_gui_page_diff IMPLEMENTATION. DATA: ls_stats TYPE zif_abapgit_definitions=>ty_count, lv_adt_link TYPE string. - CREATE OBJECT ro_html. + CREATE OBJECT ri_html TYPE zcl_abapgit_html. - ro_html->add( '
    ' ). + ri_html->add( '
    ' ). - ro_html->add_icon( + ri_html->add_icon( iv_name = 'chevron-down' iv_hint = 'Collapse/Expand' iv_class = 'cursor-pointer' @@ -659,37 +682,37 @@ CLASS zcl_abapgit_gui_page_diff IMPLEMENTATION. CLEAR: ls_stats-insert, ls_stats-delete. ENDIF. - ro_html->add( |+ { ls_stats-insert }| ). - ro_html->add( |- { ls_stats-delete }| ). - ro_html->add( |~ { ls_stats-update }| ). + ri_html->add( |+ { ls_stats-insert }| ). + ri_html->add( |- { ls_stats-delete }| ). + ri_html->add( |~ { ls_stats-update }| ). ENDIF. " no links for nonexistent or deleted objects IF is_diff-lstate IS NOT INITIAL AND is_diff-lstate <> 'D'. - lv_adt_link = zcl_abapgit_html=>a( + lv_adt_link = ri_html->a( iv_txt = |{ is_diff-path }{ is_diff-filename }| iv_typ = zif_abapgit_html=>c_action_type-sapevent iv_act = |jump?TYPE={ is_diff-obj_type }&NAME={ is_diff-obj_name }| ). ENDIF. IF lv_adt_link IS NOT INITIAL. - ro_html->add( |{ lv_adt_link }| ). + ri_html->add( |{ lv_adt_link }| ). ELSE. - ro_html->add( |{ is_diff-path }{ is_diff-filename }| ). + ri_html->add( |{ is_diff-path }{ is_diff-filename }| ). ENDIF. - ro_html->add( zcl_abapgit_gui_chunk_lib=>render_item_state( + ri_html->add( zcl_abapgit_gui_chunk_lib=>render_item_state( iv_lstate = is_diff-lstate iv_rstate = is_diff-rstate ) ). render_diff_head_after_state( - io_html = ro_html - is_diff = is_diff ). + ii_html = ri_html + is_diff = is_diff ). - ro_html->add( |Last Changed by: { + ri_html->add( |Last Changed by: { is_diff-changed_by }| ). - ro_html->add( '
    ' ). + ri_html->add( '
    ' ). ENDMETHOD. @@ -697,7 +720,7 @@ CLASS zcl_abapgit_gui_page_diff IMPLEMENTATION. METHOD render_diff_head_after_state. IF is_diff-fstate = c_fstate-both AND mv_unified = abap_true. - io_html->add( 'Attention: Unified mode' + ii_html->add( 'Attention: Unified mode' && ' highlighting for MM assumes local file is newer ! ' ). "#EC NOTEXT ENDIF. @@ -985,26 +1008,4 @@ CLASS zcl_abapgit_gui_page_diff IMPLEMENTATION. ENDCASE. ENDMETHOD. - - METHOD filter_diff_by_files. - - FIELD-SYMBOLS: TYPE ty_file_diff. - - IF lines( it_files ) = 0. - RETURN. - ENDIF. - - " Diff only for specified files - LOOP AT ct_diff_files ASSIGNING . - - READ TABLE it_files TRANSPORTING NO FIELDS - WITH KEY file-filename = -filename. - IF sy-subrc <> 0. - DELETE TABLE ct_diff_files FROM . - ENDIF. - - ENDLOOP. - - ENDMETHOD. - ENDCLASS. diff --git a/src/ui/zcl_abapgit_gui_page_patch.clas.abap b/src/ui/zcl_abapgit_gui_page_patch.clas.abap index cdd4f1a63..0a87bb051 100644 --- a/src/ui/zcl_abapgit_gui_page_patch.clas.abap +++ b/src/ui/zcl_abapgit_gui_page_patch.clas.abap @@ -179,7 +179,7 @@ ENDCLASS. -CLASS zcl_abapgit_gui_page_patch IMPLEMENTATION. +CLASS ZCL_ABAPGIT_GUI_PAGE_PATCH IMPLEMENTATION. METHOD add_menu_begin. @@ -612,7 +612,7 @@ CLASS zcl_abapgit_gui_page_patch IMPLEMENTATION. lv_act_id = |{ c_actions-refresh_local_object }_{ is_diff-obj_type }_{ is_diff-obj_name }|. - io_html->add_a( + ii_html->add_a( iv_txt = |Refresh| iv_typ = zif_abapgit_html=>c_action_type-dummy iv_act = lv_act_id @@ -622,7 +622,7 @@ CLASS zcl_abapgit_gui_page_patch IMPLEMENTATION. ENDIF. super->render_diff_head_after_state( - io_html = io_html + ii_html = ii_html is_diff = is_diff ). ENDMETHOD. diff --git a/src/ui/zcl_abapgit_gui_page_stage.clas.abap b/src/ui/zcl_abapgit_gui_page_stage.clas.abap index fd63d36dd..7043bebd8 100644 --- a/src/ui/zcl_abapgit_gui_page_stage.clas.abap +++ b/src/ui/zcl_abapgit_gui_page_stage.clas.abap @@ -32,18 +32,19 @@ CLASS zcl_abapgit_gui_page_stage DEFINITION name TYPE xubname, END OF ty_changed_by . TYPES: - ty_changed_by_tt TYPE SORTED TABLE OF ty_changed_by WITH UNIQUE KEY item. + ty_changed_by_tt TYPE SORTED TABLE OF ty_changed_by WITH UNIQUE KEY item . TYPES: BEGIN OF ty_transport, item TYPE zif_abapgit_definitions=>ty_item, transport TYPE trkorr, - END OF ty_transport, - ty_transport_tt TYPE SORTED TABLE OF ty_transport WITH UNIQUE KEY item. + END OF ty_transport . + TYPES: + ty_transport_tt TYPE SORTED TABLE OF ty_transport WITH UNIQUE KEY item . DATA mo_repo TYPE REF TO zcl_abapgit_repo_online . DATA ms_files TYPE zif_abapgit_definitions=>ty_stage_files . - DATA mv_seed TYPE string . " Unique page id to bind JS sessionStorage - DATA mv_filter_value TYPE string. + DATA mv_seed TYPE string . " Unique page id to bind JS sessionStorage + DATA mv_filter_value TYPE string . METHODS find_changed_by IMPORTING @@ -52,9 +53,9 @@ CLASS zcl_abapgit_gui_page_stage DEFINITION VALUE(rt_changed_by) TYPE ty_changed_by_tt . METHODS find_transports IMPORTING - it_local TYPE zif_abapgit_definitions=>ty_files_item_tt + !it_local TYPE zif_abapgit_definitions=>ty_files_item_tt RETURNING - VALUE(rt_transports) TYPE ty_transport_tt. + VALUE(rt_transports) TYPE ty_transport_tt . METHODS render_list RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html . @@ -67,7 +68,7 @@ CLASS zcl_abapgit_gui_page_stage DEFINITION !iv_changed_by TYPE xubname OPTIONAL !iv_transport TYPE trkorr OPTIONAL RETURNING - VALUE(ro_html) TYPE REF TO zcl_abapgit_html . + VALUE(ri_html) TYPE REF TO zif_abapgit_html . METHODS render_actions RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html . @@ -87,28 +88,31 @@ CLASS zcl_abapgit_gui_page_stage DEFINITION RETURNING VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar . METHODS get_page_patch - IMPORTING io_stage TYPE REF TO zcl_abapgit_stage - RETURNING VALUE(ri_page) TYPE REF TO zif_abapgit_gui_renderable - RAISING zcx_abapgit_exception. + IMPORTING + !io_stage TYPE REF TO zcl_abapgit_stage + RETURNING + VALUE(ri_page) TYPE REF TO zif_abapgit_gui_renderable + RAISING + zcx_abapgit_exception . METHODS render_master_language_warning - RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html. + RETURNING + VALUE(ro_html) TYPE REF TO zcl_abapgit_html . METHODS count_default_files_to_commit RETURNING - VALUE(rv_count) TYPE i. + VALUE(rv_count) TYPE i . METHODS render_deferred_hidden_events RETURNING - VALUE(ro_html) TYPE REF TO zcl_abapgit_html. + VALUE(ro_html) TYPE REF TO zcl_abapgit_html . METHODS render_scripts RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING - zcx_abapgit_exception. - + zcx_abapgit_exception . ENDCLASS. -CLASS zcl_abapgit_gui_page_stage IMPLEMENTATION. +CLASS ZCL_ABAPGIT_GUI_PAGE_STAGE IMPLEMENTATION. METHOD build_menu. @@ -351,7 +355,7 @@ CLASS zcl_abapgit_gui_page_stage IMPLEMENTATION. lv_transport_string TYPE string, lv_transport_html TYPE string. - CREATE OBJECT ro_html. + CREATE OBJECT ri_html TYPE zcl_abapgit_html. lv_transport_string = iv_transport. @@ -359,12 +363,12 @@ CLASS zcl_abapgit_gui_page_stage IMPLEMENTATION. * make sure whitespace is preserved in the DOM REPLACE ALL OCCURRENCES OF ` ` IN lv_filename WITH ' '. - ro_html->add( || ). - ro_html->add( '' ). - ro_html->add( zcl_abapgit_gui_chunk_lib=>render_item_state( + ri_html->add( || ). + ri_html->add( '' ). + ri_html->add( zcl_abapgit_gui_chunk_lib=>render_item_state( iv_lstate = is_status-lstate iv_rstate = is_status-rstate ) ). - ro_html->add( '' ). + ri_html->add( '' ). CASE iv_context. WHEN 'local'. @@ -372,30 +376,30 @@ CLASS zcl_abapgit_gui_page_stage IMPLEMENTATION. iv_key = mo_repo->get_key( ) ig_file = is_file ). - lv_filename = zcl_abapgit_html=>a( + lv_filename = ri_html->a( iv_txt = lv_filename iv_act = |{ zif_abapgit_definitions=>c_action-go_diff }?{ lv_param }| ). IF iv_transport IS NOT INITIAL. - lv_transport_html = zcl_abapgit_html=>a( + lv_transport_html = ri_html->a( iv_txt = lv_transport_string iv_act = |{ zif_abapgit_definitions=>c_action-jump_transport }?{ iv_transport }| ). ENDIF. - ro_html->add( |{ is_item-obj_type }| ). - ro_html->add( |{ lv_filename }| ). - ro_html->add( |{ iv_changed_by }| ). - ro_html->add( |{ lv_transport_html }| ). + ri_html->add( |{ is_item-obj_type }| ). + ri_html->add( |{ lv_filename }| ). + ri_html->add( |{ iv_changed_by }| ). + ri_html->add( |{ lv_transport_html }| ). WHEN 'remote'. - ro_html->add( '-' ). " Dummy for object type - ro_html->add( |{ lv_filename }| ). - ro_html->add( '' ). " Dummy for changed-by - ro_html->add( '' ). " Dummy for transport + ri_html->add( '-' ). " Dummy for object type + ri_html->add( |{ lv_filename }| ). + ri_html->add( '' ). " Dummy for changed-by + ri_html->add( '' ). " Dummy for transport ENDCASE. - ro_html->add( |?| ). - ro_html->add( '' ). " Command added in JS + ri_html->add( |?| ). + ri_html->add( '' ). " Command added in JS - ro_html->add( '' ). + ri_html->add( '' ). ENDMETHOD. diff --git a/src/ui/zcl_abapgit_gui_page_view_repo.clas.abap b/src/ui/zcl_abapgit_gui_page_view_repo.clas.abap index 0f63ce946..7839aa1d4 100644 --- a/src/ui/zcl_abapgit_gui_page_view_repo.clas.abap +++ b/src/ui/zcl_abapgit_gui_page_view_repo.clas.abap @@ -319,8 +319,9 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_VIEW_REPO IMPLEMENTATION. REPLACE FIRST OCCURRENCE OF mv_cur_dir IN lv_path WITH ''. lv_encode = zcl_abapgit_html_action_utils=>dir_encode( lv_path ). - rv_html = zcl_abapgit_html=>a( iv_txt = lv_path - iv_act = |{ c_actions-change_dir }?{ lv_encode }| ). + rv_html = zcl_abapgit_html=>zif_abapgit_html~a( + iv_txt = lv_path + iv_act = |{ c_actions-change_dir }?{ lv_encode }| ). ENDMETHOD. @@ -465,11 +466,13 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_VIEW_REPO IMPLEMENTATION. DATA: lv_encode TYPE string. - lv_encode = zcl_abapgit_html_action_utils=>jump_encode( iv_obj_type = is_item-obj_type - iv_obj_name = is_item-obj_name ). + lv_encode = zcl_abapgit_html_action_utils=>jump_encode( + iv_obj_type = is_item-obj_type + iv_obj_name = is_item-obj_name ). - rv_html = zcl_abapgit_html=>a( iv_txt = |{ is_item-obj_name }| - iv_act = |{ zif_abapgit_definitions=>c_action-jump }?{ lv_encode }| ). + rv_html = zcl_abapgit_html=>zif_abapgit_html~a( + iv_txt = |{ is_item-obj_name }| + iv_act = |{ zif_abapgit_definitions=>c_action-jump }?{ lv_encode }| ). ENDMETHOD. @@ -787,11 +790,11 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_VIEW_REPO IMPLEMENTATION. ENDIF. lv_add_str = |+{ mv_max_setting }|. ri_html->add( |Only { lv_max_str } shown in list. Display { - zcl_abapgit_html=>a( iv_txt = lv_add_str - iv_act = c_actions-display_more ) + ri_html->a( iv_txt = lv_add_str + iv_act = c_actions-display_more ) } more. (Set in Advanced > { - zcl_abapgit_html=>a( iv_txt = 'Settings' - iv_act = zif_abapgit_definitions=>c_action-go_settings ) + ri_html->a( iv_txt = 'Settings' + iv_act = zif_abapgit_definitions=>c_action-go_settings ) } )| ). ri_html->add( '
    ' ). ENDIF. @@ -982,10 +985,11 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_VIEW_REPO IMPLEMENTATION. iv_object_name = is_item-obj_name iv_resolve_task_to_request = abap_false ). lv_transport_string = lv_transport. - lv_icon_html = zcl_abapgit_html=>a( iv_txt = zcl_abapgit_html=>icon( iv_name = 'briefcase/darkgrey' - iv_hint = lv_transport_string ) - iv_act = |{ zif_abapgit_definitions=>c_action-jump_transport }?| && - lv_transport ). + lv_icon_html = zcl_abapgit_html=>zif_abapgit_html~a( + iv_txt = zcl_abapgit_html=>icon( iv_name = 'briefcase/darkgrey' + iv_hint = lv_transport_string ) + iv_act = |{ zif_abapgit_definitions=>c_action-jump_transport }?| && lv_transport ). + rv_html = || && |{ lv_icon_html }| && ||. diff --git a/src/ui/zcl_abapgit_gui_repo_over.clas.abap b/src/ui/zcl_abapgit_gui_repo_over.clas.abap index e14277775..9744775f3 100644 --- a/src/ui/zcl_abapgit_gui_repo_over.clas.abap +++ b/src/ui/zcl_abapgit_gui_repo_over.clas.abap @@ -115,7 +115,7 @@ ENDCLASS. -CLASS zcl_abapgit_gui_repo_over IMPLEMENTATION. +CLASS ZCL_ABAPGIT_GUI_REPO_OVER IMPLEMENTATION. METHOD apply_filter. @@ -251,14 +251,14 @@ CLASS zcl_abapgit_gui_repo_over IMPLEMENTATION. ii_html->add( || ). ii_html->add( || ). - ii_html->add( zcl_abapgit_html=>a( + ii_html->add( zcl_abapgit_html=>zif_abapgit_html~a( iv_txt = ' Only Favorites' iv_act = |gHelper.toggleRepoListFavorites()| iv_typ = zif_abapgit_html=>c_action_type-onclick ) ). ii_html->add( `|` ). - ii_html->add( zcl_abapgit_html=>a( + ii_html->add( zcl_abapgit_html=>zif_abapgit_html~a( iv_txt = ' Detail' iv_act = |gHelper.toggleRepoListDetail()| iv_typ = zif_abapgit_html=>c_action_type-onclick ) ). @@ -339,8 +339,8 @@ CLASS zcl_abapgit_gui_repo_over IMPLEMENTATION. ii_html->add( || ). ii_html->add( |{ zcl_abapgit_html=>icon( lv_type_icon ) }| ). - ii_html->add( |{ zcl_abapgit_html=>a( iv_txt = -name - iv_act = |{ c_action-select }?{ -key }| ) }| ). + ii_html->add( |{ ii_html->a( iv_txt = -name + iv_act = |{ c_action-select }?{ -key }| ) }| ). IF -type = abap_false. ii_html->add( |{ ii_html->a( iv_txt = -url @@ -409,7 +409,7 @@ CLASS zcl_abapgit_gui_repo_over IMPLEMENTATION. ii_html->add( || ). ii_html->add( |{ - zcl_abapgit_html=>a( + ii_html->a( iv_txt = `›` iv_act = |{ c_action-select }?{ -key }| ) }| ). @@ -575,5 +575,4 @@ CLASS zcl_abapgit_gui_repo_over IMPLEMENTATION. -css_class = iv_css_class. -add_tz = iv_add_tz. ENDMETHOD. - ENDCLASS.