From 04a140332ef92e12531fc0b5b839d3222036b8b0 Mon Sep 17 00:00:00 2001 From: ShengqiWang <124650040+ShengqiWang@users.noreply.github.com> Date: Mon, 15 Jan 2024 14:09:56 +0800 Subject: [PATCH] fix artifact page bug (#19807) * fix artifact page bug * update testcase --- .../artifact-filter/artifact-filter.component.html | 1 + .../label-selector/label-selector.component.spec.ts | 2 +- .../components/label-selector/label-selector.component.ts | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-filter/artifact-filter.component.html b/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-filter/artifact-filter.component.html index 7e59a8a6d..17616efba 100644 --- a/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-filter/artifact-filter.component.html +++ b/src/portal/src/app/base/project/repository/artifact/artifact-list-page/artifact-list/artifact-list-tab/artifact-filter/artifact-filter.component.html @@ -83,6 +83,7 @@ (clickLabel)="selectValue($event)" [scope]="'p'" [projectId]="projectId" + [dropdownOpened]="dropdownOpened" [width]="200" [ownedLabels]="getSelectLabel()"> diff --git a/src/portal/src/app/shared/components/label-selector/label-selector.component.spec.ts b/src/portal/src/app/shared/components/label-selector/label-selector.component.spec.ts index 1c90ed394..c9e538704 100644 --- a/src/portal/src/app/shared/components/label-selector/label-selector.component.spec.ts +++ b/src/portal/src/app/shared/components/label-selector/label-selector.component.spec.ts @@ -59,6 +59,6 @@ describe('LabelSelectorComponent', () => { fixture.detectChanges(); await fixture.whenStable(); const checkIcon = fixture.nativeElement.querySelector('.check-icon'); - expect(checkIcon.style.visibility).toEqual('visible'); + expect(checkIcon.style.visibility).toEqual('hidden'); }); }); diff --git a/src/portal/src/app/shared/components/label-selector/label-selector.component.ts b/src/portal/src/app/shared/components/label-selector/label-selector.component.ts index 6a9120799..829260d23 100644 --- a/src/portal/src/app/shared/components/label-selector/label-selector.component.ts +++ b/src/portal/src/app/shared/components/label-selector/label-selector.component.ts @@ -41,6 +41,8 @@ export class LabelSelectorComponent implements OnInit, OnChanges, OnDestroy { scope: string = GLOBAL; // 'g' for global and 'p' for project, default 'g' @Input() projectId: number; // if scope = 'p', projectId is required + @Input() + dropdownOpened: boolean; // parent component opened status candidateLabels: Label[] = []; searchValue: string; loading: boolean = false; @@ -159,7 +161,7 @@ export class LabelSelectorComponent implements OnInit, OnChanges, OnDestroy { isSelect(label: Label): boolean { if (this.ownedLabels?.length) { return this.ownedLabels.some(item => { - return item.id === label.id; + return item.id === label.id && this.dropdownOpened; }); } return false;