mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-01 12:20:51 +08:00
Add refresh button to stage page (#4437)
This commit is contained in:
parent
431f7095f4
commit
45badeb527
|
@ -7,9 +7,10 @@ CLASS zcl_abapgit_gui_page_stage DEFINITION
|
||||||
INTERFACES zif_abapgit_gui_hotkeys.
|
INTERFACES zif_abapgit_gui_hotkeys.
|
||||||
|
|
||||||
CONSTANTS: BEGIN OF c_action,
|
CONSTANTS: BEGIN OF c_action,
|
||||||
stage_all TYPE string VALUE 'stage_all',
|
stage_refresh TYPE string VALUE 'stage_refresh',
|
||||||
stage_commit TYPE string VALUE 'stage_commit',
|
stage_all TYPE string VALUE 'stage_all',
|
||||||
stage_filter TYPE string VALUE 'stage_filter',
|
stage_commit TYPE string VALUE 'stage_commit',
|
||||||
|
stage_filter TYPE string VALUE 'stage_filter',
|
||||||
END OF c_action.
|
END OF c_action.
|
||||||
|
|
||||||
METHODS:
|
METHODS:
|
||||||
|
@ -132,6 +133,8 @@ CLASS zcl_abapgit_gui_page_stage DEFINITION
|
||||||
VALUE(ri_html) TYPE REF TO zif_abapgit_html
|
VALUE(ri_html) TYPE REF TO zif_abapgit_html
|
||||||
RAISING
|
RAISING
|
||||||
zcx_abapgit_exception .
|
zcx_abapgit_exception .
|
||||||
|
METHODS init_files
|
||||||
|
RAISING zcx_abapgit_exception.
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,12 +148,17 @@ CLASS zcl_abapgit_gui_page_stage IMPLEMENTATION.
|
||||||
|
|
||||||
IF lines( ms_files-local ) > 0
|
IF lines( ms_files-local ) > 0
|
||||||
OR lines( ms_files-remote ) > 0.
|
OR lines( ms_files-remote ) > 0.
|
||||||
ro_menu->add( iv_txt = |Diff|
|
ro_menu->add(
|
||||||
iv_act = |{ zif_abapgit_definitions=>c_action-go_diff }?key={ mo_repo->get_key( ) }| ).
|
iv_txt = 'Refresh'
|
||||||
|
iv_act = |{ c_action-stage_refresh }|
|
||||||
ro_menu->add( iv_txt = |Patch|
|
iv_opt = zif_abapgit_html=>c_html_opt-strong
|
||||||
iv_typ = zif_abapgit_html=>c_action_type-onclick
|
)->add(
|
||||||
iv_id = |patchBtn| ).
|
iv_txt = |Diff|
|
||||||
|
iv_act = |{ zif_abapgit_definitions=>c_action-go_diff }?key={ mo_repo->get_key( ) }|
|
||||||
|
)->add(
|
||||||
|
iv_txt = |Patch|
|
||||||
|
iv_typ = zif_abapgit_html=>c_action_type-onclick
|
||||||
|
iv_id = |patchBtn| ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
@ -201,7 +209,6 @@ CLASS zcl_abapgit_gui_page_stage IMPLEMENTATION.
|
||||||
|
|
||||||
ms_control-page_title = 'Stage'.
|
ms_control-page_title = 'Stage'.
|
||||||
mo_repo = io_repo.
|
mo_repo = io_repo.
|
||||||
ms_files = zcl_abapgit_factory=>get_stage_logic( )->get( mo_repo ).
|
|
||||||
mv_seed = iv_seed.
|
mv_seed = iv_seed.
|
||||||
|
|
||||||
IF mv_seed IS INITIAL. " Generate based on time unless obtained from diff page
|
IF mv_seed IS INITIAL. " Generate based on time unless obtained from diff page
|
||||||
|
@ -209,12 +216,9 @@ CLASS zcl_abapgit_gui_page_stage IMPLEMENTATION.
|
||||||
mv_seed = |stage{ lv_ts }|.
|
mv_seed = |stage{ lv_ts }|.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
|
init_files( ).
|
||||||
ms_control-page_menu = build_menu( ).
|
ms_control-page_menu = build_menu( ).
|
||||||
|
|
||||||
IF lines( ms_files-local ) = 0 AND lines( ms_files-remote ) = 0.
|
|
||||||
zcx_abapgit_exception=>raise( 'There are no changes that could be staged' ).
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
@ -865,6 +869,11 @@ CLASS zcl_abapgit_gui_page_stage IMPLEMENTATION.
|
||||||
rs_handled-page = get_page_patch( lo_stage ).
|
rs_handled-page = get_page_patch( lo_stage ).
|
||||||
rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page.
|
rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page.
|
||||||
|
|
||||||
|
WHEN c_action-stage_refresh.
|
||||||
|
mo_repo->refresh( abap_true ).
|
||||||
|
init_files( ).
|
||||||
|
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
|
||||||
|
|
||||||
WHEN OTHERS.
|
WHEN OTHERS.
|
||||||
rs_handled = super->zif_abapgit_gui_event_handler~on_event( ii_event ).
|
rs_handled = super->zif_abapgit_gui_event_handler~on_event( ii_event ).
|
||||||
ENDCASE.
|
ENDCASE.
|
||||||
|
@ -887,5 +896,18 @@ CLASS zcl_abapgit_gui_page_stage IMPLEMENTATION.
|
||||||
ls_hotkey_action-hotkey = |d|.
|
ls_hotkey_action-hotkey = |d|.
|
||||||
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
|
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
|
||||||
|
|
||||||
|
ls_hotkey_action-description = |Refresh|.
|
||||||
|
ls_hotkey_action-action = c_action-stage_refresh.
|
||||||
|
ls_hotkey_action-hotkey = |r|.
|
||||||
|
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD init_files.
|
||||||
|
ms_files = zcl_abapgit_factory=>get_stage_logic( )->get( mo_repo ).
|
||||||
|
IF lines( ms_files-local ) = 0 AND lines( ms_files-remote ) = 0.
|
||||||
|
zcx_abapgit_exception=>raise( 'There are no changes that could be staged' ).
|
||||||
|
ENDIF.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user