From 82633f80f742c0b0effb89d83bf30779a9b5afa7 Mon Sep 17 00:00:00 2001 From: Marc Bernard <59966492+mbtools@users.noreply.github.com> Date: Tue, 19 Sep 2023 11:03:09 -0400 Subject: [PATCH] Add option to remove all objects but keep repository (#6499) --- src/repo/zcl_abapgit_repo_srv.clas.abap | 7 ++++++- src/repo/zif_abapgit_repo_srv.intf.abap | 1 + .../pages/zcl_abapgit_gui_page_repo_over.clas.abap | 12 ++++++++++-- .../pages/zcl_abapgit_gui_page_repo_view.clas.abap | 9 +++++++-- src/ui/routing/zcl_abapgit_gui_router.clas.abap | 7 ++++++- src/ui/routing/zcl_abapgit_services_repo.clas.abap | 6 ++++-- src/zif_abapgit_definitions.intf.abap | 3 ++- 7 files changed, 36 insertions(+), 9 deletions(-) diff --git a/src/repo/zcl_abapgit_repo_srv.clas.abap b/src/repo/zcl_abapgit_repo_srv.clas.abap index dd4b3cfdb..476271935 100644 --- a/src/repo/zcl_abapgit_repo_srv.clas.abap +++ b/src/repo/zcl_abapgit_repo_srv.clas.abap @@ -660,7 +660,12 @@ CLASS zcl_abapgit_repo_srv IMPLEMENTATION. RAISE EXCEPTION lx_error. ENDTRY. - zif_abapgit_repo_srv~delete( ii_repo ). + IF iv_keep_repo = abap_true. + ii_repo->refresh( ). + ii_repo->checksums( )->rebuild( ). + ELSE. + zif_abapgit_repo_srv~delete( ii_repo ). + ENDIF. ENDMETHOD. diff --git a/src/repo/zif_abapgit_repo_srv.intf.abap b/src/repo/zif_abapgit_repo_srv.intf.abap index 798cd1daf..98d0a9594 100644 --- a/src/repo/zif_abapgit_repo_srv.intf.abap +++ b/src/repo/zif_abapgit_repo_srv.intf.abap @@ -76,6 +76,7 @@ INTERFACE zif_abapgit_repo_srv IMPORTING !ii_repo TYPE REF TO zif_abapgit_repo !is_checks TYPE zif_abapgit_definitions=>ty_delete_checks + !iv_keep_repo TYPE abap_bool DEFAULT abap_false RETURNING VALUE(ri_log) TYPE REF TO zif_abapgit_log RAISING diff --git a/src/ui/pages/zcl_abapgit_gui_page_repo_over.clas.abap b/src/ui/pages/zcl_abapgit_gui_page_repo_over.clas.abap index 13113bbed..933ab6d65 100644 --- a/src/ui/pages/zcl_abapgit_gui_page_repo_over.clas.abap +++ b/src/ui/pages/zcl_abapgit_gui_page_repo_over.clas.abap @@ -513,17 +513,25 @@ CLASS zcl_abapgit_gui_page_repo_over IMPLEMENTATION. iv_typ = zif_abapgit_html=>c_action_type-separator ). lo_toolbar_more_sub->add( - iv_txt = |Remove| + iv_txt = |Remove Repository| 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 }| iv_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( iv_txt = |Uninstall| 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_class = |{ lc_action_class }| iv_li_class = |{ lc_action_class }| ). diff --git a/src/ui/pages/zcl_abapgit_gui_page_repo_view.clas.abap b/src/ui/pages/zcl_abapgit_gui_page_repo_view.clas.abap index ea6446daf..18c40a1c4 100644 --- a/src/ui/pages/zcl_abapgit_gui_page_repo_view.clas.abap +++ b/src/ui/pages/zcl_abapgit_gui_page_repo_view.clas.abap @@ -324,14 +324,19 @@ CLASS zcl_abapgit_gui_page_repo_view IMPLEMENTATION. ro_advanced_dropdown->add( iv_txt = 'Danger' 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 ` && `development objects will remain unaffected)` 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' 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_opt = get_crossout( iv_authorization = zif_abapgit_auth=>c_authorization-uninstall diff --git a/src/ui/routing/zcl_abapgit_gui_router.clas.abap b/src/ui/routing/zcl_abapgit_gui_router.clas.abap index 38d8c6217..dc03d0a66 100644 --- a/src/ui/routing/zcl_abapgit_gui_router.clas.abap +++ b/src/ui/routing/zcl_abapgit_gui_router.clas.abap @@ -590,10 +590,15 @@ CLASS zcl_abapgit_gui_router IMPLEMENTATION. EXPORTING io_repo = lo_repo. 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 ). rs_handled-page = zcl_abapgit_gui_page_repo_over=>create( ). 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 zcl_abapgit_services_repo=>remove( lv_key ). rs_handled-page = zcl_abapgit_gui_page_repo_over=>create( ). diff --git a/src/ui/routing/zcl_abapgit_services_repo.clas.abap b/src/ui/routing/zcl_abapgit_services_repo.clas.abap index 497b89992..39e5b66b4 100644 --- a/src/ui/routing/zcl_abapgit_services_repo.clas.abap +++ b/src/ui/routing/zcl_abapgit_services_repo.clas.abap @@ -25,6 +25,7 @@ CLASS zcl_abapgit_services_repo DEFINITION CLASS-METHODS purge IMPORTING !iv_key TYPE zif_abapgit_persistence=>ty_repo-key + !iv_keep_repo TYPE abap_bool DEFAULT abap_false RETURNING VALUE(ri_log) TYPE REF TO zif_abapgit_log RAISING @@ -655,8 +656,9 @@ CLASS zcl_abapgit_services_repo IMPLEMENTATION. ENDIF. ri_log = zcl_abapgit_repo_srv=>get_instance( )->purge( - ii_repo = lo_repo - is_checks = ls_checks ). + ii_repo = lo_repo + is_checks = ls_checks + iv_keep_repo = iv_keep_repo ). COMMIT WORK. diff --git a/src/zif_abapgit_definitions.intf.abap b/src/zif_abapgit_definitions.intf.abap index ad108b5ae..2cdfbaff0 100644 --- a/src/zif_abapgit_definitions.intf.abap +++ b/src/zif_abapgit_definitions.intf.abap @@ -316,7 +316,8 @@ INTERFACE zif_abapgit_definitions repo_background TYPE string VALUE 'repo_background', repo_infos TYPE string VALUE 'repo_infos', 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_newoffline TYPE string VALUE 'repo_newoffline', repo_add_all_obj_to_trans_req TYPE string VALUE 'repo_add_all_obj_to_trans_req',