mirror of https://github.com/goharbor/harbor.git
fix artifact page bug (#19807)
* fix artifact page bug * update testcase
This commit is contained in:
parent
eb125419cc
commit
04a140332e
|
@ -83,6 +83,7 @@
|
||||||
(clickLabel)="selectValue($event)"
|
(clickLabel)="selectValue($event)"
|
||||||
[scope]="'p'"
|
[scope]="'p'"
|
||||||
[projectId]="projectId"
|
[projectId]="projectId"
|
||||||
|
[dropdownOpened]="dropdownOpened"
|
||||||
[width]="200"
|
[width]="200"
|
||||||
[ownedLabels]="getSelectLabel()">
|
[ownedLabels]="getSelectLabel()">
|
||||||
</app-label-selector>
|
</app-label-selector>
|
||||||
|
|
|
@ -59,6 +59,6 @@ describe('LabelSelectorComponent', () => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
const checkIcon = fixture.nativeElement.querySelector('.check-icon');
|
const checkIcon = fixture.nativeElement.querySelector('.check-icon');
|
||||||
expect(checkIcon.style.visibility).toEqual('visible');
|
expect(checkIcon.style.visibility).toEqual('hidden');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -41,6 +41,8 @@ export class LabelSelectorComponent implements OnInit, OnChanges, OnDestroy {
|
||||||
scope: string = GLOBAL; // 'g' for global and 'p' for project, default 'g'
|
scope: string = GLOBAL; // 'g' for global and 'p' for project, default 'g'
|
||||||
@Input()
|
@Input()
|
||||||
projectId: number; // if scope = 'p', projectId is required
|
projectId: number; // if scope = 'p', projectId is required
|
||||||
|
@Input()
|
||||||
|
dropdownOpened: boolean; // parent component opened status
|
||||||
candidateLabels: Label[] = [];
|
candidateLabels: Label[] = [];
|
||||||
searchValue: string;
|
searchValue: string;
|
||||||
loading: boolean = false;
|
loading: boolean = false;
|
||||||
|
@ -159,7 +161,7 @@ export class LabelSelectorComponent implements OnInit, OnChanges, OnDestroy {
|
||||||
isSelect(label: Label): boolean {
|
isSelect(label: Label): boolean {
|
||||||
if (this.ownedLabels?.length) {
|
if (this.ownedLabels?.length) {
|
||||||
return this.ownedLabels.some(item => {
|
return this.ownedLabels.some(item => {
|
||||||
return item.id === label.id;
|
return item.id === label.id && this.dropdownOpened;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue