mirror of
https://github.com/abapGit/abapGit.git
synced 2025-04-30 20:03:20 +08:00
switch to repo after creation
move popups to new separate class
This commit is contained in:
parent
9bec514fec
commit
731029c037
|
@ -3,7 +3,7 @@ REPORT zabapgit LINE-SIZE 100.
|
|||
* See http://www.abapgit.org
|
||||
|
||||
CONSTANTS: gc_xml_version TYPE string VALUE 'v1.0.0', "#EC NOTEXT
|
||||
gc_abap_version TYPE string VALUE 'v1.15.1'. "#EC NOTEXT
|
||||
gc_abap_version TYPE string VALUE 'v1.15.2'. "#EC NOTEXT
|
||||
|
||||
********************************************************************************
|
||||
* The MIT License (MIT)
|
||||
|
@ -110,6 +110,7 @@ INCLUDE zabapgit_repo_impl.
|
|||
INCLUDE zabapgit_background.
|
||||
INCLUDE zabapgit_zip.
|
||||
INCLUDE zabapgit_transport.
|
||||
include zabapgit_popups.
|
||||
INCLUDE zabapgit_page.
|
||||
INCLUDE zabapgit_page_commit.
|
||||
INCLUDE zabapgit_page_merge.
|
||||
|
|
|
@ -18,25 +18,11 @@ CLASS lcl_gui_router DEFINITION FINAL.
|
|||
|
||||
PRIVATE SECTION.
|
||||
|
||||
TYPES: BEGIN OF ty_popup,
|
||||
url TYPE string,
|
||||
package TYPE devclass,
|
||||
branch_name TYPE string,
|
||||
cancel TYPE abap_bool,
|
||||
END OF ty_popup.
|
||||
|
||||
METHODS get_page_by_name
|
||||
IMPORTING iv_name TYPE clike
|
||||
RETURNING VALUE(ri_page) TYPE REF TO lif_gui_page
|
||||
RAISING lcx_exception.
|
||||
|
||||
METHODS repo_popup
|
||||
IMPORTING iv_url TYPE string
|
||||
iv_package TYPE devclass OPTIONAL
|
||||
iv_branch TYPE string DEFAULT 'refs/heads/master'
|
||||
RETURNING VALUE(rs_popup) TYPE ty_popup
|
||||
RAISING lcx_exception ##NO_TEXT.
|
||||
|
||||
METHODS get_page_diff
|
||||
IMPORTING iv_getdata TYPE clike
|
||||
RETURNING VALUE(ri_page) TYPE REF TO lif_gui_page
|
||||
|
@ -61,10 +47,6 @@ CLASS lcl_gui_router DEFINITION FINAL.
|
|||
METHODS abapgit_installation
|
||||
RAISING lcx_exception.
|
||||
|
||||
METHODS repo_clone
|
||||
IMPORTING iv_url TYPE string
|
||||
RAISING lcx_exception.
|
||||
|
||||
METHODS repo_purge
|
||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
||||
RAISING lcx_exception.
|
||||
|
@ -73,9 +55,6 @@ CLASS lcl_gui_router DEFINITION FINAL.
|
|||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
||||
RAISING lcx_exception.
|
||||
|
||||
METHODS repo_new_offline
|
||||
RAISING lcx_exception.
|
||||
|
||||
METHODS repo_package_zip
|
||||
RAISING lcx_exception.
|
||||
|
||||
|
@ -83,10 +62,6 @@ CLASS lcl_gui_router DEFINITION FINAL.
|
|||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
||||
RAISING lcx_exception.
|
||||
|
||||
METHODS switch_branch
|
||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
||||
RAISING lcx_exception.
|
||||
|
||||
METHODS reset
|
||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
||||
RAISING lcx_exception.
|
||||
|
@ -641,15 +616,6 @@ ENDCLASS.
|
|||
*----------------------------------------------------------------------*
|
||||
CLASS lcl_gui_router IMPLEMENTATION.
|
||||
|
||||
DEFINE _add_dialog_fld.
|
||||
APPEND INITIAL LINE TO lt_fields ASSIGNING <ls_field>.
|
||||
<ls_field>-tabname = &1. "#EC NOTEXT
|
||||
<ls_field>-fieldname = &2. "#EC NOTEXT
|
||||
<ls_field>-fieldtext = &3. "#EC NOTEXT
|
||||
<ls_field>-value = &4. "#EC NOTEXT
|
||||
<ls_field>-field_attr = &5. "#EC NOTEXT
|
||||
END-OF-DEFINITION.
|
||||
|
||||
METHOD on_event.
|
||||
DATA: lv_url TYPE string,
|
||||
lv_key TYPE lcl_persistence_repo=>ty_repo-key,
|
||||
|
@ -696,10 +662,6 @@ CLASS lcl_gui_router IMPLEMENTATION.
|
|||
ev_state = gc_event_state-go_back.
|
||||
|
||||
" Repository state actions
|
||||
WHEN 'install'.
|
||||
lv_url = iv_getdata.
|
||||
repo_clone( lv_url ).
|
||||
ev_state = gc_event_state-re_render.
|
||||
WHEN 'uninstall'.
|
||||
lv_key = iv_getdata.
|
||||
repo_purge( lv_key ).
|
||||
|
@ -716,9 +678,6 @@ CLASS lcl_gui_router IMPLEMENTATION.
|
|||
lv_key = iv_getdata.
|
||||
lcl_zip=>export( lcl_app=>repo_srv( )->get( lv_key ) ).
|
||||
ev_state = gc_event_state-no_more_act.
|
||||
WHEN 'newoffline'.
|
||||
repo_new_offline( ).
|
||||
ev_state = gc_event_state-re_render.
|
||||
WHEN 'files_commit'. "TODO refactor name ?
|
||||
lv_key = iv_getdata.
|
||||
lcl_zip=>export( io_repo = lcl_app=>repo_srv( )->get( lv_key )
|
||||
|
@ -735,6 +694,12 @@ CLASS lcl_gui_router IMPLEMENTATION.
|
|||
lcl_app=>repo_srv( )->get( lv_key )->refresh( ).
|
||||
ev_state = gc_event_state-re_render.
|
||||
|
||||
" explore page
|
||||
WHEN 'install'.
|
||||
lv_url = iv_getdata.
|
||||
lcl_popups=>repo_clone( lv_url ).
|
||||
ev_state = gc_event_state-re_render.
|
||||
|
||||
" Repository online actions
|
||||
WHEN 'pull'.
|
||||
lv_key = iv_getdata.
|
||||
|
@ -744,10 +709,6 @@ CLASS lcl_gui_router IMPLEMENTATION.
|
|||
lv_key = iv_getdata.
|
||||
ei_page = get_page_stage( lv_key ).
|
||||
ev_state = gc_event_state-new_page_w_bookmark.
|
||||
WHEN 'switch_branch'.
|
||||
lv_key = iv_getdata.
|
||||
switch_branch( lv_key ).
|
||||
ev_state = gc_event_state-re_render.
|
||||
WHEN 'reset'.
|
||||
lv_key = iv_getdata.
|
||||
reset( lv_key ).
|
||||
|
@ -921,98 +882,6 @@ CLASS lcl_gui_router IMPLEMENTATION.
|
|||
|
||||
ENDMETHOD. "abapgit_installation
|
||||
|
||||
METHOD repo_popup.
|
||||
|
||||
DATA: lv_returncode TYPE c,
|
||||
lv_icon_ok TYPE icon-name,
|
||||
lv_icon_br TYPE icon-name,
|
||||
lt_fields TYPE TABLE OF sval,
|
||||
lv_pattr TYPE spo_fattr,
|
||||
lv_button2 TYPE svalbutton-buttontext,
|
||||
lv_icon2 TYPE icon-name.
|
||||
|
||||
FIELD-SYMBOLS: <ls_field> LIKE LINE OF lt_fields.
|
||||
|
||||
|
||||
IF NOT iv_package IS INITIAL.
|
||||
lv_pattr = '05'.
|
||||
ELSE.
|
||||
lv_button2 = 'Create package' ##NO_TEXT.
|
||||
lv_icon2 = icon_msg.
|
||||
ENDIF.
|
||||
|
||||
* TAB FLD LABEL DEF ATTR
|
||||
_add_dialog_fld 'ABAPTXT255' 'LINE' 'Git Clone Url' iv_url ''.
|
||||
_add_dialog_fld 'TDEVC' 'DEVCLASS' 'Target Package' iv_package lv_pattr.
|
||||
_add_dialog_fld 'TEXTL' 'LINE' 'Branch' iv_branch '05'.
|
||||
|
||||
lv_icon_ok = icon_okay.
|
||||
lv_icon_br = icon_workflow_fork.
|
||||
|
||||
CALL FUNCTION 'POPUP_GET_VALUES_USER_BUTTONS'
|
||||
EXPORTING
|
||||
popup_title = 'Repository'
|
||||
programname = sy-repid
|
||||
formname = 'BRANCH_POPUP'
|
||||
ok_pushbuttontext = 'OK'
|
||||
icon_ok_push = lv_icon_ok
|
||||
first_pushbutton = 'Select branch'
|
||||
icon_button_1 = lv_icon_br
|
||||
second_pushbutton = lv_button2
|
||||
icon_button_2 = lv_icon2
|
||||
IMPORTING
|
||||
returncode = lv_returncode
|
||||
TABLES
|
||||
fields = lt_fields
|
||||
EXCEPTIONS
|
||||
error_in_fields = 1
|
||||
OTHERS = 2. "#EC NOTEXT
|
||||
IF sy-subrc <> 0.
|
||||
_raise 'Error from POPUP_GET_VALUES'.
|
||||
ENDIF.
|
||||
IF lv_returncode = 'A'.
|
||||
rs_popup-cancel = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
READ TABLE lt_fields INDEX 1 ASSIGNING <ls_field>.
|
||||
ASSERT sy-subrc = 0.
|
||||
rs_popup-url = <ls_field>-value.
|
||||
lcl_url=>name( rs_popup-url ). " validate
|
||||
|
||||
READ TABLE lt_fields INDEX 2 ASSIGNING <ls_field>.
|
||||
ASSERT sy-subrc = 0.
|
||||
rs_popup-package = <ls_field>-value.
|
||||
TRANSLATE rs_popup-package TO UPPER CASE.
|
||||
|
||||
READ TABLE lt_fields INDEX 3 ASSIGNING <ls_field>.
|
||||
ASSERT sy-subrc = 0.
|
||||
rs_popup-branch_name = <ls_field>-value.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD repo_clone.
|
||||
|
||||
DATA: ls_popup TYPE ty_popup,
|
||||
lo_repo TYPE REF TO lcl_repo_online.
|
||||
|
||||
|
||||
ls_popup = repo_popup( iv_url ).
|
||||
IF ls_popup-cancel = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
lo_repo = lcl_app=>repo_srv( )->new_online(
|
||||
iv_url = ls_popup-url
|
||||
iv_branch_name = ls_popup-branch_name
|
||||
iv_package = ls_popup-package ).
|
||||
lo_repo->status( ). " check for errors
|
||||
lo_repo->deserialize( ).
|
||||
|
||||
COMMIT WORK.
|
||||
|
||||
ENDMETHOD. "repo_clone
|
||||
|
||||
METHOD repo_purge.
|
||||
|
||||
DATA: lt_tadir TYPE ty_tadir_tt,
|
||||
|
@ -1117,54 +986,6 @@ CLASS lcl_gui_router IMPLEMENTATION.
|
|||
|
||||
ENDMETHOD. "repo_remove
|
||||
|
||||
METHOD repo_new_offline.
|
||||
|
||||
DATA: lv_returncode TYPE c,
|
||||
lv_url TYPE string,
|
||||
lv_package TYPE devclass,
|
||||
lt_fields TYPE TABLE OF sval.
|
||||
|
||||
FIELD-SYMBOLS: <ls_field> LIKE LINE OF lt_fields.
|
||||
|
||||
" TAB FLD LABEL DEF ATTR
|
||||
_add_dialog_fld 'ABAPTXT255' 'LINE' 'Name' '' ''.
|
||||
_add_dialog_fld 'TDEVC' 'DEVCLASS' 'Package' '' ''.
|
||||
|
||||
CALL FUNCTION 'POPUP_GET_VALUES'
|
||||
EXPORTING
|
||||
no_value_check = abap_true
|
||||
popup_title = 'New Offline Project' "#EC NOTEXT
|
||||
IMPORTING
|
||||
returncode = lv_returncode
|
||||
TABLES
|
||||
fields = lt_fields
|
||||
EXCEPTIONS
|
||||
error_in_fields = 1
|
||||
OTHERS = 2.
|
||||
IF sy-subrc <> 0.
|
||||
_raise 'Error from POPUP_GET_VALUES'.
|
||||
ENDIF.
|
||||
IF lv_returncode = 'A'.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
READ TABLE lt_fields INDEX 1 ASSIGNING <ls_field>.
|
||||
ASSERT sy-subrc = 0.
|
||||
lv_url = <ls_field>-value.
|
||||
|
||||
READ TABLE lt_fields INDEX 2 ASSIGNING <ls_field>.
|
||||
ASSERT sy-subrc = 0.
|
||||
lv_package = <ls_field>-value.
|
||||
TRANSLATE lv_package TO UPPER CASE.
|
||||
|
||||
lcl_app=>repo_srv( )->new_offline(
|
||||
iv_url = lv_url
|
||||
iv_package = lv_package ).
|
||||
|
||||
COMMIT WORK.
|
||||
|
||||
ENDMETHOD. "repo_new_offline
|
||||
|
||||
METHOD repo_package_zip.
|
||||
|
||||
DATA: lo_repo TYPE REF TO lcl_repo_offline,
|
||||
|
@ -1211,31 +1032,6 @@ CLASS lcl_gui_router IMPLEMENTATION.
|
|||
|
||||
ENDMETHOD. "repo_package_zip
|
||||
|
||||
METHOD switch_branch.
|
||||
|
||||
DATA: lo_repo TYPE REF TO lcl_repo_online,
|
||||
ls_popup TYPE ty_popup.
|
||||
|
||||
|
||||
lo_repo ?= lcl_app=>repo_srv( )->get( iv_key ).
|
||||
|
||||
ls_popup = repo_popup(
|
||||
iv_url = lo_repo->get_url( )
|
||||
iv_package = lo_repo->get_package( )
|
||||
iv_branch = lo_repo->get_branch_name( ) ).
|
||||
IF ls_popup-cancel = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
lo_repo->set_url( ls_popup-url ).
|
||||
lo_repo->set_branch_name( ls_popup-branch_name ).
|
||||
|
||||
COMMIT WORK.
|
||||
|
||||
lo_repo->deserialize( ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD reset.
|
||||
|
||||
DATA: lo_repo TYPE REF TO lcl_repo_online,
|
||||
|
|
|
@ -14,6 +14,13 @@ CLASS lcl_gui_page_main DEFINITION FINAL INHERITING FROM lcl_gui_page_super.
|
|||
|
||||
PRIVATE SECTION.
|
||||
|
||||
CONSTANTS: BEGIN OF c_actions,
|
||||
newoffline TYPE string VALUE 'newoffline' ##NO_TEXT,
|
||||
switch_branch TYPE string VALUE 'switch_branch' ##NO_TEXT,
|
||||
install TYPE string VALUE 'install' ##NO_TEXT,
|
||||
show TYPE string VALUE 'show' ##NO_TEXT,
|
||||
END OF c_actions.
|
||||
|
||||
TYPES: BEGIN OF ty_repo_item,
|
||||
obj_type TYPE tadir-object,
|
||||
obj_name TYPE tadir-obj_name,
|
||||
|
@ -24,7 +31,6 @@ CLASS lcl_gui_page_main DEFINITION FINAL INHERITING FROM lcl_gui_page_super.
|
|||
|
||||
DATA: mv_show TYPE lcl_persistence_db=>ty_value.
|
||||
|
||||
|
||||
METHODS:
|
||||
check_show
|
||||
RAISING lcx_exception,
|
||||
|
@ -137,9 +143,9 @@ CLASS lcl_gui_page_main IMPLEMENTATION.
|
|||
lo_betasub->add( iv_txt = 'Transport to zip' iv_act = 'transportzip' ) ##NO_TEXT.
|
||||
lo_betasub->add( iv_txt = 'Background mode' iv_act = 'background' ) ##NO_TEXT.
|
||||
|
||||
ro_menu->add( iv_txt = 'Clone' iv_act = 'install' ) ##NO_TEXT.
|
||||
ro_menu->add( iv_txt = 'Clone' iv_act = c_actions-install ) ##NO_TEXT.
|
||||
ro_menu->add( iv_txt = 'Explore' iv_act = 'explore' ) ##NO_TEXT.
|
||||
ro_menu->add( iv_txt = 'New offline repo' iv_act = 'newoffline' ) ##NO_TEXT.
|
||||
ro_menu->add( iv_txt = 'New offline repo' iv_act = c_actions-newoffline ) ##NO_TEXT.
|
||||
IF needs_installation( ) = abap_true.
|
||||
ro_menu->add( iv_txt = 'Get abapGit' iv_act = 'abapgit_installation' ) ##NO_TEXT.
|
||||
ENDIF.
|
||||
|
@ -238,7 +244,7 @@ CLASS lcl_gui_page_main IMPLEMENTATION.
|
|||
lo_sub->add( iv_txt = 'Uninstall'
|
||||
iv_act = |uninstall?{ lv_key }| ).
|
||||
lo_sub->add( iv_txt = 'Switch branch'
|
||||
iv_act = |switch_branch?{ lv_key }| ).
|
||||
iv_act = |{ c_actions-switch_branch }?{ lv_key }| ).
|
||||
lo_sub->add( iv_txt = 'Reset'
|
||||
iv_act = |reset?{ lv_key }| ).
|
||||
lo_sub->add( iv_txt = 'Create branch'
|
||||
|
@ -474,7 +480,7 @@ CLASS lcl_gui_page_main IMPLEMENTATION.
|
|||
LOOP AT it_list INTO lo_repo.
|
||||
IF mv_show = lo_repo->get_key( ).
|
||||
lo_toolbar->add( iv_txt = lo_repo->get_name( )
|
||||
iv_act = |show?{ lo_repo->get_key( ) }|
|
||||
iv_act = |{ c_actions-show }?{ lo_repo->get_key( ) }|
|
||||
iv_opt = gc_html_opt-emphas ).
|
||||
ELSE.
|
||||
lo_toolbar->add( iv_txt = lo_repo->get_name( )
|
||||
|
@ -517,8 +523,28 @@ CLASS lcl_gui_page_main IMPLEMENTATION.
|
|||
|
||||
METHOD lif_gui_page~on_event.
|
||||
|
||||
DATA: lv_key TYPE lcl_persistence_repo=>ty_repo-key,
|
||||
lo_repo TYPE REF TO lcl_repo,
|
||||
lv_url TYPE string.
|
||||
|
||||
|
||||
CASE iv_action.
|
||||
WHEN 'show'.
|
||||
WHEN c_actions-newoffline.
|
||||
lo_repo = lcl_popups=>repo_new_offline( ).
|
||||
mv_show = lo_repo->get_key( ).
|
||||
lcl_app=>user( )->set_repo_show( mv_show ).
|
||||
ev_state = gc_event_state-re_render.
|
||||
WHEN c_actions-switch_branch.
|
||||
lv_key = iv_getdata.
|
||||
lcl_popups=>switch_branch( lv_key ).
|
||||
ev_state = gc_event_state-re_render.
|
||||
WHEN c_actions-install.
|
||||
lv_url = iv_getdata.
|
||||
lo_repo = lcl_popups=>repo_clone( lv_url ).
|
||||
mv_show = lo_repo->get_key( ).
|
||||
lcl_app=>user( )->set_repo_show( mv_show ).
|
||||
ev_state = gc_event_state-re_render.
|
||||
WHEN c_actions-show.
|
||||
mv_show = iv_getdata.
|
||||
lcl_app=>user( )->set_repo_show( mv_show ).
|
||||
ev_state = gc_event_state-re_render.
|
||||
|
|
212
src/zabapgit_popups.prog.abap
Normal file
212
src/zabapgit_popups.prog.abap
Normal file
|
@ -0,0 +1,212 @@
|
|||
*&---------------------------------------------------------------------*
|
||||
*& Include ZABAPGIT_POPUPS
|
||||
*&---------------------------------------------------------------------*
|
||||
|
||||
"! various popups, static methods, no class/object state
|
||||
CLASS lcl_popups DEFINITION.
|
||||
|
||||
PUBLIC SECTION.
|
||||
TYPES: BEGIN OF ty_popup,
|
||||
url TYPE string,
|
||||
package TYPE devclass,
|
||||
branch_name TYPE string,
|
||||
cancel TYPE abap_bool,
|
||||
END OF ty_popup.
|
||||
|
||||
CLASS-METHODS:
|
||||
repo_new_offline
|
||||
RETURNING VALUE(ro_repo) TYPE REF TO lcl_repo_offline
|
||||
RAISING lcx_exception,
|
||||
switch_branch
|
||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
||||
RAISING lcx_exception,
|
||||
repo_popup
|
||||
IMPORTING iv_url TYPE string
|
||||
iv_package TYPE devclass OPTIONAL
|
||||
iv_branch TYPE string DEFAULT 'refs/heads/master'
|
||||
RETURNING VALUE(rs_popup) TYPE ty_popup
|
||||
RAISING lcx_exception ##NO_TEXT,
|
||||
repo_clone
|
||||
IMPORTING iv_url TYPE string
|
||||
RETURNING VALUE(ro_repo) TYPE REF TO lcl_repo_online
|
||||
RAISING lcx_exception.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_popups IMPLEMENTATION.
|
||||
|
||||
DEFINE _add_dialog_fld.
|
||||
APPEND INITIAL LINE TO lt_fields ASSIGNING <ls_field>.
|
||||
<ls_field>-tabname = &1. "#EC NOTEXT
|
||||
<ls_field>-fieldname = &2. "#EC NOTEXT
|
||||
<ls_field>-fieldtext = &3. "#EC NOTEXT
|
||||
<ls_field>-value = &4. "#EC NOTEXT
|
||||
<ls_field>-field_attr = &5. "#EC NOTEXT
|
||||
END-OF-DEFINITION.
|
||||
|
||||
METHOD repo_new_offline.
|
||||
|
||||
DATA: lv_returncode TYPE c,
|
||||
lv_url TYPE string,
|
||||
lv_package TYPE devclass,
|
||||
lt_fields TYPE TABLE OF sval.
|
||||
|
||||
FIELD-SYMBOLS: <ls_field> LIKE LINE OF lt_fields.
|
||||
|
||||
|
||||
" TAB FLD LABEL DEF ATTR
|
||||
_add_dialog_fld 'ABAPTXT255' 'LINE' 'Name' '' ''.
|
||||
_add_dialog_fld 'TDEVC' 'DEVCLASS' 'Package' '' ''.
|
||||
|
||||
CALL FUNCTION 'POPUP_GET_VALUES'
|
||||
EXPORTING
|
||||
no_value_check = abap_true
|
||||
popup_title = 'New Offline Project' "#EC NOTEXT
|
||||
IMPORTING
|
||||
returncode = lv_returncode
|
||||
TABLES
|
||||
fields = lt_fields
|
||||
EXCEPTIONS
|
||||
error_in_fields = 1
|
||||
OTHERS = 2.
|
||||
IF sy-subrc <> 0.
|
||||
_raise 'Error from POPUP_GET_VALUES'.
|
||||
ENDIF.
|
||||
IF lv_returncode = 'A'.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
READ TABLE lt_fields INDEX 1 ASSIGNING <ls_field>.
|
||||
ASSERT sy-subrc = 0.
|
||||
lv_url = <ls_field>-value.
|
||||
|
||||
READ TABLE lt_fields INDEX 2 ASSIGNING <ls_field>.
|
||||
ASSERT sy-subrc = 0.
|
||||
lv_package = <ls_field>-value.
|
||||
TRANSLATE lv_package TO UPPER CASE.
|
||||
|
||||
ro_repo = lcl_app=>repo_srv( )->new_offline(
|
||||
iv_url = lv_url
|
||||
iv_package = lv_package ).
|
||||
|
||||
COMMIT WORK.
|
||||
|
||||
ENDMETHOD. "repo_new_offline
|
||||
|
||||
METHOD switch_branch.
|
||||
|
||||
DATA: lo_repo TYPE REF TO lcl_repo_online,
|
||||
ls_popup TYPE ty_popup.
|
||||
|
||||
|
||||
lo_repo ?= lcl_app=>repo_srv( )->get( iv_key ).
|
||||
|
||||
ls_popup = repo_popup(
|
||||
iv_url = lo_repo->get_url( )
|
||||
iv_package = lo_repo->get_package( )
|
||||
iv_branch = lo_repo->get_branch_name( ) ).
|
||||
IF ls_popup-cancel = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
lo_repo->set_url( ls_popup-url ).
|
||||
lo_repo->set_branch_name( ls_popup-branch_name ).
|
||||
|
||||
COMMIT WORK.
|
||||
|
||||
lo_repo->deserialize( ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD repo_popup.
|
||||
|
||||
DATA: lv_returncode TYPE c,
|
||||
lv_icon_ok TYPE icon-name,
|
||||
lv_icon_br TYPE icon-name,
|
||||
lt_fields TYPE TABLE OF sval,
|
||||
lv_pattr TYPE spo_fattr,
|
||||
lv_button2 TYPE svalbutton-buttontext,
|
||||
lv_icon2 TYPE icon-name.
|
||||
|
||||
FIELD-SYMBOLS: <ls_field> LIKE LINE OF lt_fields.
|
||||
|
||||
|
||||
IF NOT iv_package IS INITIAL.
|
||||
lv_pattr = '05'.
|
||||
ELSE.
|
||||
lv_button2 = 'Create package' ##NO_TEXT.
|
||||
lv_icon2 = icon_msg.
|
||||
ENDIF.
|
||||
|
||||
* TAB FLD LABEL DEF ATTR
|
||||
_add_dialog_fld 'ABAPTXT255' 'LINE' 'Git Clone Url' iv_url ''.
|
||||
_add_dialog_fld 'TDEVC' 'DEVCLASS' 'Target Package' iv_package lv_pattr.
|
||||
_add_dialog_fld 'TEXTL' 'LINE' 'Branch' iv_branch '05'.
|
||||
|
||||
lv_icon_ok = icon_okay.
|
||||
lv_icon_br = icon_workflow_fork.
|
||||
|
||||
CALL FUNCTION 'POPUP_GET_VALUES_USER_BUTTONS'
|
||||
EXPORTING
|
||||
popup_title = 'Repository'
|
||||
programname = sy-repid
|
||||
formname = 'BRANCH_POPUP'
|
||||
ok_pushbuttontext = 'OK'
|
||||
icon_ok_push = lv_icon_ok
|
||||
first_pushbutton = 'Select branch'
|
||||
icon_button_1 = lv_icon_br
|
||||
second_pushbutton = lv_button2
|
||||
icon_button_2 = lv_icon2
|
||||
IMPORTING
|
||||
returncode = lv_returncode
|
||||
TABLES
|
||||
fields = lt_fields
|
||||
EXCEPTIONS
|
||||
error_in_fields = 1
|
||||
OTHERS = 2. "#EC NOTEXT
|
||||
IF sy-subrc <> 0.
|
||||
_raise 'Error from POPUP_GET_VALUES'.
|
||||
ENDIF.
|
||||
IF lv_returncode = 'A'.
|
||||
rs_popup-cancel = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
READ TABLE lt_fields INDEX 1 ASSIGNING <ls_field>.
|
||||
ASSERT sy-subrc = 0.
|
||||
rs_popup-url = <ls_field>-value.
|
||||
lcl_url=>name( rs_popup-url ). " validate
|
||||
|
||||
READ TABLE lt_fields INDEX 2 ASSIGNING <ls_field>.
|
||||
ASSERT sy-subrc = 0.
|
||||
rs_popup-package = <ls_field>-value.
|
||||
TRANSLATE rs_popup-package TO UPPER CASE.
|
||||
|
||||
READ TABLE lt_fields INDEX 3 ASSIGNING <ls_field>.
|
||||
ASSERT sy-subrc = 0.
|
||||
rs_popup-branch_name = <ls_field>-value.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD repo_clone.
|
||||
|
||||
DATA: ls_popup TYPE ty_popup.
|
||||
|
||||
|
||||
ls_popup = repo_popup( iv_url ).
|
||||
IF ls_popup-cancel = abap_true.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
ro_repo = lcl_app=>repo_srv( )->new_online(
|
||||
iv_url = ls_popup-url
|
||||
iv_branch_name = ls_popup-branch_name
|
||||
iv_package = ls_popup-package ).
|
||||
ro_repo->status( ). " check for errors
|
||||
ro_repo->deserialize( ).
|
||||
|
||||
COMMIT WORK.
|
||||
|
||||
ENDMETHOD. "repo_clone
|
||||
|
||||
ENDCLASS.
|
48
src/zabapgit_popups.prog.xml
Normal file
48
src/zabapgit_popups.prog.xml
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<PROGDIR>
|
||||
<NAME>ZABAPGIT_POPUPS</NAME>
|
||||
<STATE>A</STATE>
|
||||
<SQLX/>
|
||||
<EDTX/>
|
||||
<VARCL>X</VARCL>
|
||||
<DBAPL/>
|
||||
<DBNA/>
|
||||
<CLAS/>
|
||||
<TYPE/>
|
||||
<OCCURS/>
|
||||
<SUBC>I</SUBC>
|
||||
<APPL/>
|
||||
<SECU/>
|
||||
<CNAM/>
|
||||
<CDAT>0000-00-00</CDAT>
|
||||
<UNAM/>
|
||||
<UDAT>0000-00-00</UDAT>
|
||||
<VERN/>
|
||||
<LEVL/>
|
||||
<RSTAT/>
|
||||
<RMAND/>
|
||||
<RLOAD>E</RLOAD>
|
||||
<FIXPT/>
|
||||
<SSET/>
|
||||
<SDATE>0000-00-00</SDATE>
|
||||
<STIME/>
|
||||
<IDATE>0000-00-00</IDATE>
|
||||
<ITIME/>
|
||||
<LDBNAME/>
|
||||
<UCCHECK>X</UCCHECK>
|
||||
</PROGDIR>
|
||||
<TPOOL>
|
||||
<item>
|
||||
<ID>R</ID>
|
||||
<KEY/>
|
||||
<ENTRY>Include ZABAPGIT_POPUPS</ENTRY>
|
||||
<LENGTH>23</LENGTH>
|
||||
<SPLIT/>
|
||||
</item>
|
||||
</TPOOL>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
|
@ -101,8 +101,8 @@ CLASS lcl_repo_online DEFINITION INHERITING FROM lcl_repo FINAL.
|
|||
RETURNING VALUE(rt_results) TYPE ty_results_tt
|
||||
RAISING lcx_exception,
|
||||
push
|
||||
IMPORTING is_comment TYPE ty_comment
|
||||
io_stage TYPE REF TO lcl_stage
|
||||
IMPORTING is_comment TYPE ty_comment
|
||||
io_stage TYPE REF TO lcl_stage
|
||||
RAISING lcx_exception.
|
||||
|
||||
PRIVATE SECTION.
|
||||
|
|
|
@ -435,7 +435,7 @@ CLASS lcl_repo_srv IMPLEMENTATION.
|
|||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
||||
ASSERT 1 = 0.
|
||||
_raise 'repo not found, get'.
|
||||
|
||||
ENDMETHOD. "get
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user