mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-01 12:20:51 +08:00
refactor ZCL_ABAPGIT_HTML_POPUPS (#6368)
This commit is contained in:
parent
8b568e6e45
commit
518e7ca576
|
@ -1,58 +0,0 @@
|
||||||
CLASS zcl_abapgit_html_popups DEFINITION
|
|
||||||
PUBLIC
|
|
||||||
FINAL
|
|
||||||
CREATE PUBLIC .
|
|
||||||
|
|
||||||
PUBLIC SECTION.
|
|
||||||
|
|
||||||
CLASS-METHODS branch_list
|
|
||||||
IMPORTING
|
|
||||||
!iv_url TYPE string
|
|
||||||
!iv_default_branch TYPE string OPTIONAL
|
|
||||||
!iv_show_new_option TYPE abap_bool DEFAULT abap_false
|
|
||||||
RETURNING
|
|
||||||
VALUE(ri_popup) TYPE REF TO zif_abapgit_html_popup.
|
|
||||||
|
|
||||||
CLASS-METHODS pull_request_list
|
|
||||||
IMPORTING
|
|
||||||
iv_url TYPE string
|
|
||||||
RETURNING
|
|
||||||
VALUE(ri_popup) TYPE REF TO zif_abapgit_html_popup.
|
|
||||||
|
|
||||||
CLASS-METHODS tag_list
|
|
||||||
IMPORTING
|
|
||||||
iv_url TYPE string
|
|
||||||
RETURNING
|
|
||||||
VALUE(ri_popup) TYPE REF TO zif_abapgit_html_popup.
|
|
||||||
|
|
||||||
PROTECTED SECTION.
|
|
||||||
PRIVATE SECTION.
|
|
||||||
ENDCLASS.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CLASS zcl_abapgit_html_popups IMPLEMENTATION.
|
|
||||||
|
|
||||||
|
|
||||||
METHOD branch_list.
|
|
||||||
CREATE OBJECT ri_popup TYPE lcl_branch_popup
|
|
||||||
EXPORTING
|
|
||||||
iv_url = iv_url
|
|
||||||
iv_default_branch = iv_default_branch
|
|
||||||
iv_show_new_option = iv_show_new_option.
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
|
|
||||||
METHOD pull_request_list.
|
|
||||||
CREATE OBJECT ri_popup TYPE lcl_pr_popup
|
|
||||||
EXPORTING
|
|
||||||
iv_url = iv_url.
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
|
|
||||||
METHOD tag_list.
|
|
||||||
CREATE OBJECT ri_popup TYPE lcl_tag_popup
|
|
||||||
EXPORTING
|
|
||||||
iv_url = iv_url.
|
|
||||||
ENDMETHOD.
|
|
||||||
ENDCLASS.
|
|
|
@ -1,238 +0,0 @@
|
||||||
CLASS lcl_pr_popup DEFINITION FINAL.
|
|
||||||
|
|
||||||
PUBLIC SECTION.
|
|
||||||
|
|
||||||
INTERFACES zif_abapgit_gui_render_item.
|
|
||||||
INTERFACES zif_abapgit_html_popup.
|
|
||||||
|
|
||||||
METHODS constructor
|
|
||||||
IMPORTING
|
|
||||||
iv_url TYPE string.
|
|
||||||
|
|
||||||
PRIVATE SECTION.
|
|
||||||
|
|
||||||
DATA mv_repo_url TYPE string.
|
|
||||||
|
|
||||||
METHODS fetch_pull_request_list
|
|
||||||
RETURNING
|
|
||||||
VALUE(rt_pulls) TYPE zif_abapgit_pr_enum_provider=>ty_pull_requests
|
|
||||||
RAISING
|
|
||||||
zcx_abapgit_exception.
|
|
||||||
|
|
||||||
ENDCLASS.
|
|
||||||
|
|
||||||
CLASS lcl_pr_popup IMPLEMENTATION.
|
|
||||||
|
|
||||||
METHOD constructor.
|
|
||||||
mv_repo_url = iv_url.
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
METHOD zif_abapgit_html_popup~create_picklist.
|
|
||||||
|
|
||||||
CREATE OBJECT ro_picklist
|
|
||||||
EXPORTING
|
|
||||||
iv_title = 'Choose Pull Request'
|
|
||||||
it_list = fetch_pull_request_list( )
|
|
||||||
ii_item_renderer = me.
|
|
||||||
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
METHOD fetch_pull_request_list.
|
|
||||||
|
|
||||||
rt_pulls = zcl_abapgit_pr_enumerator=>new( mv_repo_url )->get_pulls( ).
|
|
||||||
|
|
||||||
IF lines( rt_pulls ) = 0.
|
|
||||||
zcx_abapgit_exception=>raise( 'No pull requests found' ).
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
|
|
||||||
METHOD zif_abapgit_gui_render_item~render.
|
|
||||||
|
|
||||||
FIELD-SYMBOLS <ls_pr> TYPE zif_abapgit_pr_enum_provider=>ty_pull_request.
|
|
||||||
|
|
||||||
ASSIGN iv_item TO <ls_pr>.
|
|
||||||
ASSERT sy-subrc = 0.
|
|
||||||
|
|
||||||
ri_html = zcl_abapgit_html=>create( |<b>{ <ls_pr>-number }</b> - { <ls_pr>-title } @{ <ls_pr>-user }| ).
|
|
||||||
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
ENDCLASS.
|
|
||||||
|
|
||||||
**********************************************************************
|
|
||||||
|
|
||||||
CLASS lcl_branch_popup DEFINITION FINAL.
|
|
||||||
|
|
||||||
PUBLIC SECTION.
|
|
||||||
|
|
||||||
INTERFACES zif_abapgit_gui_render_item.
|
|
||||||
INTERFACES zif_abapgit_html_popup.
|
|
||||||
|
|
||||||
METHODS constructor
|
|
||||||
IMPORTING
|
|
||||||
!iv_url TYPE string
|
|
||||||
!iv_default_branch TYPE string OPTIONAL
|
|
||||||
!iv_show_new_option TYPE abap_bool DEFAULT abap_false.
|
|
||||||
|
|
||||||
PRIVATE SECTION.
|
|
||||||
|
|
||||||
DATA mv_repo_url TYPE string.
|
|
||||||
DATA mv_default_branch TYPE string.
|
|
||||||
DATA mv_show_new_option TYPE abap_bool.
|
|
||||||
|
|
||||||
METHODS fetch_branch_list
|
|
||||||
RETURNING
|
|
||||||
VALUE(rt_branches) TYPE zif_abapgit_git_definitions=>ty_git_branch_list_tt
|
|
||||||
RAISING
|
|
||||||
zcx_abapgit_exception.
|
|
||||||
|
|
||||||
ENDCLASS.
|
|
||||||
|
|
||||||
CLASS lcl_branch_popup IMPLEMENTATION.
|
|
||||||
|
|
||||||
|
|
||||||
METHOD constructor.
|
|
||||||
mv_repo_url = iv_url.
|
|
||||||
mv_default_branch = zif_abapgit_git_definitions=>c_git_branch-heads_prefix && iv_default_branch.
|
|
||||||
mv_show_new_option = iv_show_new_option.
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
METHOD zif_abapgit_html_popup~create_picklist.
|
|
||||||
|
|
||||||
CREATE OBJECT ro_picklist
|
|
||||||
EXPORTING
|
|
||||||
iv_title = 'Choose Branch'
|
|
||||||
it_list = fetch_branch_list( )
|
|
||||||
ii_item_renderer = me.
|
|
||||||
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
METHOD fetch_branch_list.
|
|
||||||
|
|
||||||
DATA lo_branches TYPE REF TO zcl_abapgit_git_branch_list.
|
|
||||||
DATA lv_head_symref TYPE string.
|
|
||||||
|
|
||||||
FIELD-SYMBOLS <ls_branch> LIKE LINE OF rt_branches.
|
|
||||||
|
|
||||||
lo_branches = zcl_abapgit_git_transport=>branches( mv_repo_url ).
|
|
||||||
rt_branches = lo_branches->get_branches_only( ).
|
|
||||||
lv_head_symref = lo_branches->get_head_symref( ).
|
|
||||||
|
|
||||||
IF rt_branches IS INITIAL.
|
|
||||||
zcx_abapgit_exception=>raise( 'No branches are available to select' ).
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
" Clean up branches: HEAD duplicates, empty names
|
|
||||||
LOOP AT rt_branches ASSIGNING <ls_branch>.
|
|
||||||
IF <ls_branch>-name IS INITIAL.
|
|
||||||
DELETE rt_branches INDEX sy-tabix.
|
|
||||||
ELSEIF <ls_branch>-is_head = abap_true AND lv_head_symref IS NOT INITIAL AND <ls_branch>-name <> lv_head_symref.
|
|
||||||
DELETE rt_branches INDEX sy-tabix.
|
|
||||||
ENDIF.
|
|
||||||
ENDLOOP.
|
|
||||||
|
|
||||||
SORT rt_branches BY is_head DESCENDING display_name ASCENDING.
|
|
||||||
|
|
||||||
IF mv_show_new_option = abap_true.
|
|
||||||
APPEND INITIAL LINE TO rt_branches ASSIGNING <ls_branch>.
|
|
||||||
<ls_branch>-name = zif_abapgit_popups=>c_new_branch_label.
|
|
||||||
<ls_branch>-display_name = zif_abapgit_popups=>c_new_branch_label.
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
METHOD zif_abapgit_gui_render_item~render.
|
|
||||||
|
|
||||||
DATA lv_head_marker TYPE string.
|
|
||||||
FIELD-SYMBOLS <ls_b> TYPE zif_abapgit_git_definitions=>ty_git_branch.
|
|
||||||
|
|
||||||
ASSIGN iv_item TO <ls_b>.
|
|
||||||
ASSERT sy-subrc = 0.
|
|
||||||
|
|
||||||
" TODO render mv_default_branch properly, needs respecting support from the picklist components
|
|
||||||
|
|
||||||
IF <ls_b>-is_head = abap_true.
|
|
||||||
lv_head_marker = | (<b>{ zif_abapgit_git_definitions=>c_head_name }</b>)|.
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
ri_html = zcl_abapgit_html=>create( |{ <ls_b>-display_name }{ lv_head_marker }| ).
|
|
||||||
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
ENDCLASS.
|
|
||||||
|
|
||||||
**********************************************************************
|
|
||||||
|
|
||||||
CLASS lcl_tag_popup DEFINITION FINAL.
|
|
||||||
|
|
||||||
PUBLIC SECTION.
|
|
||||||
|
|
||||||
INTERFACES zif_abapgit_gui_render_item.
|
|
||||||
INTERFACES zif_abapgit_html_popup.
|
|
||||||
|
|
||||||
METHODS constructor
|
|
||||||
IMPORTING
|
|
||||||
iv_url TYPE string.
|
|
||||||
|
|
||||||
PRIVATE SECTION.
|
|
||||||
|
|
||||||
DATA mv_repo_url TYPE string.
|
|
||||||
|
|
||||||
METHODS fetch_tag_list
|
|
||||||
RETURNING
|
|
||||||
VALUE(rt_tags) TYPE zif_abapgit_git_definitions=>ty_git_branch_list_tt
|
|
||||||
RAISING
|
|
||||||
zcx_abapgit_exception.
|
|
||||||
|
|
||||||
ENDCLASS.
|
|
||||||
|
|
||||||
CLASS lcl_tag_popup IMPLEMENTATION.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
METHOD constructor.
|
|
||||||
mv_repo_url = iv_url.
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
METHOD zif_abapgit_html_popup~create_picklist.
|
|
||||||
|
|
||||||
CREATE OBJECT ro_picklist
|
|
||||||
EXPORTING
|
|
||||||
iv_title = 'Choose Tag'
|
|
||||||
it_list = fetch_tag_list( )
|
|
||||||
ii_item_renderer = me.
|
|
||||||
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
METHOD fetch_tag_list.
|
|
||||||
|
|
||||||
DATA lo_branches TYPE REF TO zcl_abapgit_git_branch_list.
|
|
||||||
|
|
||||||
lo_branches = zcl_abapgit_git_transport=>branches( mv_repo_url ).
|
|
||||||
rt_tags = lo_branches->get_tags_only( ).
|
|
||||||
|
|
||||||
DELETE rt_tags WHERE name CP '*' && zif_abapgit_git_definitions=>c_git_branch-peel.
|
|
||||||
|
|
||||||
IF lines( rt_tags ) = 0.
|
|
||||||
zcx_abapgit_exception=>raise( 'No tags are available to select' ).
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
SORT rt_tags BY display_name ASCENDING.
|
|
||||||
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
|
|
||||||
METHOD zif_abapgit_gui_render_item~render.
|
|
||||||
|
|
||||||
FIELD-SYMBOLS <ls_tag> TYPE zif_abapgit_git_definitions=>ty_git_branch.
|
|
||||||
|
|
||||||
ASSIGN iv_item TO <ls_tag>.
|
|
||||||
ASSERT sy-subrc = 0.
|
|
||||||
|
|
||||||
ri_html = zcl_abapgit_html=>create( |{ <ls_tag>-display_name }| ).
|
|
||||||
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
ENDCLASS.
|
|
|
@ -221,7 +221,7 @@ CLASS zcl_abapgit_gui_page_sett_remo IMPLEMENTATION.
|
||||||
lv_url = mo_form_data->get( c_id-url ).
|
lv_url = mo_form_data->get( c_id-url ).
|
||||||
lv_branch_name = mo_form_data->get( c_id-branch ).
|
lv_branch_name = mo_form_data->get( c_id-branch ).
|
||||||
|
|
||||||
mo_popup_picklist = zcl_abapgit_html_popups=>branch_list(
|
mo_popup_picklist = zcl_abapgit_popup_branch_list=>create(
|
||||||
iv_show_new_option = abap_false
|
iv_show_new_option = abap_false
|
||||||
iv_url = lv_url
|
iv_url = lv_url
|
||||||
iv_default_branch = lv_branch_name
|
iv_default_branch = lv_branch_name
|
||||||
|
@ -283,7 +283,7 @@ CLASS zcl_abapgit_gui_page_sett_remo IMPLEMENTATION.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
lv_url = mo_form_data->get( c_id-url ).
|
lv_url = mo_form_data->get( c_id-url ).
|
||||||
mo_popup_picklist = zcl_abapgit_html_popups=>pull_request_list( lv_url
|
mo_popup_picklist = zcl_abapgit_popup_pull_request=>create( lv_url
|
||||||
)->create_picklist(
|
)->create_picklist(
|
||||||
)->set_id( c_event-choose_pull_request
|
)->set_id( c_event-choose_pull_request
|
||||||
)->set_in_page( abap_true ).
|
)->set_in_page( abap_true ).
|
||||||
|
@ -321,7 +321,7 @@ CLASS zcl_abapgit_gui_page_sett_remo IMPLEMENTATION.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
lv_url = mo_form_data->get( c_id-url ).
|
lv_url = mo_form_data->get( c_id-url ).
|
||||||
mo_popup_picklist = zcl_abapgit_html_popups=>tag_list( lv_url
|
mo_popup_picklist = zcl_abapgit_popup_tag_list=>create( lv_url
|
||||||
)->create_picklist(
|
)->create_picklist(
|
||||||
)->set_id( c_event-choose_tag
|
)->set_id( c_event-choose_tag
|
||||||
)->set_in_page( ).
|
)->set_in_page( ).
|
||||||
|
|
119
src/ui/popups/zcl_abapgit_popup_branch_list.clas.abap
Normal file
119
src/ui/popups/zcl_abapgit_popup_branch_list.clas.abap
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
CLASS zcl_abapgit_popup_branch_list DEFINITION
|
||||||
|
PUBLIC
|
||||||
|
FINAL
|
||||||
|
CREATE PUBLIC .
|
||||||
|
|
||||||
|
PUBLIC SECTION.
|
||||||
|
|
||||||
|
INTERFACES zif_abapgit_gui_render_item.
|
||||||
|
INTERFACES zif_abapgit_html_popup.
|
||||||
|
|
||||||
|
CLASS-METHODS create
|
||||||
|
IMPORTING
|
||||||
|
!iv_url TYPE string
|
||||||
|
!iv_default_branch TYPE string OPTIONAL
|
||||||
|
!iv_show_new_option TYPE abap_bool DEFAULT abap_false
|
||||||
|
RETURNING
|
||||||
|
VALUE(ri_popup) TYPE REF TO zif_abapgit_html_popup.
|
||||||
|
|
||||||
|
METHODS constructor
|
||||||
|
IMPORTING
|
||||||
|
!iv_url TYPE string
|
||||||
|
!iv_default_branch TYPE string OPTIONAL
|
||||||
|
!iv_show_new_option TYPE abap_bool DEFAULT abap_false.
|
||||||
|
|
||||||
|
PRIVATE SECTION.
|
||||||
|
|
||||||
|
DATA mv_repo_url TYPE string.
|
||||||
|
DATA mv_default_branch TYPE string.
|
||||||
|
DATA mv_show_new_option TYPE abap_bool.
|
||||||
|
|
||||||
|
METHODS fetch_branch_list
|
||||||
|
RETURNING
|
||||||
|
VALUE(rt_branches) TYPE zif_abapgit_git_definitions=>ty_git_branch_list_tt
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CLASS zcl_abapgit_popup_branch_list IMPLEMENTATION.
|
||||||
|
|
||||||
|
METHOD create.
|
||||||
|
CREATE OBJECT ri_popup TYPE zcl_abapgit_popup_branch_list
|
||||||
|
EXPORTING
|
||||||
|
iv_url = iv_url
|
||||||
|
iv_default_branch = iv_default_branch
|
||||||
|
iv_show_new_option = iv_show_new_option.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD constructor.
|
||||||
|
mv_repo_url = iv_url.
|
||||||
|
mv_default_branch = zif_abapgit_git_definitions=>c_git_branch-heads_prefix && iv_default_branch.
|
||||||
|
mv_show_new_option = iv_show_new_option.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD zif_abapgit_html_popup~create_picklist.
|
||||||
|
|
||||||
|
CREATE OBJECT ro_picklist
|
||||||
|
EXPORTING
|
||||||
|
iv_title = 'Choose Branch'
|
||||||
|
it_list = fetch_branch_list( )
|
||||||
|
ii_item_renderer = me.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD fetch_branch_list.
|
||||||
|
|
||||||
|
DATA lo_branches TYPE REF TO zcl_abapgit_git_branch_list.
|
||||||
|
DATA lv_head_symref TYPE string.
|
||||||
|
|
||||||
|
FIELD-SYMBOLS <ls_branch> LIKE LINE OF rt_branches.
|
||||||
|
|
||||||
|
lo_branches = zcl_abapgit_git_transport=>branches( mv_repo_url ).
|
||||||
|
rt_branches = lo_branches->get_branches_only( ).
|
||||||
|
lv_head_symref = lo_branches->get_head_symref( ).
|
||||||
|
|
||||||
|
IF rt_branches IS INITIAL.
|
||||||
|
zcx_abapgit_exception=>raise( 'No branches are available to select' ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
" Clean up branches: HEAD duplicates, empty names
|
||||||
|
LOOP AT rt_branches ASSIGNING <ls_branch>.
|
||||||
|
IF <ls_branch>-name IS INITIAL.
|
||||||
|
DELETE rt_branches INDEX sy-tabix.
|
||||||
|
ELSEIF <ls_branch>-is_head = abap_true AND lv_head_symref IS NOT INITIAL AND <ls_branch>-name <> lv_head_symref.
|
||||||
|
DELETE rt_branches INDEX sy-tabix.
|
||||||
|
ENDIF.
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
SORT rt_branches BY is_head DESCENDING display_name ASCENDING.
|
||||||
|
|
||||||
|
IF mv_show_new_option = abap_true.
|
||||||
|
APPEND INITIAL LINE TO rt_branches ASSIGNING <ls_branch>.
|
||||||
|
<ls_branch>-name = zif_abapgit_popups=>c_new_branch_label.
|
||||||
|
<ls_branch>-display_name = zif_abapgit_popups=>c_new_branch_label.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD zif_abapgit_gui_render_item~render.
|
||||||
|
|
||||||
|
DATA lv_head_marker TYPE string.
|
||||||
|
FIELD-SYMBOLS <ls_b> TYPE zif_abapgit_git_definitions=>ty_git_branch.
|
||||||
|
|
||||||
|
ASSIGN iv_item TO <ls_b>.
|
||||||
|
ASSERT sy-subrc = 0.
|
||||||
|
|
||||||
|
" TODO render mv_default_branch properly, needs respecting support from the picklist components
|
||||||
|
|
||||||
|
IF <ls_b>-is_head = abap_true.
|
||||||
|
lv_head_marker = | (<b>{ zif_abapgit_git_definitions=>c_head_name }</b>)|.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
ri_html = zcl_abapgit_html=>create( |{ <ls_b>-display_name }{ lv_head_marker }| ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
ENDCLASS.
|
16
src/ui/popups/zcl_abapgit_popup_branch_list.clas.xml
Normal file
16
src/ui/popups/zcl_abapgit_popup_branch_list.clas.xml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<VSEOCLASS>
|
||||||
|
<CLSNAME>ZCL_ABAPGIT_POPUP_BRANCH_LIST</CLSNAME>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>abapGit - Branch List Popup</DESCRIPT>
|
||||||
|
<STATE>1</STATE>
|
||||||
|
<CLSCCINCL>X</CLSCCINCL>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<UNICODE>X</UNICODE>
|
||||||
|
</VSEOCLASS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
80
src/ui/popups/zcl_abapgit_popup_pull_request.clas.abap
Normal file
80
src/ui/popups/zcl_abapgit_popup_pull_request.clas.abap
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
CLASS zcl_abapgit_popup_pull_request DEFINITION
|
||||||
|
PUBLIC
|
||||||
|
FINAL
|
||||||
|
CREATE PUBLIC .
|
||||||
|
|
||||||
|
PUBLIC SECTION.
|
||||||
|
|
||||||
|
INTERFACES zif_abapgit_gui_render_item.
|
||||||
|
INTERFACES zif_abapgit_html_popup.
|
||||||
|
|
||||||
|
CLASS-METHODS create
|
||||||
|
IMPORTING
|
||||||
|
iv_url TYPE string
|
||||||
|
RETURNING
|
||||||
|
VALUE(ri_popup) TYPE REF TO zif_abapgit_html_popup.
|
||||||
|
|
||||||
|
METHODS constructor
|
||||||
|
IMPORTING
|
||||||
|
iv_url TYPE string.
|
||||||
|
|
||||||
|
PRIVATE SECTION.
|
||||||
|
|
||||||
|
DATA mv_repo_url TYPE string.
|
||||||
|
|
||||||
|
METHODS fetch_pull_request_list
|
||||||
|
RETURNING
|
||||||
|
VALUE(rt_pulls) TYPE zif_abapgit_pr_enum_provider=>ty_pull_requests
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CLASS zcl_abapgit_popup_pull_request IMPLEMENTATION.
|
||||||
|
|
||||||
|
METHOD create.
|
||||||
|
|
||||||
|
CREATE OBJECT ri_popup TYPE zcl_abapgit_popup_pull_request
|
||||||
|
EXPORTING
|
||||||
|
iv_url = iv_url.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD constructor.
|
||||||
|
mv_repo_url = iv_url.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD zif_abapgit_html_popup~create_picklist.
|
||||||
|
|
||||||
|
CREATE OBJECT ro_picklist
|
||||||
|
EXPORTING
|
||||||
|
iv_title = 'Choose Pull Request'
|
||||||
|
it_list = fetch_pull_request_list( )
|
||||||
|
ii_item_renderer = me.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD fetch_pull_request_list.
|
||||||
|
|
||||||
|
rt_pulls = zcl_abapgit_pr_enumerator=>new( mv_repo_url )->get_pulls( ).
|
||||||
|
|
||||||
|
IF lines( rt_pulls ) = 0.
|
||||||
|
zcx_abapgit_exception=>raise( 'No pull requests found' ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD zif_abapgit_gui_render_item~render.
|
||||||
|
|
||||||
|
FIELD-SYMBOLS <ls_pr> TYPE zif_abapgit_pr_enum_provider=>ty_pull_request.
|
||||||
|
|
||||||
|
ASSIGN iv_item TO <ls_pr>.
|
||||||
|
ASSERT sy-subrc = 0.
|
||||||
|
|
||||||
|
ri_html = zcl_abapgit_html=>create( |<b>{ <ls_pr>-number }</b> - { <ls_pr>-title } @{ <ls_pr>-user }| ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
ENDCLASS.
|
16
src/ui/popups/zcl_abapgit_popup_pull_request.clas.xml
Normal file
16
src/ui/popups/zcl_abapgit_popup_pull_request.clas.xml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<VSEOCLASS>
|
||||||
|
<CLSNAME>ZCL_ABAPGIT_POPUP_PULL_REQUEST</CLSNAME>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>abapGit - Pull Request Popup</DESCRIPT>
|
||||||
|
<STATE>1</STATE>
|
||||||
|
<CLSCCINCL>X</CLSCCINCL>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<UNICODE>X</UNICODE>
|
||||||
|
</VSEOCLASS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
85
src/ui/popups/zcl_abapgit_popup_tag_list.clas.abap
Normal file
85
src/ui/popups/zcl_abapgit_popup_tag_list.clas.abap
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
CLASS zcl_abapgit_popup_tag_list DEFINITION
|
||||||
|
PUBLIC
|
||||||
|
FINAL
|
||||||
|
CREATE PUBLIC .
|
||||||
|
|
||||||
|
PUBLIC SECTION.
|
||||||
|
|
||||||
|
INTERFACES zif_abapgit_gui_render_item.
|
||||||
|
INTERFACES zif_abapgit_html_popup.
|
||||||
|
|
||||||
|
CLASS-METHODS create
|
||||||
|
IMPORTING
|
||||||
|
iv_url TYPE string
|
||||||
|
RETURNING
|
||||||
|
VALUE(ri_popup) TYPE REF TO zif_abapgit_html_popup.
|
||||||
|
|
||||||
|
METHODS constructor
|
||||||
|
IMPORTING
|
||||||
|
iv_url TYPE string.
|
||||||
|
|
||||||
|
PRIVATE SECTION.
|
||||||
|
|
||||||
|
DATA mv_repo_url TYPE string.
|
||||||
|
|
||||||
|
METHODS fetch_tag_list
|
||||||
|
RETURNING
|
||||||
|
VALUE(rt_tags) TYPE zif_abapgit_git_definitions=>ty_git_branch_list_tt
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception.
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CLASS zcl_abapgit_popup_tag_list IMPLEMENTATION.
|
||||||
|
|
||||||
|
METHOD create.
|
||||||
|
CREATE OBJECT ri_popup TYPE zcl_abapgit_popup_tag_list
|
||||||
|
EXPORTING
|
||||||
|
iv_url = iv_url.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD constructor.
|
||||||
|
mv_repo_url = iv_url.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD zif_abapgit_html_popup~create_picklist.
|
||||||
|
|
||||||
|
CREATE OBJECT ro_picklist
|
||||||
|
EXPORTING
|
||||||
|
iv_title = 'Choose Tag'
|
||||||
|
it_list = fetch_tag_list( )
|
||||||
|
ii_item_renderer = me.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD fetch_tag_list.
|
||||||
|
|
||||||
|
DATA lo_branches TYPE REF TO zcl_abapgit_git_branch_list.
|
||||||
|
|
||||||
|
lo_branches = zcl_abapgit_git_transport=>branches( mv_repo_url ).
|
||||||
|
rt_tags = lo_branches->get_tags_only( ).
|
||||||
|
|
||||||
|
DELETE rt_tags WHERE name CP '*' && zif_abapgit_git_definitions=>c_git_branch-peel.
|
||||||
|
|
||||||
|
IF lines( rt_tags ) = 0.
|
||||||
|
zcx_abapgit_exception=>raise( 'No tags are available to select' ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
SORT rt_tags BY display_name ASCENDING.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD zif_abapgit_gui_render_item~render.
|
||||||
|
|
||||||
|
FIELD-SYMBOLS <ls_tag> TYPE zif_abapgit_git_definitions=>ty_git_branch.
|
||||||
|
|
||||||
|
ASSIGN iv_item TO <ls_tag>.
|
||||||
|
ASSERT sy-subrc = 0.
|
||||||
|
|
||||||
|
ri_html = zcl_abapgit_html=>create( |{ <ls_tag>-display_name }| ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
ENDCLASS.
|
|
@ -3,9 +3,9 @@
|
||||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
<asx:values>
|
<asx:values>
|
||||||
<VSEOCLASS>
|
<VSEOCLASS>
|
||||||
<CLSNAME>ZCL_ABAPGIT_HTML_POPUPS</CLSNAME>
|
<CLSNAME>ZCL_ABAPGIT_POPUP_TAG_LIST</CLSNAME>
|
||||||
<LANGU>E</LANGU>
|
<LANGU>E</LANGU>
|
||||||
<DESCRIPT>abapGit - HTML Popup Library</DESCRIPT>
|
<DESCRIPT>abapGit - Tag List Popup</DESCRIPT>
|
||||||
<STATE>1</STATE>
|
<STATE>1</STATE>
|
||||||
<CLSCCINCL>X</CLSCCINCL>
|
<CLSCCINCL>X</CLSCCINCL>
|
||||||
<FIXPT>X</FIXPT>
|
<FIXPT>X</FIXPT>
|
Loading…
Reference in New Issue
Block a user