mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-16 20:01:35 +01:00
Not allow space in replication rule filters (#15984)
Signed-off-by: AllForNothing <sshijun@vmware.com>
This commit is contained in:
parent
6fe2a0cd1d
commit
ddd4cdb306
@ -108,7 +108,7 @@
|
||||
<clr-dropdown class="width-tag-label">
|
||||
<button type="button" class="width-100 dropdown-toggle btn btn-link statistic-data label-text" clrDropdownTrigger>
|
||||
<ng-template ngFor let-label [ngForOf]="filter.value.value" let-m="index">
|
||||
<span class="label" *ngIf="m<1"> {{label}} </span>
|
||||
<hbr-label-piece [hasIcon]="false" [label]="getLabel(label)" [labelWidth]="84"></hbr-label-piece>
|
||||
</ng-template>
|
||||
<span class="ellipsis color-white-dark" *ngIf="filter.value.value.length>1">···</span>
|
||||
<div *ngFor="let label1 of filter.value.value;let k = index" hidden="true">
|
||||
|
@ -181,7 +181,7 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
trimText(event) {
|
||||
if (event.target.value) {
|
||||
event.target.value = event.target.value.trim();
|
||||
event.target.value = event.target.value.replace(/\s+/g, '');
|
||||
}
|
||||
}
|
||||
equals(c1: any, c2: any): boolean {
|
||||
@ -706,4 +706,15 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
|
||||
return realSpeed ? realSpeed : -1;
|
||||
}
|
||||
}
|
||||
getLabel(labelName: string): Label {
|
||||
if (this.supportedFilterLabels?.length) {
|
||||
let label: Label;
|
||||
this.supportedFilterLabels.forEach(item => {
|
||||
if (item.name === labelName) {
|
||||
label = item;
|
||||
}
|
||||
});
|
||||
return label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<label class="label" [ngStyle]="{'background-color': labelColor?.color, 'color': labelColor?.textColor, 'border': labelColor?.color == '#FFFFFF'? '1px solid #A1A1A1': 'none'}" [style.max-width.px]="labelWidth">
|
||||
<clr-icon *ngIf="label.scope=='p'" shape="organization"></clr-icon>
|
||||
<clr-icon *ngIf="label.scope=='g'" shape="administrator"></clr-icon>
|
||||
<clr-icon *ngIf="hasIcon && label.scope=='p'" shape="organization"></clr-icon>
|
||||
<clr-icon *ngIf="hasIcon && label.scope=='g'" shape="administrator"></clr-icon>
|
||||
{{label.name}}
|
||||
</label>
|
||||
|
@ -25,6 +25,7 @@ import { Label } from "../../../../../../ng-swagger-gen/models/label";
|
||||
export class LabelPieceComponent implements OnInit, OnChanges {
|
||||
@Input() label: Label;
|
||||
@Input() labelWidth: number;
|
||||
@Input() hasIcon: boolean = true;
|
||||
labelColor: {[key: string]: string};
|
||||
|
||||
ngOnChanges(): void {
|
||||
|
Loading…
Reference in New Issue
Block a user