mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-01 12:20:51 +08:00

* Add get_switched_origin to repo_online * Add onclick action for radiobuttons * Refactor remote settings to allow for direct input without using value helps * Adjust branch overview error message Inform the user about the possibility of changing HEAD directly without using the value help (that failed to show up). * Fix hidden form fields taking up vertical space * Add min/max restriction to commit field on remote settings page * Implement basic validation for commit id on remote settings page * Load previous branch/tag when PR is selected in remote settings page to be able to switch back to it more easily * Use current form data in PR and tag selection on remote settings page, where possible. Otherwise check the form values are the same as the repo instance values. * Fix issue when changing URL and switching from PR at the same time * Remove repo dependency in PR enumerator to be able to list PRs for the current url on the repo remote settings page * Update zcl_abapgit_branch_overview.clas.abap Co-authored-by: Marc Bernard <59966492+mbtools@users.noreply.github.com>
103 lines
2.2 KiB
ABAP
103 lines
2.2 KiB
ABAP
CLASS zcl_abapgit_pr_enumerator DEFINITION
|
|
PUBLIC
|
|
FINAL
|
|
CREATE PUBLIC .
|
|
|
|
PUBLIC SECTION.
|
|
|
|
METHODS constructor
|
|
IMPORTING
|
|
iv_url TYPE string
|
|
RAISING
|
|
zcx_abapgit_exception.
|
|
|
|
METHODS get_pulls
|
|
RETURNING
|
|
VALUE(rt_pulls) TYPE zif_abapgit_pr_enum_provider=>ty_pull_requests
|
|
RAISING
|
|
zcx_abapgit_exception.
|
|
|
|
CLASS-METHODS new
|
|
IMPORTING
|
|
iv_url TYPE string
|
|
RETURNING
|
|
VALUE(ro_instance) TYPE REF TO zcl_abapgit_pr_enumerator
|
|
RAISING
|
|
zcx_abapgit_exception.
|
|
|
|
PROTECTED SECTION.
|
|
PRIVATE SECTION.
|
|
DATA mv_repo_url TYPE string.
|
|
DATA mi_enum_provider TYPE REF TO zif_abapgit_pr_enum_provider.
|
|
|
|
CLASS-METHODS create_provider
|
|
IMPORTING
|
|
iv_repo_url TYPE string
|
|
RETURNING
|
|
VALUE(ri_provider) TYPE REF TO zif_abapgit_pr_enum_provider
|
|
RAISING
|
|
zcx_abapgit_exception.
|
|
|
|
ENDCLASS.
|
|
|
|
|
|
|
|
CLASS zcl_abapgit_pr_enumerator IMPLEMENTATION.
|
|
|
|
|
|
METHOD constructor.
|
|
|
|
mv_repo_url = to_lower( iv_url ).
|
|
TRY.
|
|
mi_enum_provider = create_provider( mv_repo_url ).
|
|
CATCH zcx_abapgit_exception.
|
|
ENDTRY.
|
|
|
|
ENDMETHOD.
|
|
|
|
|
|
METHOD create_provider.
|
|
|
|
DATA li_agent TYPE REF TO zif_abapgit_http_agent.
|
|
DATA lv_user TYPE string.
|
|
DATA lv_repo TYPE string.
|
|
|
|
li_agent = zcl_abapgit_factory=>get_http_agent( ).
|
|
|
|
FIND ALL OCCURRENCES OF REGEX 'github\.com\/([^\/]+)\/([^\/]+)'
|
|
IN iv_repo_url
|
|
SUBMATCHES lv_user lv_repo.
|
|
IF sy-subrc = 0.
|
|
lv_repo = replace(
|
|
val = lv_repo
|
|
regex = '\.git$'
|
|
with = '' ).
|
|
CREATE OBJECT ri_provider TYPE zcl_abapgit_pr_enum_github
|
|
EXPORTING
|
|
iv_user_and_repo = |{ lv_user }/{ lv_repo }|
|
|
ii_http_agent = li_agent.
|
|
ELSE.
|
|
zcx_abapgit_exception=>raise( |PR enumeration is not supported for { iv_repo_url }| ).
|
|
ENDIF.
|
|
|
|
" TODO somewhen more providers
|
|
|
|
ENDMETHOD.
|
|
|
|
|
|
METHOD get_pulls.
|
|
|
|
IF mi_enum_provider IS NOT BOUND.
|
|
RETURN.
|
|
ENDIF.
|
|
|
|
rt_pulls = mi_enum_provider->list_pull_requests( ).
|
|
|
|
ENDMETHOD.
|
|
|
|
|
|
METHOD new.
|
|
CREATE OBJECT ro_instance EXPORTING iv_url = iv_url.
|
|
ENDMETHOD.
|
|
ENDCLASS.
|