Not allow space in replication rule filters (#15984)

Signed-off-by: AllForNothing <sshijun@vmware.com>
This commit is contained in:
孙世军 2021-11-11 12:23:26 +08:00 committed by GitHub
parent 6fe2a0cd1d
commit ddd4cdb306
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 4 deletions

View File

@ -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">

View File

@ -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;
}
}
}

View File

@ -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>

View File

@ -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 {