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 | 1x 1x 1x 1x 1x 1x | const {cx_root} = await import("./cx_root.clas.mjs"); // zcl_abapgit_popup_branch_list.clas.abap class zcl_abapgit_popup_branch_list { static INTERNAL_TYPE = 'CLAS'; static INTERNAL_NAME = 'ZCL_ABAPGIT_POPUP_BRANCH_LIST'; static IMPLEMENTED_INTERFACES = ["ZIF_ABAPGIT_GUI_RENDER_ITEM","ZIF_ABAPGIT_HTML_POPUP"]; static ATTRIBUTES = {"MV_REPO_URL": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "visibility": "I", "is_constant": " ", "is_class": " "}, "MV_DEFAULT_BRANCH": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "visibility": "I", "is_constant": " ", "is_class": " "}, "MV_SHOW_NEW_OPTION": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});}, "visibility": "I", "is_constant": " ", "is_class": " "}}; static METHODS = {"FETCH_BRANCH_LIST": {"visibility": "I", "parameters": {"RT_BRANCHES": {"type": () => {return abap.types.TableFactory.construct(new abap.types.Structure({ "sha1": new abap.types.Character(40, {"qualifiedName":"zif_abapgit_git_definitions=>ty_sha1"}), "name": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_GIT_BRANCH-NAME"}), "type": new abap.types.Character(2, {"qualifiedName":"zif_abapgit_git_definitions=>ty_git_branch_type"}), "is_head": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}), "display_name": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_GIT_BRANCH-DISPLAY_NAME"})}, "zif_abapgit_git_definitions=>ty_git_branch", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[{"name":"name_key","type":"SORTED","isUnique":false,"keyFields":["NAME"]}]}, "zif_abapgit_git_definitions=>ty_git_branch_list_tt");}, "is_optional": " "}}}, "CREATE": {"visibility": "U", "parameters": {"RI_POPUP": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_HTML_POPUP", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_HTML_POPUP"});}, "is_optional": " "}, "IV_URL": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_DEFAULT_BRANCH": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_SHOW_NEW_OPTION": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});}, "is_optional": " "}}}, "CONSTRUCTOR": {"visibility": "U", "parameters": {"IV_URL": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_DEFAULT_BRANCH": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_SHOW_NEW_OPTION": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});}, "is_optional": " "}}}}; #mv_repo_url; #mv_default_branch; #mv_show_new_option; constructor() { this.me = new abap.types.ABAPObject(); this.me.set(this); this.INTERNAL_ID = abap.internalIdCounter++; this.FRIENDS_ACCESS_INSTANCE = { "fetch_branch_list": this.#fetch_branch_list.bind(this), }; this.#mv_repo_url = new abap.types.String({qualifiedName: "STRING"}); this.FRIENDS_ACCESS_INSTANCE["mv_repo_url"] = this.#mv_repo_url; this.#mv_default_branch = new abap.types.String({qualifiedName: "STRING"}); this.FRIENDS_ACCESS_INSTANCE["mv_default_branch"] = this.#mv_default_branch; this.#mv_show_new_option = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}); this.FRIENDS_ACCESS_INSTANCE["mv_show_new_option"] = this.#mv_show_new_option; } async constructor_(INPUT) { let iv_url = INPUT?.iv_url; if (iv_url?.getQualifiedName === undefined || iv_url.getQualifiedName() !== "STRING") { iv_url = undefined; } if (iv_url === undefined) { iv_url = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_url); } let iv_default_branch = new abap.types.String({qualifiedName: "STRING"}); if (INPUT && INPUT.iv_default_branch) {iv_default_branch.set(INPUT.iv_default_branch);} let iv_show_new_option = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}); if (INPUT && INPUT.iv_show_new_option) {iv_show_new_option.set(INPUT.iv_show_new_option);} if (INPUT === undefined || INPUT.iv_show_new_option === undefined) {iv_show_new_option = abap.builtin.abap_false;} this.#mv_repo_url.set(iv_url); this.#mv_default_branch.set(abap.operators.concat(abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_git_branch.get().heads_prefix,iv_default_branch)); this.#mv_show_new_option.set(iv_show_new_option); return this; } async create(INPUT) { return zcl_abapgit_popup_branch_list.create(INPUT); } static async create(INPUT) { let ri_popup = new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_HTML_POPUP", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_HTML_POPUP"}); let iv_url = INPUT?.iv_url; if (iv_url?.getQualifiedName === undefined || iv_url.getQualifiedName() !== "STRING") { iv_url = undefined; } if (iv_url === undefined) { iv_url = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_url); } let iv_default_branch = new abap.types.String({qualifiedName: "STRING"}); if (INPUT && INPUT.iv_default_branch) {iv_default_branch.set(INPUT.iv_default_branch);} let iv_show_new_option = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}); if (INPUT && INPUT.iv_show_new_option) {iv_show_new_option.set(INPUT.iv_show_new_option);} if (INPUT === undefined || INPUT.iv_show_new_option === undefined) {iv_show_new_option = abap.builtin.abap_false;} ri_popup.set(await (new abap.Classes['ZCL_ABAPGIT_POPUP_BRANCH_LIST']()).constructor_({iv_url: iv_url, iv_default_branch: iv_default_branch, iv_show_new_option: iv_show_new_option})); return ri_popup; } async #fetch_branch_list() { let rt_branches = abap.types.TableFactory.construct(new abap.types.Structure({ "sha1": new abap.types.Character(40, {"qualifiedName":"zif_abapgit_git_definitions=>ty_sha1"}), "name": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_GIT_BRANCH-NAME"}), "type": new abap.types.Character(2, {"qualifiedName":"zif_abapgit_git_definitions=>ty_git_branch_type"}), "is_head": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}), "display_name": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_GIT_BRANCH-DISPLAY_NAME"})}, "zif_abapgit_git_definitions=>ty_git_branch", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[{"name":"name_key","type":"SORTED","isUnique":false,"keyFields":["NAME"]}]}, "zif_abapgit_git_definitions=>ty_git_branch_list_tt"); let lo_branches = new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_GIT_BRANCH_LIST", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_GIT_BRANCH_LIST"}); let lv_head_symref = new abap.types.String({qualifiedName: "STRING"}); let fs_ls_branch_ = new abap.types.FieldSymbol(new abap.types.Structure({ "sha1": new abap.types.Character(40, {"qualifiedName":"zif_abapgit_git_definitions=>ty_sha1"}), "name": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_GIT_BRANCH-NAME"}), "type": new abap.types.Character(2, {"qualifiedName":"zif_abapgit_git_definitions=>ty_git_branch_type"}), "is_head": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}), "display_name": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_GIT_BRANCH-DISPLAY_NAME"})}, "zif_abapgit_git_definitions=>ty_git_branch", undefined, {}, {})); lo_branches.set((await (await abap.Classes['ZCL_ABAPGIT_GIT_FACTORY'].get_git_transport()).get().zif_abapgit_git_transport$branches({iv_url: this.#mv_repo_url}))); rt_branches.set((await lo_branches.get().zif_abapgit_git_branch_list$get_branches_only())); lv_head_symref.set((await lo_branches.get().zif_abapgit_git_branch_list$get_head_symref())); if (abap.compare.initial(rt_branches)) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: abap.CharacterFactory.get(35, 'No branches are available to select')}); } for await (const unique1007 of abap.statements.loop(rt_branches)) { fs_ls_branch_.assign(unique1007); if (abap.compare.initial(fs_ls_branch_.get().name)) { await abap.statements.deleteInternal(rt_branches,{index: abap.builtin.sy.get().tabix}); } else if (abap.compare.eq(fs_ls_branch_.get().is_head, abap.builtin.abap_true) && abap.compare.initial(lv_head_symref) === false && abap.compare.ne(fs_ls_branch_.get().name, lv_head_symref)) { await abap.statements.deleteInternal(rt_branches,{index: abap.builtin.sy.get().tabix}); } } abap.statements.sort(rt_branches,{by: [{component: "is_head", descending: true},{component: "display_name"}]}); if (abap.compare.eq(this.#mv_show_new_option, abap.builtin.abap_true)) { fs_ls_branch_.assign(rt_branches.appendInitial()); fs_ls_branch_.get().name.set(abap.Classes['ZIF_ABAPGIT_POPUPS'].zif_abapgit_popups$c_new_branch_label); fs_ls_branch_.get().display_name.set(abap.Classes['ZIF_ABAPGIT_POPUPS'].zif_abapgit_popups$c_new_branch_label); } return rt_branches; } async zif_abapgit_gui_render_item$render(INPUT) { let ri_html = new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_HTML", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_HTML"}); let iv_item = INPUT?.iv_item; let iv_index = INPUT?.iv_index; if (iv_index?.getQualifiedName === undefined || iv_index.getQualifiedName() !== "I") { iv_index = undefined; } if (iv_index === undefined) { iv_index = new abap.types.Integer({qualifiedName: "I"}).set(INPUT.iv_index); } let lv_head_marker = new abap.types.String({qualifiedName: "STRING"}); let fs_ls_b_ = new abap.types.FieldSymbol(new abap.types.Structure({ "sha1": new abap.types.Character(40, {"qualifiedName":"zif_abapgit_git_definitions=>ty_sha1"}), "name": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_GIT_BRANCH-NAME"}), "type": new abap.types.Character(2, {"qualifiedName":"zif_abapgit_git_definitions=>ty_git_branch_type"}), "is_head": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}), "display_name": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_GIT_BRANCH-DISPLAY_NAME"})}, "zif_abapgit_git_definitions=>ty_git_branch", undefined, {}, {})); abap.statements.assign({target: fs_ls_b_, source: iv_item}); if (abap.compare.eq(fs_ls_b_.get().is_head, abap.builtin.abap_true)) { lv_head_marker.set(new abap.types.String().set(` (<b>${abap.templateFormatting(abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_head_name)}</b>)`)); } ri_html.set((await abap.Classes['ZCL_ABAPGIT_HTML'].create({iv_initial_chunk: new abap.types.String().set(`${abap.templateFormatting(fs_ls_b_.get().display_name)}${abap.templateFormatting(lv_head_marker)}`)}))); return ri_html; } async zif_abapgit_html_popup$create_picklist() { let ro_picklist = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_GUI_PICKLIST", RTTIName: "\\CLASS=ZCL_ABAPGIT_GUI_PICKLIST"}); ro_picklist.set(await (new abap.Classes['ZCL_ABAPGIT_GUI_PICKLIST']()).constructor_({iv_title: abap.CharacterFactory.get(13, 'Choose Branch'), it_list: (await this.#fetch_branch_list()), ii_item_renderer: this.me})); return ro_picklist; } } abap.Classes['ZCL_ABAPGIT_POPUP_BRANCH_LIST'] = zcl_abapgit_popup_branch_list; export {zcl_abapgit_popup_branch_list}; |