Add option to remove all objects but keep repository (#6499)

This commit is contained in:
Marc Bernard 2023-09-19 11:03:09 -04:00 committed by GitHub
parent a13798408d
commit 82633f80f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 36 additions and 9 deletions

View File

@ -660,7 +660,12 @@ CLASS zcl_abapgit_repo_srv IMPLEMENTATION.
RAISE EXCEPTION lx_error. RAISE EXCEPTION lx_error.
ENDTRY. ENDTRY.
IF iv_keep_repo = abap_true.
ii_repo->refresh( ).
ii_repo->checksums( )->rebuild( ).
ELSE.
zif_abapgit_repo_srv~delete( ii_repo ). zif_abapgit_repo_srv~delete( ii_repo ).
ENDIF.
ENDMETHOD. ENDMETHOD.

View File

@ -76,6 +76,7 @@ INTERFACE zif_abapgit_repo_srv
IMPORTING IMPORTING
!ii_repo TYPE REF TO zif_abapgit_repo !ii_repo TYPE REF TO zif_abapgit_repo
!is_checks TYPE zif_abapgit_definitions=>ty_delete_checks !is_checks TYPE zif_abapgit_definitions=>ty_delete_checks
!iv_keep_repo TYPE abap_bool DEFAULT abap_false
RETURNING RETURNING
VALUE(ri_log) TYPE REF TO zif_abapgit_log VALUE(ri_log) TYPE REF TO zif_abapgit_log
RAISING RAISING

View File

@ -513,17 +513,25 @@ CLASS zcl_abapgit_gui_page_repo_over IMPLEMENTATION.
iv_typ = zif_abapgit_html=>c_action_type-separator ). iv_typ = zif_abapgit_html=>c_action_type-separator ).
lo_toolbar_more_sub->add( lo_toolbar_more_sub->add(
iv_txt = |Remove| iv_txt = |Remove Repository|
iv_title = |Remove abapGit's records of the repository (the system's | iv_title = |Remove abapGit's records of the repository (the system's |
&& |development objects will remain unaffected)| && |development objects will remain unaffected)|
iv_act = |{ zif_abapgit_definitions=>c_action-repo_remove }{ lc_dummy_key }| iv_act = |{ zif_abapgit_definitions=>c_action-repo_remove }{ lc_dummy_key }|
iv_class = |{ lc_action_class }| iv_class = |{ lc_action_class }|
iv_li_class = |{ lc_action_class }| ). iv_li_class = |{ lc_action_class }| ).
lo_toolbar_more_sub->add(
iv_txt = |Remove Objects|
iv_title = |Delete all development objects belonging to this package |
&& |(and subpackages) from the system, but keep repository in abapGit|
iv_act = |{ zif_abapgit_definitions=>c_action-repo_delete_objects }{ lc_dummy_key }|
iv_class = |{ lc_action_class }|
iv_li_class = |{ lc_action_class }| ).
lo_toolbar_more_sub->add( lo_toolbar_more_sub->add(
iv_txt = |Uninstall| iv_txt = |Uninstall|
iv_title = |Delete all development objects belonging to this package | iv_title = |Delete all development objects belonging to this package |
&& |(and subpackages) from the system| && |(and subpackages) from the system, and remove the repository from abapGit|
iv_act = |{ zif_abapgit_definitions=>c_action-repo_purge }{ lc_dummy_key }| iv_act = |{ zif_abapgit_definitions=>c_action-repo_purge }{ lc_dummy_key }|
iv_class = |{ lc_action_class }| iv_class = |{ lc_action_class }|
iv_li_class = |{ lc_action_class }| ). iv_li_class = |{ lc_action_class }| ).

View File

