Add uninstall option to repository overview (#5753)

* Add uninstall option to repository overview

* Hover + Remove

Co-authored-by: Lars Hvam <larshp@hotmail.com>
This commit is contained in:
Marc Bernard 2022-09-15 09:08:23 -04:00 committed by GitHub
parent 0be78203d5
commit b9bb9a8094
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -199,6 +199,15 @@ CLASS zcl_abapgit_gui_page_repo_over IMPLEMENTATION.
ENDMETHOD.
METHOD column.
IF iv_css_class IS NOT INITIAL.
rv_html = |<td class="{ iv_css_class }">| && iv_content && |</td>|.
ELSE.
rv_html = |<td>| && iv_content && |</td>|.
ENDIF.
ENDMETHOD.
METHOD constructor.
super->constructor( ).
@ -216,6 +225,11 @@ CLASS zcl_abapgit_gui_page_repo_over IMPLEMENTATION.
ENDMETHOD.
METHOD get_only_favorites.
rv_result = mv_only_favorites.
ENDMETHOD.
METHOD map_repo_list_to_overview.
DATA: ls_overview LIKE LINE OF rt_overview,
@ -275,6 +289,97 @@ CLASS zcl_abapgit_gui_page_repo_over IMPLEMENTATION.
ENDMETHOD.
METHOD render_actions.
CONSTANTS:
lc_dummy_key TYPE string VALUE `?key=#`,
lc_offline_class TYPE string VALUE `action_offline_repo`,
lc_online_class TYPE string VALUE `action_online_repo`,
lc_action_class TYPE string VALUE `action_link`.
DATA lo_toolbar TYPE REF TO zcl_abapgit_html_toolbar.
DATA lo_toolbar_more_sub TYPE REF TO zcl_abapgit_html_toolbar.
CREATE OBJECT lo_toolbar EXPORTING iv_id = 'toolbar-ovp'.
lo_toolbar->add( iv_txt = |Pull|
iv_act = |{ zif_abapgit_definitions=>c_action-git_reset }{ lc_dummy_key }|
iv_class = |{ lc_action_class } { lc_online_class }|
iv_li_class = |{ lc_action_class }| ).
lo_toolbar->add( iv_txt = |Stage|
iv_act = |{ zif_abapgit_definitions=>c_action-go_stage }{ lc_dummy_key }|
iv_class = |{ lc_action_class } { lc_online_class }|
iv_li_class = |{ lc_action_class }| ).
lo_toolbar->add( iv_txt = |Patch|
iv_act = |{ zif_abapgit_definitions=>c_action-go_patch }{ lc_dummy_key }|
iv_class = |{ lc_action_class } { lc_online_class }|
iv_li_class = |{ lc_action_class }| ).
lo_toolbar->add( iv_txt = |Diff|
iv_act = |{ zif_abapgit_definitions=>c_action-go_repo_diff }{ lc_dummy_key }|
iv_class = |{ lc_action_class } { lc_online_class }|
iv_li_class = |{ lc_action_class }| ).
lo_toolbar->add( iv_txt = |Check|
iv_act = |{ zif_abapgit_definitions=>c_action-repo_code_inspector }{ lc_dummy_key }|
iv_class = |{ lc_action_class }|
iv_li_class = |{ lc_action_class }| ).
lo_toolbar->add( iv_txt = |Import|
iv_act = |{ zif_abapgit_definitions=>c_action-zip_import }{ lc_dummy_key }|
iv_class = |{ lc_action_class } { lc_offline_class }|
iv_li_class = |{ lc_action_class }| ).
lo_toolbar->add( iv_txt = |Export|
iv_act = |{ zif_abapgit_definitions=>c_action-zip_export }{ lc_dummy_key }|
iv_class = |{ lc_action_class } { lc_offline_class }|
iv_li_class = |{ lc_action_class }| ).
lo_toolbar->add( iv_txt = |Settings|
iv_act = |{ zif_abapgit_definitions=>c_action-repo_settings }{ lc_dummy_key }|
iv_class = |{ lc_action_class }|
iv_li_class = |{ lc_action_class }| ).
CREATE OBJECT lo_toolbar_more_sub EXPORTING iv_id = 'toolbar-ovp-more_sub'.
lo_toolbar_more_sub->add( iv_txt = |Stage by Transport|
iv_act = |{ zif_abapgit_definitions=>c_action-go_stage_transport }{ lc_dummy_key }|
iv_class = |{ lc_action_class } { lc_online_class }|
iv_li_class = |{ lc_action_class }| ).
lo_toolbar_more_sub->add( iv_txt = |Export by Transport|
iv_act = |{ zif_abapgit_definitions=>c_action-zip_export_transport }{ lc_dummy_key }|
iv_class = |{ lc_action_class } { lc_offline_class }|
iv_li_class = |{ lc_action_class }| ).
lo_toolbar_more_sub->add( iv_txt = 'Danger'
iv_typ = zif_abapgit_html=>c_action_type-separator ).
lo_toolbar_more_sub->add( iv_txt = |Remove|
iv_title = |Remove abapGit's records of the repository (the system's |
&& |development objects will remain unaffected)|
iv_act = |{ zif_abapgit_definitions=>c_action-repo_remove }{ lc_dummy_key }| ).
lo_toolbar_more_sub->add( iv_txt = |Uninstall|
iv_title = |Delete all development objects belonging to this package |
&& |(and subpackages) from the system|
iv_act = |{ zif_abapgit_definitions=>c_action-repo_purge }{ lc_dummy_key }|
iv_class = |{ lc_action_class } { lc_online_class }|
iv_li_class = |{ lc_action_class }| ).
lo_toolbar->add( iv_txt = |More|
io_sub = lo_toolbar_more_sub
iv_class = |{ lc_action_class }|
iv_li_class = |{ lc_action_class }| ).
ii_html->add( lo_toolbar->render( iv_right = abap_true ) ).
ENDMETHOD.
METHOD render_header_bar.
DATA: lv_new_toggle_favorites TYPE abap_bool,
@ -487,99 +592,6 @@ CLASS zcl_abapgit_gui_page_repo_over IMPLEMENTATION.
ENDMETHOD.
METHOD render_actions.
CONSTANTS:
lc_dummy_key TYPE string VALUE `?key=#`,
lc_offline_class TYPE string VALUE `action_offline_repo`,
lc_online_class TYPE string VALUE `action_online_repo`,
lc_action_class TYPE string VALUE `action_link`.
DATA lo_toolbar TYPE REF TO zcl_abapgit_html_toolbar.
DATA lo_toolbar_more_sub TYPE REF TO zcl_abapgit_html_toolbar.
CREATE OBJECT lo_toolbar EXPORTING iv_id = 'toolbar-ovp'.
lo_toolbar->add( iv_txt = |Pull|
iv_act = |{ zif_abapgit_definitions=>c_action-git_reset }{ lc_dummy_key }|
iv_class = |{ lc_action_class } { lc_online_class }|
iv_li_class = |{ lc_action_class }| ).
lo_toolbar->add( iv_txt = |Stage|
iv_act = |{ zif_abapgit_definitions=>c_action-go_stage }{ lc_dummy_key }|
iv_class = |{ lc_action_class } { lc_online_class }|
iv_li_class = |{ lc_action_class }| ).
lo_toolbar->add( iv_txt = |Patch|
iv_act = |{ zif_abapgit_definitions=>c_action-go_patch }{ lc_dummy_key }|
iv_class = |{ lc_action_class } { lc_online_class }|
iv_li_class = |{ lc_action_class }| ).
lo_toolbar->add( iv_txt = |Diff|
iv_act = |{ zif_abapgit_definitions=>c_action-go_repo_diff }{ lc_dummy_key }|
iv_class = |{ lc_action_class } { lc_online_class }|
iv_li_class = |{ lc_action_class }| ).
lo_toolbar->add( iv_txt = |Check|
iv_act = |{ zif_abapgit_definitions=>c_action-repo_code_inspector }{ lc_dummy_key }|
iv_class = |{ lc_action_class }|
iv_li_class = |{ lc_action_class }| ).
lo_toolbar->add( iv_txt = |Import|
iv_act = |{ zif_abapgit_definitions=>c_action-zip_import }{ lc_dummy_key }|
iv_class = |{ lc_action_class } { lc_offline_class }|
iv_li_class = |{ lc_action_class }| ).
lo_toolbar->add( iv_txt = |Export|
iv_act = |{ zif_abapgit_definitions=>c_action-zip_export }{ lc_dummy_key }|
iv_class = |{ lc_action_class } { lc_offline_class }|
iv_li_class = |{ lc_action_class }| ).
lo_toolbar->add( iv_txt = |Settings|
iv_act = |{ zif_abapgit_definitions=>c_action-repo_settings }{ lc_dummy_key }|
iv_class = |{ lc_action_class }|
iv_li_class = |{ lc_action_class }| ).
CREATE OBJECT lo_toolbar_more_sub EXPORTING iv_id = 'toolbar-ovp-more_sub'.
lo_toolbar_more_sub->add( iv_txt = |Stage by Transport|
iv_act = |{ zif_abapgit_definitions=>c_action-go_stage_transport }{ lc_dummy_key }|
iv_class = |{ lc_action_class } { lc_online_class }|
iv_li_class = |{ lc_action_class }| ).
lo_toolbar_more_sub->add( iv_txt = |Export by Transport|
iv_act = |{ zif_abapgit_definitions=>c_action-zip_export_transport }{ lc_dummy_key }|
iv_class = |{ lc_action_class } { lc_offline_class }|
iv_li_class = |{ lc_action_class }| ).
lo_toolbar->add( iv_txt = |More|
io_sub = lo_toolbar_more_sub
iv_class = |{ lc_action_class }|
iv_li_class = |{ lc_action_class }| ).
ii_html->add( lo_toolbar->render( iv_right = abap_true ) ).
ENDMETHOD.
METHOD shorten_repo_url.
DATA lv_new_length TYPE i.
DATA lv_length_to_truncate_to TYPE i.
rv_shortened = iv_full_url.
REPLACE FIRST OCCURRENCE OF 'https://' IN rv_shortened WITH ''.
REPLACE FIRST OCCURRENCE OF 'http://' IN rv_shortened WITH ''.
IF rv_shortened CP '*.git'.
lv_new_length = strlen( rv_shortened ) - 4.
rv_shortened = rv_shortened(lv_new_length).
ENDIF.
IF strlen( rv_shortened ) > iv_max_length.
lv_length_to_truncate_to = iv_max_length - 3.
rv_shortened = rv_shortened(lv_length_to_truncate_to) && `...`.
ENDIF.
ENDMETHOD.
METHOD render_table_header.
@ -707,6 +719,11 @@ CLASS zcl_abapgit_gui_page_repo_over IMPLEMENTATION.
ENDMETHOD.
METHOD set_only_favorites.
mv_only_favorites = iv_only_favorites.
ENDMETHOD.
METHOD set_order_by.
mv_order_by = iv_order_by.
ENDMETHOD.
@ -717,6 +734,26 @@ CLASS zcl_abapgit_gui_page_repo_over IMPLEMENTATION.
ENDMETHOD.
METHOD shorten_repo_url.
DATA lv_new_length TYPE i.
DATA lv_length_to_truncate_to TYPE i.
rv_shortened = iv_full_url.
REPLACE FIRST OCCURRENCE OF 'https://' IN rv_shortened WITH ''.
REPLACE FIRST OCCURRENCE OF 'http://' IN rv_shortened WITH ''.
IF rv_shortened CP '*.git'.
lv_new_length = strlen( rv_shortened ) - 4.
rv_shortened = rv_shortened(lv_new_length).
ENDIF.
IF strlen( rv_shortened ) > iv_max_length.
lv_length_to_truncate_to = iv_max_length - 3.
rv_shortened = rv_shortened(lv_length_to_truncate_to) && `...`.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_gui_renderable~render.
mt_overview = map_repo_list_to_overview( ).
@ -748,21 +785,4 @@ CLASS zcl_abapgit_gui_page_repo_over IMPLEMENTATION.
<ls_col>-add_tz = iv_add_tz.
<ls_col>-allow_order_by = iv_allow_order_by.
ENDMETHOD.
METHOD column.
IF iv_css_class IS NOT INITIAL.
rv_html = |<td class="{ iv_css_class }">| && iv_content && |</td>|.
ELSE.
rv_html = |<td>| && iv_content && |</td>|.
ENDIF.
ENDMETHOD.
METHOD set_only_favorites.
mv_only_favorites = iv_only_favorites.
ENDMETHOD.
METHOD get_only_favorites.
rv_result = mv_only_favorites.
ENDMETHOD.
ENDCLASS.