Refactor remote settings (#5483)

* 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>
This commit is contained in:
Fabian Lupa 2022-05-02 13:22:23 +02:00 committed by GitHub
parent 588fb00cb0
commit 872339dfe8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 617 additions and 374 deletions

View File

@ -7,7 +7,7 @@ CLASS zcl_abapgit_pr_enumerator DEFINITION
METHODS constructor METHODS constructor
IMPORTING IMPORTING
io_repo TYPE REF TO zcl_abapgit_repo iv_url TYPE string
RAISING RAISING
zcx_abapgit_exception. zcx_abapgit_exception.
@ -19,7 +19,7 @@ CLASS zcl_abapgit_pr_enumerator DEFINITION
CLASS-METHODS new CLASS-METHODS new
IMPORTING IMPORTING
io_repo TYPE REF TO zcl_abapgit_repo iv_url TYPE string
RETURNING RETURNING
VALUE(ro_instance) TYPE REF TO zcl_abapgit_pr_enumerator VALUE(ro_instance) TYPE REF TO zcl_abapgit_pr_enumerator
RAISING RAISING
@ -42,19 +42,12 @@ ENDCLASS.
CLASS ZCL_ABAPGIT_PR_ENUMERATOR IMPLEMENTATION. CLASS zcl_abapgit_pr_enumerator IMPLEMENTATION.
METHOD constructor. METHOD constructor.
DATA lo_repo_online TYPE REF TO zcl_abapgit_repo_online. mv_repo_url = to_lower( iv_url ).
IF io_repo IS NOT BOUND OR io_repo->is_offline( ) = abap_true.
RETURN.
ENDIF.
lo_repo_online ?= io_repo.
mv_repo_url = to_lower( lo_repo_online->get_url( ) ).
TRY. TRY.
mi_enum_provider = create_provider( mv_repo_url ). mi_enum_provider = create_provider( mv_repo_url ).
CATCH zcx_abapgit_exception. CATCH zcx_abapgit_exception.
@ -104,6 +97,6 @@ CLASS ZCL_ABAPGIT_PR_ENUMERATOR IMPLEMENTATION.
METHOD new. METHOD new.
CREATE OBJECT ro_instance EXPORTING io_repo = io_repo. CREATE OBJECT ro_instance EXPORTING iv_url = iv_url.
ENDMETHOD. ENDMETHOD.
ENDCLASS. ENDCLASS.

View File

@ -28,6 +28,8 @@ CLASS zcl_abapgit_repo_online DEFINITION
FOR zif_abapgit_repo_online~set_url . FOR zif_abapgit_repo_online~set_url .
ALIASES switch_origin ALIASES switch_origin
FOR zif_abapgit_repo_online~switch_origin . FOR zif_abapgit_repo_online~switch_origin .
ALIASES get_switched_origin
FOR zif_abapgit_repo_online~get_switched_origin.
METHODS check_and_create_package METHODS check_and_create_package
IMPORTING IMPORTING
@ -385,4 +387,8 @@ CLASS ZCL_ABAPGIT_REPO_ONLINE IMPLEMENTATION.
ENDIF. ENDIF.
ENDMETHOD. ENDMETHOD.
METHOD zif_abapgit_repo_online~get_switched_origin.
rv_switched_origin = ms_data-switched_origin.
ENDMETHOD.
ENDCLASS. ENDCLASS.

View File

@ -40,6 +40,9 @@ INTERFACE zif_abapgit_repo_online
!iv_overwrite TYPE abap_bool DEFAULT abap_false !iv_overwrite TYPE abap_bool DEFAULT abap_false
RAISING RAISING
zcx_abapgit_exception . zcx_abapgit_exception .
METHODS get_switched_origin
RETURNING
VALUE(rv_switched_origin) TYPE zif_abapgit_persistence=>ty_repo-switched_origin.
METHODS push METHODS push
IMPORTING IMPORTING
!is_comment TYPE zif_abapgit_definitions=>ty_comment !is_comment TYPE zif_abapgit_definitions=>ty_comment

View File

@ -1196,6 +1196,9 @@ settings_tab tr:first-child td { border-top: 0px; }
margin: 4px 0px; margin: 4px 0px;
padding-left: 0.5em; padding-left: 0.5em;
} }
.dialog li.hidden {
padding: 0px 0px;
}
.dialog .radio-container { .dialog .radio-container {
border: 1px solid; border: 1px solid;
display: inline-block; display: inline-block;

File diff suppressed because it is too large Load Diff

View File

@ -83,6 +83,7 @@ CLASS zcl_abapgit_html_form DEFINITION
!iv_default_value TYPE csequence OPTIONAL !iv_default_value TYPE csequence OPTIONAL
!iv_hint TYPE csequence OPTIONAL !iv_hint TYPE csequence OPTIONAL
!iv_condense TYPE abap_bool DEFAULT abap_false !iv_condense TYPE abap_bool DEFAULT abap_false
!iv_action TYPE csequence OPTIONAL
RETURNING RETURNING
VALUE(ro_self) TYPE REF TO zcl_abapgit_html_form . VALUE(ro_self) TYPE REF TO zcl_abapgit_html_form .
METHODS option METHODS option
@ -332,6 +333,7 @@ CLASS zcl_abapgit_html_form IMPLEMENTATION.
ls_field-label = iv_label. ls_field-label = iv_label.
ls_field-default_value = iv_default_value. ls_field-default_value = iv_default_value.
ls_field-hint = iv_hint. ls_field-hint = iv_hint.
ls_field-click = iv_action.
" put options into one column instead of side-by-side " put options into one column instead of side-by-side
ls_field-condense = iv_condense. ls_field-condense = iv_condense.
@ -535,6 +537,9 @@ CLASS zcl_abapgit_html_form IMPLEMENTATION.
" Reduced width for short fields " Reduced width for short fields
lv_item_class = lv_item_class && ' w40'. lv_item_class = lv_item_class && ' w40'.
ENDIF. ENDIF.
IF is_field-type = zif_abapgit_html_form=>c_field_type-hidden.
lv_item_class = lv_item_class && ' hidden'.
ENDIF.
IF lv_item_class IS NOT INITIAL. IF lv_item_class IS NOT INITIAL.
lv_item_class = | class="{ lv_item_class }"|. lv_item_class = | class="{ lv_item_class }"|.
ENDIF. ENDIF.
@ -627,7 +632,8 @@ CLASS zcl_abapgit_html_form IMPLEMENTATION.
DATA: DATA:
lv_checked TYPE string, lv_checked TYPE string,
lv_opt_id TYPE string, lv_opt_id TYPE string,
lv_opt_value TYPE string. lv_opt_value TYPE string,
lv_onclick TYPE string.
FIELD-SYMBOLS <ls_opt> LIKE LINE OF is_field-subitems. FIELD-SYMBOLS <ls_opt> LIKE LINE OF is_field-subitems.
@ -648,12 +654,19 @@ CLASS zcl_abapgit_html_form IMPLEMENTATION.
lv_checked = ' checked'. lv_checked = ' checked'.
ENDIF. ENDIF.
CLEAR lv_onclick.
IF is_field-click IS NOT INITIAL.
lv_onclick = |onclick="document.getElementById('{ mv_form_id }').action = 'sapevent:|
&& |{ is_field-click }'; document.getElementById('{ mv_form_id }').submit()"|.
ENDIF.
lv_opt_id = |{ is_field-name }{ sy-tabix }|. lv_opt_id = |{ is_field-name }{ sy-tabix }|.
IF is_field-condense = abap_true. IF is_field-condense = abap_true.
ii_html->add( '<div>' ). ii_html->add( '<div>' ).
ENDIF. ENDIF.
ii_html->add( |<input type="radio" name="{ is_field-name }" id="{ lv_opt_id }"| ii_html->add( |<input type="radio" name="{ is_field-name }" id="{ lv_opt_id }"|
&& | value="{ lv_opt_value }"{ lv_checked }{ is_attr-autofocus }>| ). && | value="{ lv_opt_value }"{ lv_checked }{ is_attr-autofocus }|
&& | { lv_onclick }>| ).
ii_html->add( |<label for="{ lv_opt_id }">{ <ls_opt>-label }</label>| ). ii_html->add( |<label for="{ lv_opt_id }">{ <ls_opt>-label }</label>| ).
IF is_field-condense = abap_true. IF is_field-condense = abap_true.
ii_html->add( '</div>' ). ii_html->add( '</div>' ).

View File

@ -16,6 +16,7 @@ INTERFACE zif_abapgit_html_form
label TYPE string, label TYPE string,
hint TYPE string, hint TYPE string,
dblclick TYPE string, dblclick TYPE string,
click TYPE string,
placeholder TYPE string, placeholder TYPE string,
required TYPE string, required TYPE string,
upper_case TYPE abap_bool, upper_case TYPE abap_bool,