@ -324,14 +324,19 @@ CLASS zcl_abapgit_gui_page_repo_view IMPLEMENTATION.
ro_advanced_dropdown->add( iv_txt = 'Danger' ro_advanced_dropdown->add( iv_txt = 'Danger'
iv_typ = zif_abapgit_html=>c_action_type-separator ). iv_typ = zif_abapgit_html=>c_action_type-separator ).
ro_advanced_dropdown->add( iv_txt = 'Remove' ro_advanced_dropdown->add( iv_txt = 'Remove Repository'
iv_title = `Remove abapGit's records of the repository (the system's ` iv_title = `Remove abapGit's records of the repository (the system's `
&& `development objects will remain unaffected)` && `development objects will remain unaffected)`
iv_act = |{ zif_abapgit_definitions=>c_action-repo_remove }?key={ mv_key }| ). iv_act = |{ zif_abapgit_definitions=>c_action-repo_remove }?key={ mv_key }| ).
ro_advanced_dropdown->add( iv_txt = 'Remove Objects'
iv_title = `Delete all development objects belonging to this package `
&& `(and subpackages) from the system, but keep repository in abapGit`
iv_act = |{ zif_abapgit_definitions=>c_action-repo_delete_objects }?key={ mv_key }| ).
ro_advanced_dropdown->add( iv_txt = 'Uninstall' ro_advanced_dropdown->add( iv_txt = 'Uninstall'
iv_title = `Delete all development objects belonging to this package ` iv_title = `Delete all development objects belonging to this package `
&& `(and subpackages) from the system` && `(and subpackages) from the system, and remove the repository from abapGit`
iv_act = |{ zif_abapgit_definitions=>c_action-repo_purge }?key={ mv_key }| iv_act = |{ zif_abapgit_definitions=>c_action-repo_purge }?key={ mv_key }|
iv_opt = get_crossout( iv_opt = get_crossout(
iv_authorization = zif_abapgit_auth=>c_authorization-uninstall iv_authorization = zif_abapgit_auth=>c_authorization-uninstall

View File

@ -590,10 +590,15 @@ CLASS zcl_abapgit_gui_router IMPLEMENTATION.
EXPORTING EXPORTING
io_repo = lo_repo. io_repo = lo_repo.
rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page. rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page.
WHEN zif_abapgit_definitions=>c_action-repo_purge. " Repo purge all objects (uninstall) WHEN zif_abapgit_definitions=>c_action-repo_purge. " Purge all objects and repo (uninstall)
zcl_abapgit_services_repo=>purge( lv_key ). zcl_abapgit_services_repo=>purge( lv_key ).
rs_handled-page = zcl_abapgit_gui_page_repo_over=>create( ). rs_handled-page = zcl_abapgit_gui_page_repo_over=>create( ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page_replacing. rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page_replacing.
WHEN zif_abapgit_definitions=>c_action-repo_delete_objects. " Purge all objects (uninstall)
zcl_abapgit_services_repo=>purge(
iv_key = lv_key
iv_keep_repo = abap_true ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
WHEN zif_abapgit_definitions=>c_action-repo_remove. " Repo remove WHEN zif_abapgit_definitions=>c_action-repo_remove. " Repo remove
zcl_abapgit_services_repo=>remove( lv_key ). zcl_abapgit_services_repo=>remove( lv_key ).
rs_handled-page = zcl_abapgit_gui_page_repo_over=>create( ). rs_handled-page = zcl_abapgit_gui_page_repo_over=>create( ).

View File

@ -25,6 +25,7 @@ CLASS zcl_abapgit_services_repo DEFINITION
CLASS-METHODS purge CLASS-METHODS purge
IMPORTING IMPORTING
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key !iv_key TYPE zif_abapgit_persistence=>ty_repo-key
!iv_keep_repo TYPE abap_bool DEFAULT abap_false
RETURNING RETURNING
VALUE(ri_log) TYPE REF TO zif_abapgit_log VALUE(ri_log) TYPE REF TO zif_abapgit_log
RAISING RAISING
@ -656,7 +657,8 @@ CLASS zcl_abapgit_services_repo IMPLEMENTATION.
ri_log = zcl_abapgit_repo_srv=>get_instance( )->purge( ri_log = zcl_abapgit_repo_srv=>get_instance( )->purge(
ii_repo = lo_repo ii_repo = lo_repo
is_checks = ls_checks ). is_checks = ls_checks
iv_keep_repo = iv_keep_repo ).
COMMIT WORK. COMMIT WORK.

View File

@ -316,7 +316,8 @@ INTERFACE zif_abapgit_definitions
repo_background TYPE string VALUE 'repo_background', repo_background TYPE string VALUE 'repo_background',
repo_infos TYPE string VALUE 'repo_infos', repo_infos TYPE string VALUE 'repo_infos',
repo_purge TYPE string VALUE 'repo_purge', repo_purge TYPE string VALUE 'repo_purge',
repo_activate_objects TYPE string VALUE 'activate_objects', repo_delete_objects TYPE string VALUE 'repo_delete_objects',
repo_activate_objects TYPE string VALUE 'repo_activate_objects',
repo_newonline TYPE string VALUE 'repo_newonline', repo_newonline TYPE string VALUE 'repo_newonline',
repo_newoffline TYPE string VALUE 'repo_newoffline', repo_newoffline TYPE string VALUE 'repo_newoffline',
repo_add_all_obj_to_trans_req TYPE string VALUE 'repo_add_all_obj_to_trans_req', repo_add_all_obj_to_trans_req TYPE string VALUE 'repo_add_all_obj_to_trans_req',