Merge pull request #8864 from AllForNothing/master

remove whitespaces when add tag-retention rule
This commit is contained in:
Will Sun 2019-08-29 08:56:52 +08:00 committed by GitHub
commit fb66d58334
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

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

View File

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