All files / output zcl_abapgit_popup_tag_list.clas.mjs

7.05% Statements 6/85
66.66% Branches 2/3
16.66% Functions 1/6
7.05% Lines 6/85

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 851x 1x                     1x 1x                                                                                                                                           1x 1x
const {cx_root} = await import("./cx_root.clas.mjs");
// zcl_abapgit_popup_tag_list.clas.abap
class zcl_abapgit_popup_tag_list {
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'ZCL_ABAPGIT_POPUP_TAG_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": " "}};
  static METHODS = {"FETCH_TAG_LIST": {"visibility": "I", "parameters": {"RT_TAGS": {"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": " "}}},
  "CONSTRUCTOR": {"visibility": "U", "parameters": {"IV_URL": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}}};
  #mv_repo_url;
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
      "fetch_tag_list": this.#fetch_tag_list.bind(this),
    };
    this.#mv_repo_url = new abap.types.String({qualifiedName: "STRING"});
    this.FRIENDS_ACCESS_INSTANCE["mv_repo_url"] = this.#mv_repo_url;
  }
  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); }
    this.#mv_repo_url.set(iv_url);
    return this;
  }
  async create(INPUT) {
    return zcl_abapgit_popup_tag_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); }
    ri_popup.set(await (new abap.Classes['ZCL_ABAPGIT_POPUP_TAG_LIST']()).constructor_({iv_url: iv_url}));
    return ri_popup;
  }
  async #fetch_tag_list() {
    let rt_tags = 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"});
    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_tags.set((await lo_branches.get().zif_abapgit_git_branch_list$get_tags_only()));
    await abap.statements.deleteInternal(rt_tags,{where: async (I) => {return abap.compare.cp(I.name, abap.operators.concat(abap.CharacterFactory.get(1, '*'),abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_git_branch.get().peel));}});
    if (abap.compare.eq(abap.builtin.lines({val: rt_tags}), abap.IntegerFactory.get(0))) {
      await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: abap.CharacterFactory.get(31, 'No tags are available to select')});
    }
    abap.statements.sort(rt_tags,{by: [{component: "display_name"}]});
    return rt_tags;
  }
  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 fs_ls_tag_ = 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_tag_, source: iv_item});
    ri_html.set((await abap.Classes['ZCL_ABAPGIT_HTML'].create({iv_initial_chunk: new abap.types.String().set(`${abap.templateFormatting(fs_ls_tag_.get().display_name)}`)})));
    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(10, 'Choose Tag'), it_list: (await this.#fetch_tag_list()), ii_item_renderer: this.me}));
    return ro_picklist;
  }
}
abap.Classes['ZCL_ABAPGIT_POPUP_TAG_LIST'] = zcl_abapgit_popup_tag_list;
export {zcl_abapgit_popup_tag_list};