Fix a bug that when someone edits a rule with same name ,it displays the name is already in use

Signed-off-by: Yogi_Wang <yawang@vmware.com>
This commit is contained in:
Yogi_Wang 2019-11-01 12:37:19 +08:00
parent 2101d7125c
commit 92cac6fd35

View File

@ -123,7 +123,7 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
this.inNameChecking = true; this.inNameChecking = true;
this.repService.getReplicationRules(0, ruleName) this.repService.getReplicationRules(0, ruleName)
.subscribe(response => { .subscribe(response => {
if (response.some(rule => rule.name === ruleName)) { if (response.some(rule => (rule.name === ruleName && rule.id !== this.policyId))) {
this.ruleNameTooltip = "TOOLTIP.RULE_USER_EXISTING"; this.ruleNameTooltip = "TOOLTIP.RULE_USER_EXISTING";
this.isRuleNameValid = false; this.isRuleNameValid = false;
} }