Remove duplicate labels from Command Palette. (#6821)

Co-authored-by: Marc Bernard <59966492+mbtools@users.noreply.github.com>
Co-authored-by: Marc Bernard <marc@marcbernardtools.com>
This commit is contained in:
Francisco Milán 2024-03-12 03:19:44 -06:00 committed by GitHub
parent 9295929903
commit 687c91bcf5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 4 deletions

View File

@ -177,6 +177,7 @@ CLASS zcl_abapgit_gui_chunk_lib DEFINITION
it_labels TYPE string_table it_labels TYPE string_table
io_label_colors TYPE REF TO zcl_abapgit_string_map io_label_colors TYPE REF TO zcl_abapgit_string_map
iv_clickable_action TYPE string OPTIONAL iv_clickable_action TYPE string OPTIONAL
iv_unlisted TYPE abap_bool DEFAULT abap_false
RETURNING RETURNING
VALUE(rv_html) TYPE string. VALUE(rv_html) TYPE string.
@ -661,6 +662,7 @@ CLASS zcl_abapgit_gui_chunk_lib IMPLEMENTATION.
DATA lt_fragments TYPE string_table. DATA lt_fragments TYPE string_table.
DATA lv_l TYPE string. DATA lv_l TYPE string.
DATA lv_class TYPE string. DATA lv_class TYPE string.
DATA lv_class_cmd TYPE string.
DATA lv_style TYPE string. DATA lv_style TYPE string.
DATA ls_parsed_color TYPE zcl_abapgit_repo_labels=>ty_color. DATA ls_parsed_color TYPE zcl_abapgit_repo_labels=>ty_color.
DATA li_html TYPE REF TO zif_abapgit_html. DATA li_html TYPE REF TO zif_abapgit_html.
@ -669,6 +671,11 @@ CLASS zcl_abapgit_gui_chunk_lib IMPLEMENTATION.
RETURN. RETURN.
ENDIF. ENDIF.
lv_class_cmd = 'command'.
IF iv_unlisted = abap_true.
lv_class_cmd = lv_class_cmd && ' unlisted'.
ENDIF.
li_html = zcl_abapgit_html=>create( ). li_html = zcl_abapgit_html=>create( ).
APPEND `<ul class="repo-labels">` TO lt_fragments. APPEND `<ul class="repo-labels">` TO lt_fragments.
@ -697,9 +704,9 @@ CLASS zcl_abapgit_gui_chunk_lib IMPLEMENTATION.
IF iv_clickable_action IS NOT INITIAL. IF iv_clickable_action IS NOT INITIAL.
lv_l = li_html->a( lv_l = li_html->a(
iv_txt = lv_l iv_txt = lv_l
iv_act = |{ iv_clickable_action }| iv_act = |{ iv_clickable_action }|
iv_class = 'command' iv_class = lv_class_cmd
iv_query = lv_l ). iv_query = lv_l ).
ENDIF. ENDIF.
lv_l = |<li{ lv_class }{ lv_style }>{ lv_l }</li>|. lv_l = |<li{ lv_class }{ lv_style }>{ lv_l }</li>|.

View File

@ -763,6 +763,7 @@ CLASS zcl_abapgit_gui_page_repo_over IMPLEMENTATION.
iv_content = zcl_abapgit_gui_chunk_lib=>render_label_list( iv_content = zcl_abapgit_gui_chunk_lib=>render_label_list(
it_labels = is_repo-labels it_labels = is_repo-labels
io_label_colors = mo_label_colors io_label_colors = mo_label_colors
iv_unlisted = abap_true
iv_clickable_action = c_action-label_filter ) iv_clickable_action = c_action-label_filter )
iv_class = 'labels' ). iv_class = 'labels' ).
ENDIF. ENDIF.

View File

@ -2403,7 +2403,7 @@ function enumerateUiActions() {
// - label links // - label links
// - command links // - command links
// - other header links // - other header links
[].slice.call(document.querySelectorAll("form a, a.command, #header ul:not([id*='toolbar']) a")) [].slice.call(document.querySelectorAll("form a, a.command:not(.unlisted), #header ul:not([id*='toolbar']) a"))
.filter(function(anchor) { .filter(function(anchor) {
return !!anchor.title || !!anchor.text; return !!anchor.title || !!anchor.text;
}).forEach(function(anchor) { }).forEach(function(anchor) {