Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348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1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | CLASS zcl_abapgit_gui_page_repo_view DEFINITION PUBLIC INHERITING FROM zcl_abapgit_gui_component FINAL CREATE PRIVATE. PUBLIC SECTION. INTERFACES: zif_abapgit_gui_event_handler, zif_abapgit_gui_hotkeys, zif_abapgit_gui_menu_provider, zif_abapgit_gui_renderable. CONSTANTS: BEGIN OF c_actions, change_dir TYPE string VALUE 'change_dir' ##NO_TEXT, toggle_hide_files TYPE string VALUE 'toggle_hide_files' ##NO_TEXT, toggle_folders TYPE string VALUE 'toggle_folders' ##NO_TEXT, toggle_changes TYPE string VALUE 'toggle_changes' ##NO_TEXT, toggle_diff_first TYPE string VALUE 'toggle_diff_first ' ##NO_TEXT, display_more TYPE string VALUE 'display_more' ##NO_TEXT, go_data TYPE string VALUE 'go_data', go_unit TYPE string VALUE 'go_unit', END OF c_actions . CLASS-METHODS create IMPORTING !iv_key TYPE zif_abapgit_persistence=>ty_repo-key RETURNING VALUE(ri_page) TYPE REF TO zif_abapgit_gui_renderable RAISING zcx_abapgit_exception. METHODS constructor IMPORTING !iv_key TYPE zif_abapgit_persistence=>ty_repo-key RAISING zcx_abapgit_exception . PROTECTED SECTION. PRIVATE SECTION. DATA mo_repo TYPE REF TO zcl_abapgit_repo . DATA mo_repo_aggregated_state TYPE REF TO zcl_abapgit_repo_item_state. DATA mv_connection_error TYPE abap_bool. DATA mv_cur_dir TYPE string . DATA mv_hide_files TYPE abap_bool . DATA mv_max_lines TYPE i . DATA mv_max_setting TYPE i . DATA mv_show_folders TYPE abap_bool . DATA mv_changes_only TYPE abap_bool . DATA mv_order_by TYPE string . DATA mv_order_descending TYPE abap_bool . DATA mv_diff_first TYPE abap_bool . DATA mv_key TYPE zif_abapgit_persistence=>ty_value . DATA mv_are_changes_recorded_in_tr TYPE abap_bool . METHODS render_head_line RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS build_view_dropdown RETURNING VALUE(ro_toolbar) TYPE REF TO zcl_abapgit_html_toolbar RAISING zcx_abapgit_exception . METHODS render_item IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_repo_item !iv_render_transports TYPE abap_bool RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS render_item_files IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_repo_item RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . METHODS render_item_command IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_repo_item RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . METHODS render_file_command IMPORTING !is_file TYPE zif_abapgit_definitions=>ty_repo_file RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . METHODS get_item_class IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_repo_item iv_is_object_row TYPE abap_bool DEFAULT abap_false RETURNING VALUE(rv_html) TYPE string . METHODS render_item_transport IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_repo_item RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS render_parent_dir RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS build_dir_jump_link IMPORTING !iv_path TYPE string RETURNING VALUE(rv_html) TYPE string . METHODS build_inactive_object_code IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_repo_item RETURNING VALUE(rv_inactive_html_code) TYPE string . METHODS build_srcsystem_code IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_repo_item RETURNING VALUE(rv_srcsystem_html_code) TYPE string . METHODS build_origlang_code IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_repo_item RETURNING VALUE(rv_html_code) TYPE string . METHODS open_in_main_language RAISING zcx_abapgit_exception . METHODS render_table_header RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . METHODS render_table_footer RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . METHODS apply_order_by CHANGING !ct_repo_items TYPE zif_abapgit_definitions=>ty_repo_item_tt . METHODS build_branch_dropdown RETURNING VALUE(ro_branch_dropdown) TYPE REF TO zcl_abapgit_html_toolbar RAISING zcx_abapgit_exception . METHODS build_tag_dropdown RETURNING VALUE(ro_tag_dropdown) TYPE REF TO zcl_abapgit_html_toolbar RAISING zcx_abapgit_exception . METHODS build_advanced_dropdown RETURNING VALUE(ro_advanced_dropdown) TYPE REF TO zcl_abapgit_html_toolbar RAISING zcx_abapgit_exception . METHODS build_main_toolbar RETURNING VALUE(ro_toolbar) TYPE REF TO zcl_abapgit_html_toolbar RAISING zcx_abapgit_exception . METHODS render_scripts RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS is_repo_lang_logon_lang RETURNING VALUE(rv_repo_lang_is_logon_lang) TYPE abap_bool . METHODS render_item_changed_by IMPORTING !is_item TYPE zif_abapgit_definitions=>ty_repo_item RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception. METHODS order_files CHANGING ct_files TYPE zif_abapgit_definitions=>ty_repo_file_tt. METHODS get_crossout IMPORTING !iv_authorization TYPE zif_abapgit_auth=>ty_authorization OPTIONAL !iv_protected TYPE abap_bool DEFAULT abap_false !iv_strong TYPE abap_bool DEFAULT abap_false PREFERRED PARAMETER iv_authorization RETURNING VALUE(rv_crossout) LIKE zif_abapgit_html=>c_html_opt-crossout. METHODS check_branch RAISING zcx_abapgit_exception. METHODS check_connection RAISING zcx_abapgit_exception. ENDCLASS. CLASS ZCL_ABAPGIT_GUI_PAGE_REPO_VIEW IMPLEMENTATION. METHOD apply_order_by. DATA: lt_sort TYPE abap_sortorder_tab, ls_sort LIKE LINE OF lt_sort, lt_non_code_and_metadata_items LIKE ct_repo_items, lt_code_items LIKE ct_repo_items, lt_diff_items LIKE ct_repo_items. FIELD-SYMBOLS: <ls_repo_item> TYPE zif_abapgit_definitions=>ty_repo_item. IF mv_order_by IS INITIAL. RETURN. ENDIF. " we want to preserve non-code and metadata files at the top, " so we isolate them and sort only the code artifacts LOOP AT ct_repo_items ASSIGNING <ls_repo_item>. IF <ls_repo_item>-obj_type IS INITIAL AND <ls_repo_item>-is_dir = abap_false. INSERT <ls_repo_item> INTO TABLE lt_non_code_and_metadata_items. ELSE. INSERT <ls_repo_item> INTO TABLE lt_code_items. ENDIF. ENDLOOP. IF mv_diff_first = abap_true. " fix diffs on the top, right after non-code and metadata LOOP AT lt_code_items ASSIGNING <ls_repo_item> WHERE changes > 0. INSERT <ls_repo_item> INTO TABLE lt_diff_items. ENDLOOP. DELETE lt_code_items WHERE changes > 0. ENDIF. CLEAR: ct_repo_items. ls_sort-descending = mv_order_descending. ls_sort-astext = abap_true. ls_sort-name = mv_order_by. INSERT ls_sort INTO TABLE lt_sort. " Combine state fields for order of 'Status' column IF mv_order_by = 'LSTATE'. ls_sort-name = 'RSTATE'. INSERT ls_sort INTO TABLE lt_sort. ENDIF. " Use object name as secondary sort criteria IF mv_order_by <> 'OBJ_NAME'. ls_sort-name = 'OBJ_NAME'. INSERT ls_sort INTO TABLE lt_sort. ENDIF. SORT lt_code_items STABLE BY (lt_sort). SORT lt_diff_items STABLE BY (lt_sort). INSERT LINES OF lt_non_code_and_metadata_items INTO TABLE ct_repo_items. INSERT LINES OF lt_diff_items INTO TABLE ct_repo_items. INSERT LINES OF lt_code_items INTO TABLE ct_repo_items. " Files are listed under the object names so we always sort them by name LOOP AT ct_repo_items ASSIGNING <ls_repo_item>. order_files( CHANGING ct_files = <ls_repo_item>-files ). ENDLOOP. ENDMETHOD. METHOD build_advanced_dropdown. CREATE OBJECT ro_advanced_dropdown. ro_advanced_dropdown->add( iv_txt = 'Activate Objects' iv_act = |{ zif_abapgit_definitions=>c_action-repo_activate_objects }?key={ mv_key }| ). IF mo_repo->is_offline( ) = abap_false. " Online ? ro_advanced_dropdown->add( iv_txt = 'Transport to Branch' iv_act = |{ zif_abapgit_definitions=>c_action-repo_transport_to_branch }?key={ mv_key }| iv_opt = get_crossout( zif_abapgit_auth=>c_authorization-transport_to_branch ) ). ENDIF. IF mv_are_changes_recorded_in_tr = abap_true. ro_advanced_dropdown->add( iv_txt = 'Add All Objects to Transport' iv_act = |{ zif_abapgit_definitions=>c_action-repo_add_all_obj_to_trans_req }?key={ mv_key }| ). ENDIF. IF mo_repo->is_offline( ) = abap_true. ro_advanced_dropdown->add( iv_txt = 'Export by Transport' iv_act = |{ zif_abapgit_definitions=>c_action-zip_export_transport }?key={ mv_key }| ). ELSE. ro_advanced_dropdown->add( iv_txt = 'Stage by Transport' iv_act = |{ zif_abapgit_definitions=>c_action-go_stage_transport }?key={ mv_key }| ). ENDIF. ro_advanced_dropdown->add( iv_txt = 'Quality Assurance' iv_typ = zif_abapgit_html=>c_action_type-separator ). ro_advanced_dropdown->add( iv_txt = 'Syntax Check' iv_act = |{ zif_abapgit_definitions=>c_action-repo_syntax_check }?key={ mv_key }| ). ro_advanced_dropdown->add( iv_txt = 'Unit Test' iv_act = |{ c_actions-go_unit }| ). ro_advanced_dropdown->add( iv_txt = 'Run Code Inspector' iv_act = |{ zif_abapgit_definitions=>c_action-repo_code_inspector }?key={ mv_key }| ). ro_advanced_dropdown->add( iv_txt = 'Where Used' iv_act = |{ zif_abapgit_definitions=>c_action-where_used }?key={ mv_key }| ). ro_advanced_dropdown->add( iv_txt = 'Very Advanced' iv_typ = zif_abapgit_html=>c_action_type-separator ). ro_advanced_dropdown->add( iv_txt = 'Update Local Checksums' iv_act = |{ zif_abapgit_definitions=>c_action-repo_refresh_checksums }?key={ mv_key }| iv_opt = get_crossout( zif_abapgit_auth=>c_authorization-update_local_checksum ) ). ro_advanced_dropdown->add( iv_txt = 'Data Config' iv_act = |{ c_actions-go_data }?key={ mv_key }| ). IF is_repo_lang_logon_lang( ) = abap_false AND zcl_abapgit_services_abapgit=>get_abapgit_tcode( ) IS NOT INITIAL. ro_advanced_dropdown->add( iv_txt = 'Open in Main Language' iv_act = |{ zif_abapgit_definitions=>c_action-repo_open_in_master_lang }?key={ mv_key }| ). ENDIF. ro_advanced_dropdown->add( iv_txt = 'Danger' iv_typ = zif_abapgit_html=>c_action_type-separator ). ro_advanced_dropdown->add( iv_txt = 'Remove Repository' iv_title = `Remove abapGit's records of the repository (the system's ` && `development objects will remain unaffected)` iv_act = |{ zif_abapgit_definitions=>c_action-repo_remove }?key={ mv_key }| ). ro_advanced_dropdown->add( iv_txt = 'Remove Objects' iv_title = `Delete all development objects belonging to this package ` && `(and subpackages) from the system, but keep repository in abapGit` iv_act = |{ zif_abapgit_definitions=>c_action-repo_delete_objects }?key={ mv_key }| ). ro_advanced_dropdown->add( iv_txt = 'Uninstall' iv_title = `Delete all development objects belonging to this package ` && `(and subpackages) from the system, and remove the repository from abapGit` iv_act = |{ zif_abapgit_definitions=>c_action-repo_purge }?key={ mv_key }| iv_opt = get_crossout( iv_authorization = zif_abapgit_auth=>c_authorization-uninstall iv_protected = abap_true ) ). ENDMETHOD. METHOD build_branch_dropdown. CREATE OBJECT ro_branch_dropdown. IF mo_repo->is_offline( ) = abap_true. RETURN. ENDIF. ro_branch_dropdown->add( iv_txt = 'Switch' iv_act = |{ zif_abapgit_definitions=>c_action-git_branch_switch }?key={ mv_key }| ). ro_branch_dropdown->add( iv_txt = 'Create' iv_act = |{ zif_abapgit_definitions=>c_action-git_branch_create }?key={ mv_key }| ). ro_branch_dropdown->add( iv_txt = 'Delete' iv_act = |{ zif_abapgit_definitions=>c_action-git_branch_delete }?key={ mv_key }| ). ro_branch_dropdown->add( iv_txt = 'Merge' iv_act = |{ zif_abapgit_definitions=>c_action-git_branch_merge }?key={ mv_key }| ). ENDMETHOD. METHOD build_dir_jump_link. DATA lv_path TYPE string. DATA lv_encode TYPE string. DATA li_html TYPE REF TO zif_abapgit_html. CREATE OBJECT li_html TYPE zcl_abapgit_html. lv_path = iv_path. REPLACE FIRST OCCURRENCE OF mv_cur_dir IN lv_path WITH ''. lv_encode = zcl_abapgit_html_action_utils=>dir_encode( lv_path ). " remove leading and trailing / for display IF lv_path <> '/'. IF lv_path(1) = '/'. lv_path = lv_path+1. ENDIF. IF substring( val = reverse( lv_path ) len = 1 ) = '/'. lv_path = substring( val = lv_path len = strlen( lv_path ) - 1 ). ENDIF. ENDIF. rv_html = li_html->a( iv_txt = lv_path iv_act = |{ c_actions-change_dir }?{ lv_encode }| ). ENDMETHOD. METHOD build_inactive_object_code. IF is_item-inactive = abap_true. rv_inactive_html_code = zcl_abapgit_html=>icon( iv_name = 'bolt/orange' iv_hint = 'Object or object part is inactive' iv_class = 'inactive' ). ENDIF. ENDMETHOD. METHOD build_main_toolbar. DATA: li_log TYPE REF TO zif_abapgit_log. CREATE OBJECT ro_toolbar EXPORTING iv_id = 'toolbar-repo'. IF mo_repo->is_offline( ) = abap_false. " online repo IF mo_repo_aggregated_state->is_unchanged( ) = abap_false. " Any changes ro_toolbar->add( iv_txt = 'Pull' iv_act = |{ zif_abapgit_definitions=>c_action-git_pull }?key={ mv_key }| iv_opt = get_crossout( iv_protected = abap_true iv_strong = abap_true ) ). ro_toolbar->add( iv_txt = 'Stage' iv_act = |{ zif_abapgit_definitions=>c_action-go_stage }?key={ mv_key }| iv_opt = zif_abapgit_html=>c_html_opt-strong ). ro_toolbar->add( iv_txt = 'Patch' iv_act = |{ zif_abapgit_definitions=>c_action-go_patch }?key={ mv_key }| iv_opt = zif_abapgit_html=>c_html_opt-strong ). ro_toolbar->add( iv_txt = 'Diff' iv_act = |{ zif_abapgit_definitions=>c_action-go_repo_diff }?key={ mv_key }| iv_opt = zif_abapgit_html=>c_html_opt-strong ). ENDIF. li_log = mo_repo->get_log( ). IF li_log IS BOUND AND li_log->count( ) > 0. ro_toolbar->add( iv_txt = 'Log' iv_act = |{ zif_abapgit_definitions=>c_action-repo_log }?key={ mv_key }| ). ENDIF. ro_toolbar->add( iv_txt = 'Branch' io_sub = build_branch_dropdown( ) ). ro_toolbar->add( iv_txt = 'Tag' io_sub = build_tag_dropdown( ) ). ELSE. " offline repo IF mo_repo->has_remote_source( ) = abap_true AND mo_repo_aggregated_state->is_unchanged( ) = abap_false. ro_toolbar->add( iv_txt = 'Pull <sup>zip</sup>' iv_act = |{ zif_abapgit_definitions=>c_action-git_pull }?key={ mv_key }| iv_opt = zif_abapgit_html=>c_html_opt-strong ). ro_toolbar->add( iv_txt = 'Diff' iv_act = |{ zif_abapgit_definitions=>c_action-go_repo_diff }?key={ mv_key }| iv_opt = zif_abapgit_html=>c_html_opt-strong ). ENDIF. ro_toolbar->add( iv_txt = 'Import <sup>zip</sup>' iv_act = |{ zif_abapgit_definitions=>c_action-zip_import }?key={ mv_key }| iv_opt = zif_abapgit_html=>c_html_opt-strong ). IF mo_repo->get_local_settings( )-write_protected = abap_true. ro_toolbar->add( iv_txt = 'Compare <sup>rfc</sup>' iv_act = |{ zif_abapgit_definitions=>c_action-rfc_compare }?key={ mv_key }| iv_opt = zif_abapgit_html=>c_html_opt-strong ). ENDIF. ro_toolbar->add( iv_txt = 'Export <sup>zip</sup>' iv_act = |{ zif_abapgit_definitions=>c_action-zip_export }?key={ mv_key }| iv_opt = zif_abapgit_html=>c_html_opt-strong ). li_log = mo_repo->get_log( ). IF li_log IS BOUND AND li_log->count( ) > 0. ro_toolbar->add( iv_txt = 'Log' iv_act = |{ zif_abapgit_definitions=>c_action-repo_log }?key={ mv_key }| ). ENDIF. ENDIF. ro_toolbar->add( iv_txt = 'Advanced' io_sub = build_advanced_dropdown( ) ). ro_toolbar->add( iv_txt = 'View' io_sub = build_view_dropdown( ) ). ro_toolbar->add( iv_txt = 'Refresh' iv_act = |{ zif_abapgit_definitions=>c_action-repo_refresh }?key={ mv_key }| iv_opt = zif_abapgit_html=>c_html_opt-strong ). ro_toolbar->add( iv_txt = 'Repo Settings' iv_act = |{ zif_abapgit_definitions=>c_action-repo_settings }?key={ mv_key }| iv_opt = zif_abapgit_html=>c_html_opt-strong iv_title = `Repository Settings` ). ENDMETHOD. METHOD build_origlang_code. IF is_item-origlang IS NOT INITIAL AND is_item-origlang <> mo_repo->get_dot_abapgit( )->get_main_language( ). rv_html_code = zcl_abapgit_html=>icon( iv_name = 'language-solid/grey' iv_hint = |Original language: { is_item-origlang }| iv_class = 'cursor-pointer' ). ENDIF. ENDMETHOD. METHOD build_srcsystem_code. IF is_item-srcsystem IS NOT INITIAL AND is_item-srcsystem <> sy-sysid. rv_srcsystem_html_code = zcl_abapgit_html=>icon( iv_name = 'server-solid/grey' iv_hint = |Original system: { is_item-srcsystem }| iv_class = 'cursor-pointer' ). ENDIF. ENDMETHOD. METHOD build_tag_dropdown. CREATE OBJECT ro_tag_dropdown. IF mo_repo->is_offline( ) = abap_true. RETURN. ENDIF. ro_tag_dropdown->add( iv_txt = 'Switch' iv_act = |{ zif_abapgit_definitions=>c_action-git_tag_switch }?key={ mv_key }| ). ro_tag_dropdown->add( iv_txt = 'Create' iv_act = |{ zif_abapgit_definitions=>c_action-git_tag_create }?key={ mv_key }| ). ro_tag_dropdown->add( iv_txt = 'Delete' iv_act = |{ zif_abapgit_definitions=>c_action-git_tag_delete }?key={ mv_key }| ). ENDMETHOD. METHOD build_view_dropdown. CREATE OBJECT ro_toolbar. ro_toolbar->add( iv_txt = 'Changes First' iv_chk = mv_diff_first iv_act = c_actions-toggle_diff_first ). ro_toolbar->add( iv_txt = 'Changes Only' iv_chk = mv_changes_only iv_act = c_actions-toggle_changes ). ro_toolbar->add( iv_txt = 'File Paths' iv_chk = boolc( NOT mv_hide_files = abap_true ) iv_act = c_actions-toggle_hide_files ). ro_toolbar->add( iv_txt = 'Folders' iv_chk = mv_show_folders iv_act = c_actions-toggle_folders ). ENDMETHOD. METHOD check_branch. DATA lo_repo TYPE REF TO zif_abapgit_repo_online. IF mo_repo->is_offline( ) = abap_false. lo_repo ?= mo_repo. lo_repo->check_for_valid_branch( ). ENDIF. ENDMETHOD. METHOD check_connection. DATA lo_repo TYPE REF TO zif_abapgit_repo_online. mv_connection_error = abap_true. IF mo_repo->is_offline( ) = abap_false. lo_repo ?= mo_repo. zcl_abapgit_http=>check_connection( lo_repo->get_url( ) ). ENDIF. mv_connection_error = abap_false. ENDMETHOD. METHOD constructor. DATA: lo_settings TYPE REF TO zcl_abapgit_settings, lx_error TYPE REF TO zcx_abapgit_exception, lo_persistence_user TYPE REF TO zif_abapgit_persist_user. super->constructor( ). TRY. lo_persistence_user = zcl_abapgit_persistence_user=>get_instance( ). mv_key = iv_key. mo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ). mv_cur_dir = '/'. " Root mv_hide_files = lo_persistence_user->get_hide_files( ). mv_changes_only = lo_persistence_user->get_changes_only( ). mv_order_by = lo_persistence_user->get_order_by( ). mv_order_descending = lo_persistence_user->get_order_descending( ). mv_diff_first = lo_persistence_user->get_diff_first( ). mv_show_folders = lo_persistence_user->get_show_folders( ). " Read global settings to get max # of objects to be listed lo_settings = zcl_abapgit_persist_factory=>get_settings( )->read( ). mv_max_lines = lo_settings->get_max_lines( ). mv_max_setting = mv_max_lines. CATCH zcx_abapgit_exception INTO lx_error. " Reset 'last shown repo' so next start will go to repo overview " and allow troubleshooting of issue zcl_abapgit_persistence_user=>get_instance( )->set_repo_show( || ). RAISE EXCEPTION lx_error. ENDTRY. ENDMETHOD. METHOD create. DATA lo_component TYPE REF TO zcl_abapgit_gui_page_repo_view. CREATE OBJECT lo_component EXPORTING iv_key = iv_key. ri_page = zcl_abapgit_gui_page_hoc=>create( iv_page_title = 'Repository' ii_page_menu_provider = lo_component ii_child_component = lo_component ). ENDMETHOD. METHOD get_crossout. IF iv_strong = abap_true. rv_crossout = zif_abapgit_html=>c_html_opt-strong. ENDIF. IF iv_protected = abap_true AND mo_repo->get_local_settings( )-write_protected = abap_true. rv_crossout = zif_abapgit_html=>c_html_opt-crossout. ENDIF. IF iv_authorization IS NOT INITIAL AND zcl_abapgit_auth=>is_allowed( iv_authorization ) = abap_false. rv_crossout = zif_abapgit_html=>c_html_opt-crossout. ENDIF. ENDMETHOD. METHOD get_item_class. DATA lt_class TYPE TABLE OF string. IF iv_is_object_row = abap_true. APPEND 'object_row' TO lt_class. ELSE. APPEND 'file_row' TO lt_class. ENDIF. IF is_item-is_dir = abap_true. APPEND 'folder' TO lt_class. ELSEIF is_item-changes > 0. APPEND 'modified' TO lt_class. ELSEIF is_item-obj_name IS INITIAL. APPEND 'unsupported' TO lt_class. ENDIF. IF lines( lt_class ) > 0. rv_html = | class="{ concat_lines_of( table = lt_class sep = ` ` ) }"|. ENDIF. ENDMETHOD. METHOD is_repo_lang_logon_lang. rv_repo_lang_is_logon_lang = boolc( mo_repo->get_dot_abapgit( )->get_main_language( ) = sy-langu ). ENDMETHOD. METHOD open_in_main_language. DATA: lv_main_language TYPE spras, ls_item TYPE zif_abapgit_definitions=>ty_item, lv_tcode TYPE tcode. lv_main_language = mo_repo->get_dot_abapgit( )->get_main_language( ). lv_tcode = zcl_abapgit_services_abapgit=>get_abapgit_tcode( ). ASSERT lv_tcode IS NOT INITIAL. IF lv_main_language = sy-langu. zcx_abapgit_exception=>raise( |Repo already opened in main language| ). ENDIF. ls_item-obj_name = lv_tcode. ls_item-obj_type = |TRAN|. IF zcl_abapgit_objects=>exists( ls_item ) = abap_false. zcx_abapgit_exception=>raise( |Please install the abapGit repository| ). ENDIF. zcl_abapgit_objects_factory=>get_gui_jumper( )->jump_abapgit( iv_language = lv_main_language iv_key = mo_repo->get_key( ) ). ENDMETHOD. METHOD order_files. DATA: lt_sort TYPE abap_sortorder_tab, ls_sort LIKE LINE OF lt_sort. IF lines( ct_files ) = 0. RETURN. ENDIF. ls_sort-descending = mv_order_descending. ls_sort-astext = abap_true. ls_sort-name = 'PATH'. INSERT ls_sort INTO TABLE lt_sort. ls_sort-descending = mv_order_descending. ls_sort-astext = abap_true. ls_sort-name = 'FILENAME'. INSERT ls_sort INTO TABLE lt_sort. SORT ct_files STABLE BY (lt_sort). ENDMETHOD. METHOD render_file_command. DATA: lv_difflink TYPE string. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<div>' ). IF is_file-is_changed = abap_true. lv_difflink = zcl_abapgit_html_action_utils=>file_encode( iv_key = mo_repo->get_key( ) ig_file = is_file ). ri_html->add_a( iv_txt = 'diff' iv_act = |{ zif_abapgit_definitions=>c_action-go_file_diff }?{ lv_difflink }| ). ri_html->add( zcl_abapgit_gui_chunk_lib=>render_item_state( iv_lstate = is_file-lstate iv_rstate = is_file-rstate ) ). ELSE. ri_html->add( ' ' ). ENDIF. ri_html->add( '</div>' ). ENDMETHOD. METHOD render_head_line. DATA: lo_toolbar TYPE REF TO zcl_abapgit_html_toolbar, ls_settings TYPE zif_abapgit_definitions=>ty_s_user_settings, lo_label_colors TYPE REF TO zcl_abapgit_string_map, lt_labels TYPE string_table. CREATE OBJECT ri_html TYPE zcl_abapgit_html. lo_toolbar = build_main_toolbar( ). ri_html->add( '<div class="paddings">' ). ri_html->add( '<table class="w100"><tr>' ). IF mv_show_folders = abap_true. ri_html->add( '<td class="current_dir">' ). ri_html->add( zcl_abapgit_gui_chunk_lib=>render_path( mv_cur_dir ) ). ri_html->add( '</td>' ). ENDIF. lt_labels = zcl_abapgit_repo_labels=>split( mo_repo->ms_data-local_settings-labels ). IF lines( lt_labels ) > 0. ls_settings = zcl_abapgit_persist_factory=>get_settings( )->read( )->get_user_settings( ). lo_label_colors = zcl_abapgit_repo_labels=>split_colors_into_map( ls_settings-label_colors ). ri_html->td( iv_content = zcl_abapgit_gui_chunk_lib=>render_label_list( it_labels = lt_labels io_label_colors = lo_label_colors ) iv_class = 'labels' ). ENDIF. ri_html->add( '<td class="right">' ). ri_html->add( lo_toolbar->render( iv_right = abap_true ) ). ri_html->add( '</td>' ). ri_html->add( '</tr></table>' ). ri_html->add( '</div>' ). ENDMETHOD. METHOD render_item. DATA: lv_link TYPE string. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( |<tr{ get_item_class( is_item = is_item iv_is_object_row = abap_true ) }>| ). IF is_item-obj_name IS INITIAL AND is_item-is_dir = abap_false. ri_html->add( |<td colspan="2"></td>| && '<td class="object">' && '<i class="grey">non-code and meta files</i>' && '</td>' ). ELSE. ri_html->add( |<td class="icon">{ zcl_abapgit_gui_chunk_lib=>get_item_icon( is_item ) }</td>| ). IF is_item-is_dir = abap_true. " Subdir lv_link = build_dir_jump_link( is_item-path ). ri_html->add( |<td class="dir" colspan="2">{ lv_link }</td>| ). ELSE. lv_link = zcl_abapgit_gui_chunk_lib=>get_item_link( is_item ). ri_html->add( |<td class="type">{ is_item-obj_type }</td>| ). ri_html->add( |<td class="object">{ lv_link } { build_inactive_object_code( is_item ) } { build_srcsystem_code( is_item ) } { build_origlang_code( is_item ) }</td>| ). ENDIF. ENDIF. " Changed by ri_html->add( '<td class="user">' ). ri_html->add( render_item_changed_by( is_item ) ). ri_html->add( '</td>' ). IF iv_render_transports = abap_true. ri_html->add( render_item_transport( is_item ) ). ENDIF. " Command ri_html->add( '<td class="cmd">' ). IF mo_repo->has_remote_source( ) = abap_true. ri_html->add( render_item_command( is_item ) ). ENDIF. ri_html->add( '</td>' ). ri_html->add( '</tr>' ). ri_html->add( render_item_files( is_item ) ). ENDMETHOD. METHOD render_item_changed_by. CREATE OBJECT ri_html TYPE zcl_abapgit_html. IF is_item-changes = 0 OR is_item-changed_by IS INITIAL. ri_html->add( ' ' ). ELSE. ri_html->add( zcl_abapgit_gui_chunk_lib=>render_user_name( is_item-changed_by ) ). ENDIF. ENDMETHOD. METHOD render_item_command. DATA lv_difflink TYPE string. CREATE OBJECT ri_html TYPE zcl_abapgit_html. IF is_item-is_dir = abap_true. " Directory ri_html->add( '<div>' ). ri_html->add( |<span class="grey">{ is_item-changes } changes</span>| ). ri_html->add( zcl_abapgit_gui_chunk_lib=>render_item_state( iv_lstate = is_item-lstate iv_rstate = is_item-rstate ) ). ri_html->add( '</div>' ). ELSEIF is_item-changes > 0. IF mv_hide_files = abap_true AND is_item-obj_name IS NOT INITIAL. lv_difflink = zcl_abapgit_html_action_utils=>obj_encode( iv_key = mo_repo->get_key( ) ig_object = is_item ). ri_html->add( '<div>' ). ri_html->add_a( iv_txt = |diff ({ is_item-changes })| iv_act = |{ zif_abapgit_definitions=>c_action-go_file_diff }?{ lv_difflink }| ). ri_html->add( zcl_abapgit_gui_chunk_lib=>render_item_state( iv_lstate = is_item-lstate iv_rstate = is_item-rstate ) ). ri_html->add( '</div>' ). ENDIF. ENDIF. ENDMETHOD. METHOD render_item_files. DATA: ls_file LIKE LINE OF is_item-files. DATA li_exit TYPE REF TO zif_abapgit_exit. DATA lv_filename TYPE string. CREATE OBJECT ri_html TYPE zcl_abapgit_html. IF mv_hide_files = abap_true AND is_item-obj_type IS NOT INITIAL. RETURN. ENDIF. li_exit = zcl_abapgit_exit=>get_instance( ). LOOP AT is_item-files INTO ls_file. ri_html->add( |<tr{ get_item_class( is_item ) }>| ). ri_html->add( |<td class="icon"></td>| ). ri_html->add( |<td class="type"></td>| ). ri_html->add( |<td class="filename darkgrey">| ). IF mv_show_folders = abap_true. lv_filename = ls_file-filename. ELSE. lv_filename = ls_file-path && ls_file-filename. ENDIF. lv_filename = li_exit->adjust_display_filename( is_repo_meta = mo_repo->ms_data iv_filename = lv_filename ). ri_html->add( |<div>{ lv_filename }</div>| ). ri_html->add( |</td>| ). " Changed by (not applicable to file) ri_html->add( '<td class="user">' ). ri_html->add( '</td>' ). " Transport (not applicable to file) IF mv_are_changes_recorded_in_tr = abap_true. ri_html->add( `<td></td>` ). ENDIF. " Command ri_html->add( '<td class="cmd">' ). IF mo_repo->has_remote_source( ) = abap_true. ri_html->add( render_file_command( ls_file ) ). ENDIF. ri_html->add( '</td>' ). ri_html->add( '</tr>' ). ENDLOOP. ENDMETHOD. METHOD render_item_transport. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<td class="transport">' ). ri_html->add( zcl_abapgit_gui_chunk_lib=>render_transport( is_item-transport ) ). ri_html->add( '</td>' ). ENDMETHOD. METHOD render_parent_dir. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<tr class="folder">' ). ri_html->add( |<td class="icon">{ ri_html->icon( 'folder' ) }</td>| ). ri_html->add( |<td class="dir" colspan="4">{ build_dir_jump_link( '..' ) }</td>| ). IF mo_repo->has_remote_source( ) = abap_true. ri_html->add( |<td colspan="1"></td>| ). " Dummy for online ENDIF. ri_html->add( '</tr>' ). ENDMETHOD. METHOD render_scripts. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->set_title( cl_abap_typedescr=>describe_by_object_ref( me )->get_relative_name( ) ). ri_html->add( zcl_abapgit_gui_chunk_lib=>render_repo_palette( iv_action = zif_abapgit_definitions=>c_action-go_repo ) ). ENDMETHOD. METHOD render_table_footer. DATA lv_action TYPE string. CREATE OBJECT ri_html TYPE zcl_abapgit_html. IF mv_changes_only = abap_true. lv_action = ri_html->a( iv_txt = 'Show All' iv_act = c_actions-toggle_changes ). ri_html->add( zcl_abapgit_gui_chunk_lib=>render_table_footer( |(Only changes are shown. { lv_action })| ) ). ENDIF. ENDMETHOD. METHOD render_table_header. DATA: lt_col_spec TYPE zif_abapgit_definitions=>ty_col_spec_tt, ls_col_spec TYPE zif_abapgit_definitions=>ty_col_spec. CREATE OBJECT ri_html TYPE zcl_abapgit_html. " icon APPEND INITIAL LINE TO lt_col_spec. ls_col_spec-tech_name = 'OBJ_TYPE'. ls_col_spec-display_name = 'Type'. ls_col_spec-allow_order_by = abap_true. APPEND ls_col_spec TO lt_col_spec. ls_col_spec-tech_name = 'OBJ_NAME'. ls_col_spec-display_name = 'Name'. ls_col_spec-allow_order_by = abap_true. APPEND ls_col_spec TO lt_col_spec. ls_col_spec-tech_name = 'CHANGED_BY'. ls_col_spec-display_name = 'Changed by'. ls_col_spec-allow_order_by = abap_true. APPEND ls_col_spec TO lt_col_spec. IF mv_are_changes_recorded_in_tr = abap_true. ls_col_spec-tech_name = 'TRANSPORT'. ls_col_spec-display_name = 'Transport'. ls_col_spec-allow_order_by = abap_true. APPEND ls_col_spec TO lt_col_spec. ENDIF. ls_col_spec-tech_name = 'LSTATE'. ls_col_spec-display_name = 'Status'. ls_col_spec-allow_order_by = abap_true. ls_col_spec-css_class = 'cmd'. APPEND ls_col_spec TO lt_col_spec. ri_html->add( zcl_abapgit_gui_chunk_lib=>render_table_header( it_col_spec = lt_col_spec iv_order_by = mv_order_by iv_order_descending = mv_order_descending ) ). ENDMETHOD. METHOD zif_abapgit_gui_event_handler~on_event. DATA lv_path TYPE string. DATA lv_key TYPE zif_abapgit_persistence=>ty_value. lv_key = ii_event->query( )->get( 'KEY' ). CASE ii_event->mv_action. WHEN zif_abapgit_definitions=>c_action-go_repo. " Switch to another repo rs_handled-page = create( lv_key ). rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page_replacing. WHEN c_actions-go_data. rs_handled-page = zcl_abapgit_gui_page_data=>create( lv_key ). rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page. WHEN c_actions-go_unit. rs_handled-page = zcl_abapgit_gui_page_runit=>create( mo_repo ). rs_handled-state = zcl_abapgit_gui=>c_event_state-new_page. WHEN c_actions-toggle_hide_files. " Toggle file display mv_hide_files = zcl_abapgit_persistence_user=>get_instance( )->toggle_hide_files( ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN c_actions-change_dir. " Change dir lv_path = ii_event->query( )->get( 'PATH' ). mv_cur_dir = zcl_abapgit_path=>change_dir( iv_cur_dir = mv_cur_dir iv_cd = lv_path ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN c_actions-toggle_folders. " Toggle folder view mv_show_folders = zcl_abapgit_persistence_user=>get_instance( )->toggle_show_folders( ). mv_cur_dir = '/'. " Root rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN c_actions-toggle_changes. " Toggle changes only view mv_changes_only = zcl_abapgit_persistence_user=>get_instance( )->toggle_changes_only( ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN c_actions-toggle_diff_first. mv_diff_first = zcl_abapgit_persistence_user=>get_instance( )->set_diff_first( boolc( mv_diff_first = abap_false ) ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN c_actions-display_more. " Increase MAX lines limit mv_max_lines = mv_max_lines + mv_max_setting. rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN zif_abapgit_definitions=>c_action-change_order_by. mv_order_by = zcl_abapgit_persistence_user=>get_instance( )->set_order_by( ii_event->query( )->get( 'ORDERBY' ) ). mv_order_descending = zcl_abapgit_persistence_user=>get_instance( )->set_order_descending( abap_false ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN zif_abapgit_definitions=>c_action-direction. mv_order_descending = zcl_abapgit_persistence_user=>get_instance( )->set_order_descending( boolc( ii_event->query( )->get( 'DIRECTION' ) = 'DESCENDING' ) ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. WHEN zif_abapgit_definitions=>c_action-repo_open_in_master_lang. open_in_main_language( ). rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render. ENDCASE. ENDMETHOD. METHOD zif_abapgit_gui_hotkeys~get_hotkey_actions. DATA: ls_hotkey_action LIKE LINE OF rt_hotkey_actions. ls_hotkey_action-ui_component = 'Repo'. ls_hotkey_action-description = |Stage|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-go_stage. ls_hotkey_action-hotkey = |s|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-description = |Switch Branch|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-git_branch_switch. ls_hotkey_action-hotkey = |b|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-description = |Repository List|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-abapgit_home. ls_hotkey_action-hotkey = |o|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-description = |Refresh Repository|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-repo_refresh. ls_hotkey_action-hotkey = |r|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-description = |Pull|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-git_pull. ls_hotkey_action-hotkey = |p|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-description = |Patch|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-go_patch. ls_hotkey_action-hotkey = |a|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-description = |Diff|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-go_repo_diff. ls_hotkey_action-hotkey = |d|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-description = |Uninstall Repository|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-repo_purge. ls_hotkey_action-hotkey = |u|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-description = |Run Syntax Check|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-repo_syntax_check. ls_hotkey_action-hotkey = |c|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-description = |Run Unit Tests|. ls_hotkey_action-action = c_actions-go_unit. ls_hotkey_action-hotkey = |t|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-description = |Run Code Inspector|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-repo_code_inspector. ls_hotkey_action-hotkey = |i|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. ls_hotkey_action-description = |Show Log|. ls_hotkey_action-action = zif_abapgit_definitions=>c_action-repo_log. ls_hotkey_action-hotkey = |l|. 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'. ro_toolbar->add( iv_txt = zcl_abapgit_gui_buttons=>repo_list( ) iv_act = zif_abapgit_definitions=>c_action-abapgit_home )->add( iv_txt = zcl_abapgit_gui_buttons=>help( ) io_sub = zcl_abapgit_gui_menus=>help( ) ). zcl_abapgit_gui_menus=>experimental( ro_toolbar ). ENDMETHOD. METHOD zif_abapgit_gui_renderable~render. DATA: lt_repo_items TYPE zif_abapgit_definitions=>ty_repo_item_tt, lo_browser TYPE REF TO zcl_abapgit_repo_content_list, lx_error TYPE REF TO zcx_abapgit_exception, lv_max TYPE abap_bool, lv_max_str TYPE string, lv_add_str TYPE string, li_log TYPE REF TO zif_abapgit_log, lv_msg TYPE string, lo_news TYPE REF TO zcl_abapgit_repo_news. FIELD-SYMBOLS <ls_item> LIKE LINE OF lt_repo_items. register_handlers( ). CREATE OBJECT mo_repo_aggregated_state. CREATE OBJECT ri_html TYPE zcl_abapgit_html. TRY. " Reinit, for the case of type change mo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( mo_repo->get_key( ) ). IF mv_connection_error = abap_true. " If connection doesn't work, render a minimal header ri_html->add( |<div class="repo" id="repo{ mv_key }">| ). ri_html->add( zcl_abapgit_gui_chunk_lib=>render_repo_top( io_repo = mo_repo iv_show_edit = abap_true iv_show_branch = abap_false iv_show_commit = abap_false iv_interactive_branch = abap_false ) ). ri_html->add( '</div>' ). ri_html->add( render_head_line( ) ). " Reset error flag to try connecting again next time CLEAR mv_connection_error. RETURN. ENDIF. check_connection( ). check_branch( ). mv_are_changes_recorded_in_tr = zcl_abapgit_factory=>get_sap_package( mo_repo->get_package( ) )->are_changes_recorded_in_tr_req( ). lo_news = zcl_abapgit_repo_news=>create( mo_repo ). ri_html->add( |<div class="repo" id="repo{ mv_key }">| ). ri_html->add( zcl_abapgit_gui_chunk_lib=>render_repo_top( io_repo = mo_repo io_news = lo_news iv_show_edit = abap_true iv_interactive_branch = abap_true ) ). ri_html->add( zcl_abapgit_gui_chunk_lib=>render_news( io_news = lo_news ) ). zcl_abapgit_exit=>get_instance( )->wall_message_repo( is_repo_meta = mo_repo->ms_data ii_html = ri_html ). CREATE OBJECT lo_browser EXPORTING io_repo = mo_repo. lt_repo_items = lo_browser->list( iv_path = mv_cur_dir iv_by_folders = mv_show_folders iv_changes_only = mv_changes_only iv_transports = mv_are_changes_recorded_in_tr ). apply_order_by( CHANGING ct_repo_items = lt_repo_items ). LOOP AT lt_repo_items ASSIGNING <ls_item>. mo_repo_aggregated_state->sum_with_repo_item( <ls_item> ). ENDLOOP. ri_html->add( render_head_line( ) ). li_log = lo_browser->get_log( ). IF li_log->count( ) > 0. ri_html->add( '<div class="log">' ). ri_html->add( zcl_abapgit_log_viewer=>to_html( li_log ) ). " shows eg. list of unsupported objects ri_html->add( '</div>' ). ENDIF. ri_html->add( '<div class="repo_container">' ). CLEAR lv_msg. IF lines( lt_repo_items ) = 0. IF mv_changes_only = abap_true. IF mo_repo->is_offline( ) = abap_true. " Offline match banner IF mo_repo->has_remote_source( ) = abap_true. lv_msg = 'Local state completely <b>matches</b> the ZIP file'. ELSE. lv_msg = 'Import a ZIP file to see if there are any changes'. ENDIF. ELSE. " Online match banner lv_msg = 'Local state completely <b>matches</b> the remote repository'. ENDIF. ELSE. lv_msg = |Package is empty. Show { build_dir_jump_link( 'parent' ) } package|. ENDIF. ELSE. " Repo content table ri_html->add( '<table class="repo_tab">' ). ri_html->add( render_table_header( ) ). IF zcl_abapgit_path=>is_root( mv_cur_dir ) = abap_false. ri_html->add( render_parent_dir( ) ). ENDIF. LOOP AT lt_repo_items ASSIGNING <ls_item>. IF mv_max_lines > 0 AND sy-tabix > mv_max_lines. lv_max = abap_true. EXIT. " current loop ENDIF. ri_html->add( render_item( is_item = <ls_item> iv_render_transports = mv_are_changes_recorded_in_tr ) ). ENDLOOP. ri_html->add( render_table_footer( ) ). ri_html->add( '</table>' ). ENDIF. IF NOT lv_msg IS INITIAL. ri_html->add( |<div class="panel success repo_banner">{ lv_msg }</div>| ). ENDIF. IF lv_max = abap_true. ri_html->add( '<div class = "dummydiv">' ). IF mv_max_lines = 1. lv_max_str = '1 object'. ELSE. lv_max_str = |first { mv_max_lines } objects|. ENDIF. lv_add_str = |+{ mv_max_setting }|. ri_html->add( |Only { lv_max_str } objects shown in list. Display { ri_html->a( iv_txt = lv_add_str iv_act = c_actions-display_more ) } more (change in Settings > { ri_html->a( iv_txt = 'Personal Settings' iv_act = zif_abapgit_definitions=>c_action-go_settings_personal ) })| ). ri_html->add( '</div>' ). ENDIF. ri_html->add( '</div>' ). ri_html->add( '</div>' ). CATCH zcx_abapgit_exception INTO lx_error. " Reset 'last shown repo' so next start will go to repo overview " and allow troubleshooting of issue zcl_abapgit_persistence_user=>get_instance( )->set_repo_show( || ). RAISE EXCEPTION lx_error. ENDTRY. register_deferred_script( render_scripts( ) ). ENDMETHOD. ENDCLASS. |