CLASS zcl_abapgit_gui_chunk_lib DEFINITION PUBLIC FINAL CREATE PUBLIC. PUBLIC SECTION. CLASS-METHODS render_error IMPORTING ix_error TYPE REF TO zcx_abapgit_exception OPTIONAL iv_error TYPE string OPTIONAL RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html. CLASS-METHODS render_repo_top IMPORTING io_repo TYPE REF TO zcl_abapgit_repo iv_show_package TYPE abap_bool DEFAULT abap_true iv_show_branch TYPE abap_bool DEFAULT abap_true iv_interactive_branch TYPE abap_bool DEFAULT abap_false iv_branch TYPE string OPTIONAL io_news TYPE REF TO zcl_abapgit_news OPTIONAL RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception. CLASS-METHODS render_item_state IMPORTING iv1 TYPE char1 iv2 TYPE char1 RETURNING VALUE(rv_html) TYPE string. CLASS-METHODS render_branch_span IMPORTING iv_branch TYPE string io_repo TYPE REF TO zcl_abapgit_repo_online iv_interactive TYPE abap_bool RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception. CLASS-METHODS render_js_error_banner RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception. CLASS-METHODS render_news IMPORTING io_news TYPE REF TO zcl_abapgit_news RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception. ENDCLASS. CLASS ZCL_ABAPGIT_GUI_CHUNK_LIB IMPLEMENTATION. METHOD render_branch_span. DATA: lv_text TYPE string, lv_class TYPE string. lv_text = zcl_abapgit_git_branch_list=>get_display_name( iv_branch ). IF iv_branch = io_repo->get_head_branch_name( ) OR iv_branch = zif_abapgit_definitions=>c_head_name. lv_class = 'branch branch_head'. ELSEIF zcl_abapgit_git_branch_list=>get_type( iv_branch ) = zif_abapgit_definitions=>c_git_branch_type-branch. lv_class = 'branch branch_branch'. ELSE. lv_class = 'branch'. ENDIF. CREATE OBJECT ro_html. ro_html->add( || ). ro_html->add_icon( iv_name = 'git-branch/darkgrey' iv_hint = 'Current branch' ). IF iv_interactive = abap_true. ro_html->add_a( iv_act = |{ zif_abapgit_definitions=>gc_action-git_branch_switch }?{ io_repo->get_key( ) }| iv_txt = lv_text ). ELSE. ro_html->add( lv_text ). ENDIF. ro_html->add( '' ). ENDMETHOD. "render_branch_span METHOD render_error. DATA lv_error TYPE string. CREATE OBJECT ro_html. IF ix_error IS BOUND. lv_error = ix_error->get_text( ). ELSE. lv_error = iv_error. ENDIF. ro_html->add( '
' ). " Repo type and name ro_html->add_icon( iv_name = lv_icon iv_hint = lv_hint ). ro_html->add( |{ io_repo->get_name( ) }| ). IF io_repo->is_offline( ) = abap_false. lo_repo_online ?= io_repo. ro_html->add( |{ lo_repo_online->get_url( ) }| ). ENDIF. " News IF io_news IS BOUND AND io_news->has_news( ) = abap_true. IF io_news->has_updates( ) = abap_true. lv_icon = 'arrow-up/warning'. ELSE. lv_icon = 'arrow-up/grey80'. ENDIF. ro_html->add_a( iv_act = 'displayNews()' iv_typ = zif_abapgit_definitions=>gc_action_type-onclick iv_txt = zcl_abapgit_html=>icon( iv_name = lv_icon iv_class = 'pad-sides' iv_hint = 'Display changelog' ) ). ENDIF. ro_html->add( ' | ' ). ro_html->add( '' ). " Fav IF abap_true = zcl_abapgit_persistence_user=>get_instance( )->is_favorite_repo( io_repo->get_key( ) ). lv_icon = 'star/blue' ##NO_TEXT. ELSE. lv_icon = 'star/grey' ##NO_TEXT. ENDIF. ro_html->add_a( iv_act = |{ zif_abapgit_definitions=>gc_action-repo_toggle_fav }?{ io_repo->get_key( ) }| iv_txt = zcl_abapgit_html=>icon( iv_name = lv_icon iv_class = 'pad-sides' iv_hint = 'Click to toggle favorite' ) ). " BG IF lo_pback->exists( io_repo->get_key( ) ) = abap_true. ro_html->add( 'BG' ). ENDIF. " Write protect IF io_repo->get_local_settings( )-write_protected = abap_true. ro_html->add_icon( iv_name = 'lock/darkgrey' iv_hint = 'Locked from pulls' ). ENDIF. " Branch IF io_repo->is_offline( ) = abap_false. lo_repo_online ?= io_repo. IF iv_show_branch = abap_true. IF iv_branch IS INITIAL. ro_html->add( render_branch_span( iv_branch = lo_repo_online->get_branch_name( ) io_repo = lo_repo_online iv_interactive = iv_interactive_branch ) ). ELSE. ro_html->add( render_branch_span( iv_branch = iv_branch io_repo = lo_repo_online iv_interactive = iv_interactive_branch ) ). ENDIF. ENDIF. ENDIF. " Package IF iv_show_package = abap_true. ro_html->add_icon( iv_name = 'package/darkgrey' iv_hint = 'SAP package' ). ro_html->add( '' ). ro_html->add_a( iv_txt = io_repo->get_package( ) iv_act = |{ zif_abapgit_definitions=>gc_action-jump_pkg }?{ io_repo->get_package( ) }| ). ro_html->add( '' ). ENDIF. ro_html->add( ' | ' ). ro_html->add( '