flow page, bugfixes (#6627)

This commit is contained in:
Lars Hvam 2023-11-12 08:36:31 +01:00 committed by GitHub
parent 79bbd2ffe7
commit 27743dbf34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 56 additions and 13 deletions

View File

@ -23,10 +23,10 @@
] ]
}, },
"devDependencies": { "devDependencies": {
"@abaplint/cli": "^2.102.70", "@abaplint/cli": "^2.103.6",
"@abaplint/database-sqlite": "^2.7.119", "@abaplint/database-sqlite": "^2.7.119",
"@abaplint/runtime": "^2.7.130", "@abaplint/runtime": "^2.7.135",
"@abaplint/transpiler-cli": "^2.7.130", "@abaplint/transpiler-cli": "^2.7.135",
"abapmerge": "^0.16.0", "abapmerge": "^0.16.0",
"c8": "^8.0.1", "c8": "^8.0.1",
"eslint": "^8.53.0" "eslint": "^8.53.0"

View File

@ -31,6 +31,15 @@ CLASS zcl_abapgit_gui_page_flow DEFINITION
END OF c_action . END OF c_action .
DATA mt_features TYPE ty_features . DATA mt_features TYPE ty_features .
METHODS refresh
RAISING
zcx_abapgit_exception .
METHODS set_branch
IMPORTING
!iv_branch TYPE string
!iv_key TYPE zif_abapgit_persistence=>ty_value
RAISING
zcx_abapgit_exception .
METHODS render_table METHODS render_table
IMPORTING IMPORTING
!iv_index TYPE i !iv_index TYPE i
@ -64,6 +73,22 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_FLOW IMPLEMENTATION.
ENDMETHOD. ENDMETHOD.
METHOD refresh.
DATA ls_feature LIKE LINE OF mt_features.
DATA lo_online TYPE REF TO zcl_abapgit_repo_online.
LOOP AT mt_features INTO ls_feature.
lo_online ?= zcl_abapgit_repo_srv=>get_instance( )->get( ls_feature-repo-key ).
lo_online->refresh( ).
ENDLOOP.
CLEAR mt_features.
ENDMETHOD.
METHOD render_table. METHOD render_table.
DATA ls_path_name LIKE LINE OF is_feature-changed_files. DATA ls_path_name LIKE LINE OF is_feature-changed_files.
@ -109,20 +134,36 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_FLOW IMPLEMENTATION.
iv_act = |{ c_action-pull }?index={ iv_index }&key={ is_feature-repo-key }| ) ). iv_act = |{ c_action-pull }?index={ iv_index }&key={ is_feature-repo-key }| ) ).
ri_html->add( ri_html->a( ri_html->add( ri_html->a(
iv_txt = 'Stage' iv_txt = 'Stage'
iv_act = |{ c_action-stage }?index={ iv_index }&key={ is_feature-repo-key }| ) ). iv_act = |{ c_action-stage }?index={ iv_index }&key={ is_feature-repo-key }&branch={ lv_branch }| ) ).
ri_html->add( |<br>| ). ri_html->add( |<br>| ).
ENDMETHOD. ENDMETHOD.
METHOD set_branch.
DATA lv_branch TYPE string.
DATA lo_online TYPE REF TO zcl_abapgit_repo_online.
IF iv_branch IS NOT INITIAL.
lv_branch = 'refs/heads/' && iv_branch.
lo_online ?= zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ).
IF lo_online->get_selected_branch( ) <> lv_branch.
lo_online->select_branch( lv_branch ).
ENDIF.
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_gui_event_handler~on_event. METHOD zif_abapgit_gui_event_handler~on_event.
DATA lv_key TYPE zif_abapgit_persistence=>ty_value. DATA lv_key TYPE zif_abapgit_persistence=>ty_value.
DATA lv_branch TYPE string. DATA lv_branch TYPE string.
DATA lo_online TYPE REF TO zcl_abapgit_repo_online.
DATA lo_filter TYPE REF TO lcl_filter. DATA lo_filter TYPE REF TO lcl_filter.
DATA lt_filter TYPE zif_abapgit_definitions=>ty_tadir_tt. DATA lt_filter TYPE zif_abapgit_definitions=>ty_tadir_tt.
DATA lv_index TYPE i. DATA lv_index TYPE i.
DATA lo_online TYPE REF TO zcl_abapgit_repo_online.
DATA ls_feature LIKE LINE OF mt_features. DATA ls_feature LIKE LINE OF mt_features.
FIELD-SYMBOLS <ls_object> LIKE LINE OF ls_feature-changed_objects. FIELD-SYMBOLS <ls_object> LIKE LINE OF ls_feature-changed_objects.
@ -131,21 +172,19 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_FLOW IMPLEMENTATION.
CASE ii_event->mv_action. CASE ii_event->mv_action.
WHEN c_action-refresh. WHEN c_action-refresh.
CLEAR mt_features. refresh( ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
WHEN zif_abapgit_definitions=>c_action-go_file_diff. WHEN zif_abapgit_definitions=>c_action-go_file_diff.
lv_key = ii_event->query( )->get( 'KEY' ). lv_key = ii_event->query( )->get( 'KEY' ).
lv_branch = ii_event->query( )->get( 'EXTRA' ). lv_branch = ii_event->query( )->get( 'EXTRA' ).
IF lv_branch IS NOT INITIAL. set_branch(
lv_branch = 'refs/heads/' && lv_branch. iv_branch = lv_branch
lo_online ?= zcl_abapgit_repo_srv=>get_instance( )->get( lv_key ). iv_key = lv_key ).
IF lo_online->get_selected_branch( ) <> lv_branch. * calling the page is done by the global router
lo_online->select_branch( lv_branch ).
ENDIF.
ENDIF.
WHEN c_action-stage. WHEN c_action-stage.
lv_key = ii_event->query( )->get( 'KEY' ). lv_key = ii_event->query( )->get( 'KEY' ).
lv_index = ii_event->query( )->get( 'INDEX' ). lv_index = ii_event->query( )->get( 'INDEX' ).
lv_branch = ii_event->query( )->get( 'BRANCH' ).
lo_online ?= zcl_abapgit_repo_srv=>get_instance( )->get( lv_key ). lo_online ?= zcl_abapgit_repo_srv=>get_instance( )->get( lv_key ).
READ TABLE mt_features INTO ls_feature INDEX lv_index. READ TABLE mt_features INTO ls_feature INDEX lv_index.
@ -158,6 +197,10 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_FLOW IMPLEMENTATION.
ENDLOOP. ENDLOOP.
CREATE OBJECT lo_filter EXPORTING it_filter = lt_filter. CREATE OBJECT lo_filter EXPORTING it_filter = lt_filter.
set_branch(
iv_branch = lv_branch
iv_key = lv_key ).
rs_handled-page = zcl_abapgit_gui_page_stage=>create( rs_handled-page = zcl_abapgit_gui_page_stage=>create(
io_repo = lo_online io_repo = lo_online
ii_obj_filter = lo_filter ). ii_obj_filter = lo_filter ).