mirror of
https://github.com/abapGit/abapGit.git
synced 2025-04-30 20:03:20 +08:00
Refactor Staging Page (#6595)
Co-authored-by: Lars Hvam <larshp@hotmail.com>
This commit is contained in:
parent
283020bf92
commit
b3c35f3e7a
|
@ -188,10 +188,9 @@ CLASS zcl_abapgit_gui_page_code_insp IMPLEMENTATION.
|
|||
ENDIF.
|
||||
ENDIF.
|
||||
|
||||
CREATE OBJECT rs_handled-page TYPE zcl_abapgit_gui_page_stage
|
||||
EXPORTING
|
||||
io_repo = lo_repo_online
|
||||
iv_sci_result = lv_sci_result.
|
||||
rs_handled-page = zcl_abapgit_gui_page_stage=>create(
|
||||
io_repo = lo_repo_online
|
||||
iv_sci_result = lv_sci_result ).
|
||||
|
||||
rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page.
|
||||
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
CLASS zcl_abapgit_gui_page_stage DEFINITION
|
||||
PUBLIC
|
||||
INHERITING FROM zcl_abapgit_gui_component
|
||||
FINAL
|
||||
CREATE PUBLIC INHERITING FROM zcl_abapgit_gui_page.
|
||||
CREATE PRIVATE.
|
||||
|
||||
PUBLIC SECTION.
|
||||
INTERFACES zif_abapgit_gui_hotkeys.
|
||||
|
||||
INTERFACES:
|
||||
zif_abapgit_gui_event_handler,
|
||||
zif_abapgit_gui_hotkeys,
|
||||
zif_abapgit_gui_menu_provider,
|
||||
zif_abapgit_gui_renderable.
|
||||
|
||||
CONSTANTS: BEGIN OF c_action,
|
||||
stage_refresh TYPE string VALUE 'stage_refresh',
|
||||
|
@ -13,6 +19,17 @@ CLASS zcl_abapgit_gui_page_stage DEFINITION
|
|||
stage_filter TYPE string VALUE 'stage_filter',
|
||||
END OF c_action.
|
||||
|
||||
CLASS-METHODS create
|
||||
IMPORTING
|
||||
io_repo TYPE REF TO zcl_abapgit_repo_online
|
||||
iv_seed TYPE string OPTIONAL
|
||||
iv_sci_result TYPE zif_abapgit_definitions=>ty_sci_result DEFAULT zif_abapgit_definitions=>c_sci_result-no_run
|
||||
ii_obj_filter TYPE REF TO zif_abapgit_object_filter OPTIONAL
|
||||
RETURNING
|
||||
VALUE(ri_page) TYPE REF TO zif_abapgit_gui_renderable
|
||||
RAISING
|
||||
zcx_abapgit_exception.
|
||||
|
||||
METHODS constructor
|
||||
IMPORTING
|
||||
io_repo TYPE REF TO zcl_abapgit_repo_online
|
||||
|
@ -22,11 +39,7 @@ CLASS zcl_abapgit_gui_page_stage DEFINITION
|
|||
RAISING
|
||||
zcx_abapgit_exception.
|
||||
|
||||
METHODS zif_abapgit_gui_event_handler~on_event REDEFINITION.
|
||||
|
||||
PROTECTED SECTION.
|
||||
METHODS:
|
||||
render_content REDEFINITION.
|
||||
|
||||
PRIVATE SECTION.
|
||||
|
||||
|
@ -94,9 +107,6 @@ CLASS zcl_abapgit_gui_page_stage DEFINITION
|
|||
VALUE(ro_stage) TYPE REF TO zcl_abapgit_stage
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
METHODS build_menu
|
||||
RETURNING
|
||||
VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar .
|
||||
METHODS get_page_patch
|
||||
IMPORTING
|
||||
!io_stage TYPE REF TO zcl_abapgit_stage
|
||||
|
@ -128,28 +138,6 @@ ENDCLASS.
|
|||
CLASS zcl_abapgit_gui_page_stage IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD build_menu.
|
||||
|
||||
CREATE OBJECT ro_menu EXPORTING iv_id = 'toolbar-main'.
|
||||
|
||||
IF lines( ms_files-local ) > 0
|
||||
OR lines( ms_files-remote ) > 0.
|
||||
ro_menu->add(
|
||||
iv_txt = 'Refresh'
|
||||
iv_act = |{ c_action-stage_refresh }|
|
||||
iv_opt = zif_abapgit_html=>c_html_opt-strong
|
||||
)->add(
|
||||
iv_txt = |Diff|
|
||||
iv_act = |{ zif_abapgit_definitions=>c_action-go_repo_diff }?key={ mo_repo->get_key( ) }|
|
||||
)->add(
|
||||
iv_txt = |Patch|
|
||||
iv_typ = zif_abapgit_html=>c_action_type-onclick
|
||||
iv_id = |patchBtn| ).
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD check_selected.
|
||||
|
||||
DATA:
|
||||
|
@ -196,7 +184,6 @@ CLASS zcl_abapgit_gui_page_stage IMPLEMENTATION.
|
|||
|
||||
super->constructor( ).
|
||||
|
||||
ms_control-page_title = 'Stage'.
|
||||
mo_repo = io_repo.
|
||||
mv_seed = iv_seed.
|
||||
mv_sci_result = iv_sci_result.
|
||||
|
@ -208,7 +195,6 @@ CLASS zcl_abapgit_gui_page_stage IMPLEMENTATION.
|
|||
ENDIF.
|
||||
|
||||
init_files( ).
|
||||
ms_control-page_menu = build_menu( ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
@ -236,6 +222,25 @@ CLASS zcl_abapgit_gui_page_stage IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD create.
|
||||
|
||||
DATA lo_component TYPE REF TO zcl_abapgit_gui_page_stage.
|
||||
|
||||
CREATE OBJECT lo_component
|
||||
EXPORTING
|
||||
io_repo = io_repo
|
||||
iv_seed = iv_seed
|
||||
iv_sci_result = iv_sci_result
|
||||
ii_obj_filter = ii_obj_filter.
|
||||
|
||||
ri_page = zcl_abapgit_gui_page_hoc=>create(
|
||||
iv_page_title = 'Stage'
|
||||
ii_page_menu_provider = lo_component
|
||||
ii_child_component = lo_component ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD find_changed_by.
|
||||
|
||||
DATA: ls_local LIKE LINE OF it_files-local,
|
||||
|
@ -420,33 +425,6 @@ CLASS zcl_abapgit_gui_page_stage IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD render_content.
|
||||
|
||||
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
|
||||
|
||||
ri_html->add( '<div class="repo">' ).
|
||||
ri_html->add( zcl_abapgit_gui_chunk_lib=>render_repo_top(
|
||||
io_repo = mo_repo
|
||||
iv_interactive_branch = abap_true ) ).
|
||||
ri_html->add( zcl_abapgit_gui_chunk_lib=>render_js_error_banner( ) ).
|
||||
ri_html->add( render_main_language_warning( ) ).
|
||||
|
||||
ri_html->add( '<div class="stage-container">' ).
|
||||
ri_html->add( render_actions( ) ).
|
||||
ri_html->add( render_list( ) ).
|
||||
ri_html->add( '</div>' ).
|
||||
|
||||
ri_html->add( '</div>' ).
|
||||
|
||||
register_handlers( ).
|
||||
gui_services( )->get_html_parts( )->add_part(
|
||||
iv_collection = zcl_abapgit_gui_component=>c_html_parts-hidden_forms
|
||||
ii_part = render_deferred_hidden_events( ) ).
|
||||
register_deferred_script( render_scripts( ) ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD render_deferred_hidden_events.
|
||||
|
||||
DATA ls_event TYPE zcl_abapgit_gui_chunk_lib=>ty_event_signature.
|
||||
|
@ -848,8 +826,6 @@ CLASS zcl_abapgit_gui_page_stage IMPLEMENTATION.
|
|||
mo_repo->refresh( abap_true ).
|
||||
init_files( ).
|
||||
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
|
||||
WHEN OTHERS.
|
||||
rs_handled = super->zif_abapgit_gui_event_handler~on_event( ii_event ).
|
||||
ENDCASE.
|
||||
|
||||
ENDMETHOD.
|
||||
|
@ -882,4 +858,54 @@ CLASS zcl_abapgit_gui_page_stage IMPLEMENTATION.
|
|||
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD zif_abapgit_gui_menu_provider~get_menu.
|
||||
|
||||
CREATE OBJECT ro_toolbar EXPORTING iv_id = 'toolbar-main'.
|
||||
|
||||
IF lines( ms_files-local ) > 0
|
||||
OR lines( ms_files-remote ) > 0.
|
||||
ro_toolbar->add(
|
||||
iv_txt = 'Refresh'
|
||||
iv_act = |{ c_action-stage_refresh }|
|
||||
iv_opt = zif_abapgit_html=>c_html_opt-strong
|
||||
)->add(
|
||||
iv_txt = |Diff|
|
||||
iv_act = |{ zif_abapgit_definitions=>c_action-go_repo_diff }?key={ mo_repo->get_key( ) }|
|
||||
)->add(
|
||||
iv_txt = |Patch|
|
||||
iv_typ = zif_abapgit_html=>c_action_type-onclick
|
||||
iv_id = |patchBtn| ).
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD zif_abapgit_gui_renderable~render.
|
||||
|
||||
register_handlers( ).
|
||||
|
||||
CREATE OBJECT ri_html TYPE zcl_abapgit_html.
|
||||
|
||||
ri_html->add( '<div class="repo">' ).
|
||||
ri_html->add( zcl_abapgit_gui_chunk_lib=>render_repo_top(
|
||||
io_repo = mo_repo
|
||||
iv_interactive_branch = abap_true ) ).
|
||||
ri_html->add( zcl_abapgit_gui_chunk_lib=>render_js_error_banner( ) ).
|
||||
ri_html->add( render_main_language_warning( ) ).
|
||||
|
||||
ri_html->add( '<div class="stage-container">' ).
|
||||
ri_html->add( render_actions( ) ).
|
||||
ri_html->add( render_list( ) ).
|
||||
ri_html->add( '</div>' ).
|
||||
|
||||
ri_html->add( '</div>' ).
|
||||
|
||||
gui_services( )->get_html_parts( )->add_part(
|
||||
iv_collection = zcl_abapgit_gui_component=>c_html_parts-hidden_forms
|
||||
ii_part = render_deferred_hidden_events( ) ).
|
||||
register_deferred_script( render_scripts( ) ).
|
||||
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
|
|
|
@ -334,12 +334,11 @@ CLASS zcl_abapgit_gui_router IMPLEMENTATION.
|
|||
|
||||
METHOD get_page_stage.
|
||||
|
||||
DATA: lo_repo TYPE REF TO zcl_abapgit_repo_online,
|
||||
lv_key TYPE zif_abapgit_persistence=>ty_repo-key,
|
||||
lv_seed TYPE string,
|
||||
lo_stage_page TYPE REF TO zcl_abapgit_gui_page_stage,
|
||||
lv_sci_result TYPE zif_abapgit_definitions=>ty_sci_result,
|
||||
lx_error TYPE REF TO cx_sy_move_cast_error.
|
||||
DATA: lo_repo TYPE REF TO zcl_abapgit_repo_online,
|
||||
lv_key TYPE zif_abapgit_persistence=>ty_repo-key,
|
||||
lv_seed TYPE string,
|
||||
lv_sci_result TYPE zif_abapgit_definitions=>ty_sci_result,
|
||||
lx_error TYPE REF TO cx_sy_move_cast_error.
|
||||
|
||||
lv_key = ii_event->query( )->get( 'KEY' ).
|
||||
lv_seed = ii_event->query( )->get( 'SEED' ).
|
||||
|
@ -375,14 +374,11 @@ CLASS zcl_abapgit_gui_router IMPLEMENTATION.
|
|||
" force refresh on stage, to make sure the latest local and remote files are used
|
||||
lo_repo->refresh( ).
|
||||
|
||||
CREATE OBJECT lo_stage_page
|
||||
EXPORTING
|
||||
io_repo = lo_repo
|
||||
iv_seed = lv_seed
|
||||
iv_sci_result = lv_sci_result
|
||||
ii_obj_filter = ii_obj_filter.
|
||||
|
||||
ri_page = lo_stage_page.
|
||||
ri_page = zcl_abapgit_gui_page_stage=>create(
|
||||
io_repo = lo_repo
|
||||
iv_seed = lv_seed
|
||||
iv_sci_result = lv_sci_result
|
||||
ii_obj_filter = ii_obj_filter ).
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD.
|
||||
|
@ -628,7 +624,7 @@ CLASS zcl_abapgit_gui_router IMPLEMENTATION.
|
|||
WHEN zif_abapgit_definitions=>c_action-repo_activate_objects. " Repo activate objects
|
||||
zcl_abapgit_services_repo=>activate_objects( lv_key ).
|
||||
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
|
||||
WHEN zif_abapgit_definitions=>c_action-repo_newonline. " New offline repo
|
||||
WHEN zif_abapgit_definitions=>c_action-repo_newonline. " New online repo
|
||||
rs_handled-page = zcl_abapgit_gui_page_addonline=>create( ).
|
||||
rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page.
|
||||
WHEN zif_abapgit_definitions=>c_action-flow. " Flow page
|
||||
|
|
Loading…
Reference in New Issue
Block a user