From 16163f08c61bb9e805fdef40ebc50604687fae10 Mon Sep 17 00:00:00 2001 From: AllForNothing Date: Wed, 28 Aug 2019 17:31:57 +0800 Subject: [PATCH] remove whitespaces when add tag-retention rule Signed-off-by: AllForNothing --- .../lib/src/create-edit-rule/create-edit-rule.component.ts | 4 ++-- .../app/project/tag-retention/add-rule/add-rule.component.ts | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/portal/lib/src/create-edit-rule/create-edit-rule.component.ts b/src/portal/lib/src/create-edit-rule/create-edit-rule.component.ts index 2ecf2ffca..eb61d1074 100644 --- a/src/portal/lib/src/create-edit-rule/create-edit-rule.component.ts +++ b/src/portal/lib/src/create-edit-rule/create-edit-rule.component.ts @@ -138,8 +138,8 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy { }); } trimText(event) { - if (event.srcElement.value) { - event.srcElement.value = event.srcElement.value.trim(); + if (event.target.value) { + event.target.value = event.target.value.trim(); } } equals(c1: any, c2: any): boolean { diff --git a/src/portal/src/app/project/tag-retention/add-rule/add-rule.component.ts b/src/portal/src/app/project/tag-retention/add-rule/add-rule.component.ts index 9a6d9ce24..f8cb51bd9 100644 --- a/src/portal/src/app/project/tag-retention/add-rule/add-rule.component.ts +++ b/src/portal/src/app/project/tag-retention/add-rule/add-rule.component.ts @@ -179,6 +179,9 @@ export class AddRuleComponent implements OnInit, OnDestroy { } add() { + // remove whitespaces + this.rule.scope_selectors.repository[0].pattern = this.rule.scope_selectors.repository[0].pattern.replace(/\s+/g, ""); + this.rule.tag_selectors[0].pattern = this.rule.tag_selectors[0].pattern.replace(/\s+/g, ""); if (this.rule.scope_selectors.repository[0].decoration !== "repoMatches" && this.rule.scope_selectors.repository[0].pattern.indexOf("**") !== -1) { this.inlineAlert.showInlineError(INVALID_RULE);