diff --git a/src/zabapgit_file_status.prog.abap b/src/zabapgit_file_status.prog.abap index 23b7f409e..d23aac76b 100644 --- a/src/zabapgit_file_status.prog.abap +++ b/src/zabapgit_file_status.prog.abap @@ -157,7 +157,7 @@ CLASS lcl_file_status IMPLEMENTATION. ENDIF. CLEAR ls_result. - ls_result-match = abap_true. + ls_result-match = abap_false. ls_result-obj_type = -object. ls_result-obj_name = -obj_name. ls_result-new = gc_new-local. diff --git a/src/zabapgit_page_main.prog.abap b/src/zabapgit_page_main.prog.abap index c8cf32987..38cd1fb15 100644 --- a/src/zabapgit_page_main.prog.abap +++ b/src/zabapgit_page_main.prog.abap @@ -338,6 +338,10 @@ CLASS lcl_gui_page_main IMPLEMENTATION. _add ' padding-left: 0.5em;'. _add ' padding-right: 1em;'. _add '}'. + _add '.repo_tab td.cmd span.changed { color: #ff9933; }'. + _add '.repo_tab td.cmd span.none { color: #dddddd; }'. + _add '.repo_tab td.cmd span.unchanged { color: #cedeee; }'. + _add '.repo_tab td.cmd span.state-block { margin-left: 10px; }'. _add '.repo_tab tr.unsupported { color: lightgrey; }'. _add '.repo_tab tr.modified { background: #fbf7e9; }'. _add '.repo_tab tr:first-child td { border-top: 0px; }'. diff --git a/src/zabapgit_view_repo.prog.abap b/src/zabapgit_view_repo.prog.abap index c171b6ed2..78d08fc2e 100644 --- a/src/zabapgit_view_repo.prog.abap +++ b/src/zabapgit_view_repo.prog.abap @@ -174,29 +174,29 @@ CLASS lcl_repo_content_browser IMPLEMENTATION. DATA: lo_repo_online TYPE REF TO lcl_repo_online, ls_file TYPE ty_repo_file, - lt_results TYPE ty_results_tt. + lt_status TYPE ty_results_tt. - FIELD-SYMBOLS: LIKE LINE OF lt_results, + FIELD-SYMBOLS: LIKE LINE OF lt_status, LIKE LINE OF rt_repo_items. lo_repo_online ?= mo_repo. - lt_results = lo_repo_online->status( mo_log ). + lt_status = lo_repo_online->status( mo_log ). - LOOP AT lt_results ASSIGNING . + LOOP AT lt_status ASSIGNING . AT NEW obj_name. "obj_type + obj_name APPEND INITIAL LINE TO rt_repo_items ASSIGNING . - -obj_type = -obj_type. - -obj_name = -obj_name. + -obj_type = -obj_type. + -obj_name = -obj_name. -sortkey = c_sortkey-default. " Default sort key -changes = 0. - -path = -path. + -path = -path. ENDAT. - IF -filename IS NOT INITIAL. - ls_file-path = -path. - ls_file-filename = -filename. - ls_file-is_changed = boolc( NOT -match = abap_true ). - ls_file-new = -new. + IF -filename IS NOT INITIAL. + ls_file-path = -path. + ls_file-filename = -filename. + ls_file-is_changed = boolc( -match = abap_false OR -new <> space ). + ls_file-new = -new. APPEND ls_file TO -files. IF ls_file-is_changed = abap_true OR ls_file-new IS NOT INITIAL. @@ -269,6 +269,9 @@ CLASS lcl_gui_view_repo_content DEFINITION FINAL INHERITING FROM lcl_gui_page_su get_item_icon IMPORTING is_item TYPE lcl_repo_content_browser=>ty_repo_item RETURNING VALUE(rv_html) TYPE string, + render_state + IMPORTING iv_state TYPE char2 + RETURNING VALUE(rv_html) TYPE string, render_empty_package RETURNING VALUE(rv_html) TYPE string, render_parent_dir @@ -529,8 +532,6 @@ CLASS lcl_gui_view_repo_content IMPLEMENTATION. DATA lt_class TYPE TABLE OF string. - "TODO REFACTOR !!! Depends on if folder woth changes should be highlited - IF is_item-is_dir = abap_true. APPEND 'folder' TO lt_class. ELSEIF is_item-changes > 0. @@ -564,6 +565,31 @@ CLASS lcl_gui_view_repo_content IMPLEMENTATION. ENDMETHOD. "get_item_icon + METHOD render_state. + + rv_html = ''. + + CASE iv_state(1). " Local + WHEN 'C'. "Changed + rv_html = rv_html && ''. + WHEN 'U'. "Unchanged + rv_html = rv_html && ''. + WHEN '_'. "None + rv_html = rv_html && ''. + ENDCASE. + + CASE iv_state+1(1). " Remote + WHEN 'C'. "Changed + rv_html = rv_html && ''. + WHEN 'U'. "Unchanged + rv_html = rv_html && ''. + WHEN '_'. "None + rv_html = rv_html && ''. + ENDCASE. + + rv_html = rv_html && ''. + + ENDMETHOD. "render_state METHOD render_item. DATA: lv_link TYPE string, @@ -576,7 +602,9 @@ CLASS lcl_gui_view_repo_content IMPLEMENTATION. IF is_item-obj_name IS INITIAL AND is_item-is_dir = abap_false. ro_html->add( '' - && 'non-code and meta files' ). + && '' + && 'non-code and meta files' + && '' ). ELSE. ro_html->add( |{ get_item_icon( is_item ) }| ). @@ -631,11 +659,24 @@ CLASS lcl_gui_view_repo_content IMPLEMENTATION. CREATE OBJECT ro_html. - IF is_item-is_dir = abap_true. + IF is_item-is_dir = abap_true. " Directory + ro_html->add( |
{ is_item-changes } changes
| ). - ELSEIF lines( is_item-files ) = 0. - ro_html->add( '
new @local
' ). + + ELSEIF lines( is_item-files ) = 0. " New local object + + lv_difflink = lcl_html_action_utils=>obj_encode( + iv_key = mo_repo->get_key( ) + ig_object = is_item ). + ro_html->add( '
' ). + ro_html->add_anchor( + iv_txt = |diff| + iv_act = |{ gc_action-go_diff }?{ lv_difflink }| ). + ro_html->add( render_state( 'C_' ) ). + ro_html->add( '
' ). + ELSEIF is_item-changes > 0. + IF mv_hide_files = abap_true AND is_item-obj_name IS NOT INITIAL. lv_difflink = lcl_html_action_utils=>obj_encode( iv_key = mo_repo->get_key( ) @@ -653,22 +694,44 @@ CLASS lcl_gui_view_repo_content IMPLEMENTATION. ro_html->add( '' ). ELSE. LOOP AT is_item-files INTO ls_file. - IF ls_file-new = gc_new-remote. - ro_html->add( '
new @remote
' ). - ELSEIF ls_file-new = gc_new-local. - ro_html->add( '
new @local
' ). - ELSEIF ls_file-is_changed = abap_true. + + IF ls_file-is_changed = abap_true. lv_difflink = lcl_html_action_utils=>file_encode( iv_key = mo_repo->get_key( ) ig_file = ls_file ). ro_html->add( '
' ). ro_html->add_anchor( - iv_txt = 'diff' + iv_txt = |diff| iv_act = |{ gc_action-go_diff }?{ lv_difflink }| ). + + CASE ls_file-new. + WHEN gc_new-remote. + ro_html->add( render_state( '_C' ) ). + WHEN gc_new-local. + ro_html->add( render_state( 'C_' ) ). + WHEN OTHERS. + ro_html->add( render_state( 'CC' ) ). + ENDCASE. + ro_html->add( '
' ). ELSE. ro_html->add( |
 
| ). ENDIF. + + +* IF ls_file-new = gc_new-remote. +* ro_html->add( '
new @remote
' ). +* ELSEIF ls_file-new = gc_new-local. +* ro_html->add( '
new @local
' ). +* ELSEIF ls_file-is_changed = abap_true. +* ro_html->add( '
' ). +* ro_html->add_anchor( +* iv_txt = 'diff' +* iv_act = |{ gc_action-go_diff }?{ lv_difflink }| ). +* ro_html->add( '
' ). +* ELSE. +* ro_html->add( |
 
| ). +* ENDIF. ENDLOOP. ENDIF.