mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-02 04:36:49 +08:00
Diff and Patch Pages Update (#5056)
* Diff and Patch Pages Update - Fix refresh of a single file on diff page (it was displaying all diffs afterwards) - Add some hotkey assignments - Replace "Refresh" after filename with icon normal: hover: * Local refresh on patch page * Update zcl_abapgit_gui_page_patch.clas.abap * Patch page: Add js for refresh all hotkey Co-authored-by: Christian Günter <christianguenter@googlemail.com>
This commit is contained in:
parent
2a27d34c08
commit
679f2050b0
|
@ -1730,7 +1730,8 @@ Patch.prototype.ID = {
|
||||||
|
|
||||||
Patch.prototype.ACTION = {
|
Patch.prototype.ACTION = {
|
||||||
PATCH_STAGE: "patch_stage",
|
PATCH_STAGE: "patch_stage",
|
||||||
REFRESH_LOCAL: "refresh_local"
|
REFRESH_LOCAL: "refresh_local",
|
||||||
|
REFRESH_ALL: "refresh_all"
|
||||||
};
|
};
|
||||||
|
|
||||||
Patch.prototype.escape = function(sFileName){
|
Patch.prototype.escape = function(sFileName){
|
||||||
|
@ -1877,6 +1878,10 @@ Patch.prototype.registerStagePatch = function registerStagePatch(){
|
||||||
this.submitPatch(this.ACTION.REFRESH_LOCAL);
|
this.submitPatch(this.ACTION.REFRESH_LOCAL);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
|
window.refreshAll = memoizeScrollPosition(function(){
|
||||||
|
this.submitPatch(this.ACTION.REFRESH_ALL);
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Patch.prototype.submitPatch = function(action) {
|
Patch.prototype.submitPatch = function(action) {
|
||||||
|
|
|
@ -148,9 +148,9 @@ CLASS zcl_abapgit_gui_page_diff DEFINITION
|
||||||
VALUE(rv_is_refrseh) TYPE abap_bool.
|
VALUE(rv_is_refrseh) TYPE abap_bool.
|
||||||
METHODS modify_files_before_diff_calc
|
METHODS modify_files_before_diff_calc
|
||||||
IMPORTING
|
IMPORTING
|
||||||
it_diff_files_old TYPE ty_file_diffs
|
!it_diff_files_old TYPE ty_file_diffs
|
||||||
CHANGING
|
RETURNING
|
||||||
ct_files TYPE zif_abapgit_definitions=>ty_stage_tt.
|
VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_stage_tt.
|
||||||
|
|
||||||
METHODS render_content
|
METHODS render_content
|
||||||
REDEFINITION .
|
REDEFINITION .
|
||||||
|
@ -625,6 +625,20 @@ CLASS zcl_abapgit_gui_page_diff IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD modify_files_before_diff_calc.
|
METHOD modify_files_before_diff_calc.
|
||||||
|
|
||||||
|
DATA ls_file LIKE LINE OF rt_files.
|
||||||
|
|
||||||
|
FIELD-SYMBOLS <ls_diff_file_old> TYPE ty_file_diff.
|
||||||
|
|
||||||
|
" We need to supply files again in calculate_diff. Because
|
||||||
|
" we only want to refresh the visible files. Otherwise all
|
||||||
|
" diff files would appear.
|
||||||
|
" Which is not wanted when we previously only selected particular files.
|
||||||
|
LOOP AT it_diff_files_old ASSIGNING <ls_diff_file_old>.
|
||||||
|
CLEAR ls_file.
|
||||||
|
MOVE-CORRESPONDING <ls_diff_file_old> TO ls_file-file.
|
||||||
|
INSERT ls_file INTO TABLE rt_files.
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
@ -666,11 +680,7 @@ CLASS zcl_abapgit_gui_page_diff IMPLEMENTATION.
|
||||||
refresh_local_object( iv_action ).
|
refresh_local_object( iv_action ).
|
||||||
ENDCASE.
|
ENDCASE.
|
||||||
|
|
||||||
modify_files_before_diff_calc(
|
lt_files = modify_files_before_diff_calc( lt_diff_files_old ).
|
||||||
EXPORTING
|
|
||||||
it_diff_files_old = lt_diff_files_old
|
|
||||||
CHANGING
|
|
||||||
ct_files = lt_files ).
|
|
||||||
|
|
||||||
calculate_diff( it_files = lt_files ).
|
calculate_diff( it_files = lt_files ).
|
||||||
|
|
||||||
|
@ -879,24 +889,19 @@ CLASS zcl_abapgit_gui_page_diff IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD render_diff_head_after_state.
|
METHOD render_diff_head_after_state.
|
||||||
|
|
||||||
DATA: lv_act_id TYPE string.
|
|
||||||
|
|
||||||
IF is_diff-fstate = c_fstate-both AND mv_unified = abap_true.
|
IF is_diff-fstate = c_fstate-both AND mv_unified = abap_true.
|
||||||
ii_html->add( '<span class="attention pad-sides">Attention: Unified mode'
|
ii_html->add( '<span class="attention pad-sides">Attention: Unified mode'
|
||||||
&& ' highlighting for MM assumes local file is newer ! </span>' ).
|
&& ' highlighting for MM assumes local file is newer ! </span>' ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
IF is_diff-obj_type IS NOT INITIAL AND is_diff-obj_name IS NOT INITIAL.
|
IF is_diff-obj_type IS NOT INITIAL AND is_diff-obj_name IS NOT INITIAL.
|
||||||
|
ii_html->add( '<span class="repo_name">' ).
|
||||||
lv_act_id = |{ c_actions-refresh_local_object }_{ is_diff-obj_type }_{ is_diff-obj_name }|.
|
ii_html->add_a( iv_txt = ii_html->icon( iv_name = 'redo-alt-solid'
|
||||||
|
iv_class = 'pad-sides'
|
||||||
ii_html->add_a(
|
iv_hint = 'Local refresh of this object' )
|
||||||
iv_txt = |Refresh|
|
iv_act = |{ c_actions-refresh_local_object }_{ is_diff-obj_type }_{ is_diff-obj_name }|
|
||||||
iv_typ = zif_abapgit_html=>c_action_type-sapevent
|
iv_class = |url| ).
|
||||||
iv_act = lv_act_id
|
ii_html->add( '</span>' ).
|
||||||
iv_id = lv_act_id
|
|
||||||
iv_title = |Local refresh of this object| ).
|
|
||||||
|
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
@ -1216,6 +1221,20 @@ CLASS zcl_abapgit_gui_page_diff IMPLEMENTATION.
|
||||||
ls_hotkey_action-hotkey = |r|.
|
ls_hotkey_action-hotkey = |r|.
|
||||||
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
|
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
|
||||||
|
|
||||||
ENDMETHOD.
|
ls_hotkey_action-description = |Refresh all|.
|
||||||
|
ls_hotkey_action-action = c_actions-refresh_all.
|
||||||
|
ls_hotkey_action-hotkey = |a|.
|
||||||
|
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
|
||||||
|
|
||||||
|
ls_hotkey_action-description = |Toogle split/unified|.
|
||||||
|
ls_hotkey_action-action = c_actions-toggle_unified.
|
||||||
|
ls_hotkey_action-hotkey = |u|.
|
||||||
|
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
|
||||||
|
|
||||||
|
ls_hotkey_action-description = |Toogle hidden characters|.
|
||||||
|
ls_hotkey_action-action = c_actions-toggle_hidden_chars.
|
||||||
|
ls_hotkey_action-hotkey = |h|.
|
||||||
|
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
|
|
@ -39,8 +39,7 @@ CLASS zcl_abapgit_gui_page_patch DEFINITION
|
||||||
render_diff_head_after_state REDEFINITION,
|
render_diff_head_after_state REDEFINITION,
|
||||||
insert_nav REDEFINITION,
|
insert_nav REDEFINITION,
|
||||||
render_line_split_row REDEFINITION,
|
render_line_split_row REDEFINITION,
|
||||||
refresh REDEFINITION,
|
refresh REDEFINITION.
|
||||||
modify_files_before_diff_calc REDEFINITION.
|
|
||||||
|
|
||||||
PRIVATE SECTION.
|
PRIVATE SECTION.
|
||||||
|
|
||||||
|
@ -424,26 +423,6 @@ CLASS zcl_abapgit_gui_page_patch IMPLEMENTATION.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
METHOD modify_files_before_diff_calc.
|
|
||||||
|
|
||||||
DATA: ls_file LIKE LINE OF ct_files.
|
|
||||||
|
|
||||||
FIELD-SYMBOLS: <ls_diff_file_old> TYPE zcl_abapgit_gui_page_diff=>ty_file_diff.
|
|
||||||
|
|
||||||
" We need to supply files again in calculate_diff. Because
|
|
||||||
" we only want to refresh the visible files. Otherwise all
|
|
||||||
" diff files would appear.
|
|
||||||
" Which is not wanted when we previously only selected particular files.
|
|
||||||
|
|
||||||
LOOP AT it_diff_files_old ASSIGNING <ls_diff_file_old>.
|
|
||||||
CLEAR: ls_file.
|
|
||||||
MOVE-CORRESPONDING <ls_diff_file_old> TO ls_file-file.
|
|
||||||
INSERT ls_file INTO TABLE ct_files.
|
|
||||||
ENDLOOP.
|
|
||||||
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
|
|
||||||
METHOD refresh.
|
METHOD refresh.
|
||||||
|
|
||||||
DATA: lt_diff_files_old TYPE ty_file_diffs.
|
DATA: lt_diff_files_old TYPE ty_file_diffs.
|
||||||
|
@ -491,17 +470,19 @@ CLASS zcl_abapgit_gui_page_patch IMPLEMENTATION.
|
||||||
|
|
||||||
DATA: lv_act_id TYPE string.
|
DATA: lv_act_id TYPE string.
|
||||||
|
|
||||||
IF is_diff-obj_type IS NOT INITIAL AND is_diff-obj_name IS NOT INITIAL.
|
|
||||||
|
|
||||||
lv_act_id = |{ c_actions-refresh_local_object }_{ is_diff-obj_type }_{ is_diff-obj_name }|.
|
lv_act_id = |{ c_actions-refresh_local_object }_{ is_diff-obj_type }_{ is_diff-obj_name }|.
|
||||||
|
|
||||||
ii_html->add_a(
|
IF is_diff-obj_type IS NOT INITIAL AND is_diff-obj_name IS NOT INITIAL.
|
||||||
iv_txt = |Refresh|
|
" Dummy link is handled in JS (based on ID)
|
||||||
iv_typ = zif_abapgit_html=>c_action_type-dummy
|
ii_html->add( '<span class="repo_name">' ).
|
||||||
iv_act = lv_act_id
|
ii_html->add_a( iv_txt = ii_html->icon( iv_name = 'redo-alt-solid'
|
||||||
|
iv_class = 'pad-sides'
|
||||||
|
iv_hint = 'Local refresh of this object' )
|
||||||
iv_id = lv_act_id
|
iv_id = lv_act_id
|
||||||
iv_title = |Local refresh of this object| ).
|
iv_act = lv_act_id
|
||||||
|
iv_typ = zif_abapgit_html=>c_action_type-dummy
|
||||||
|
iv_class = |url| ).
|
||||||
|
ii_html->add( '</span>' ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
@ -686,5 +667,10 @@ CLASS zcl_abapgit_gui_page_patch IMPLEMENTATION.
|
||||||
ls_hotkey_action-hotkey = |r|.
|
ls_hotkey_action-hotkey = |r|.
|
||||||
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
|
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
|
||||||
|
|
||||||
|
ls_hotkey_action-description = |Refresh all|.
|
||||||
|
ls_hotkey_action-action = |refreshAll|.
|
||||||
|
ls_hotkey_action-hotkey = |a|.
|
||||||
|
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user