Add validator to destination namespace input (#15120)

Signed-off-by: AllForNothing <sshijun@vmware.com>
This commit is contained in:
Will Sun 2021-06-11 11:58:43 +08:00 committed by GitHub
parent 22d833460d
commit 47b7457378
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 22 additions and 16 deletions

View File

@ -146,7 +146,7 @@
<!--destination namespaces -->
<div class="clr-form-control">
<label for="dest_namespace" class="clr-control-label">{{'REPLICATION.DESTINATION' | translate}}</label>
<div class="clr-control-container" [class.clr-error]="ruleForm.controls.dest_namespace.touched && ruleForm.controls.dest_namespace.invalid">
<div class="clr-control-container" [class.clr-error]="(ruleForm.controls.dest_namespace.dirty || ruleForm.controls.dest_namespace.touched) && ruleForm.controls.dest_namespace.invalid">
<div class="clr-input-wrapper">
<label class="sub-label">{{'REPLICATION.NAMESPACE' | translate}}:</label>
<input autocomplete="off" class="clr-input" formControlName="dest_namespace" type="text" id="dest_namespace" pattern="^[a-z0-9]+(?:[/._-][a-z0-9]+)*$"
@ -158,8 +158,8 @@
</clr-tooltip-content>
</clr-tooltip>
</div>
<clr-control-error class="margin-left-90px" *ngIf="ruleForm.controls.dest_namespace.touched && ruleForm.controls.dest_namespace.invalid">
{{'REPLICATION.DESTINATION_NAME_TOOLTIP' | translate}}
<clr-control-error class="margin-left-90px" *ngIf="(ruleForm.controls.dest_namespace.dirty || ruleForm.controls.dest_namespace.touched) && ruleForm.controls.dest_namespace.invalid">
{{'REPLICATION.NAMESPACE_TOOLTIP' | translate}}
</clr-control-error>
</div>
</div>

View File

@ -211,6 +211,11 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
}
get isValid() {
if (this.ruleForm.controls["dest_namespace"].value) {
if (this.ruleForm.controls["dest_namespace"].invalid) {
return false;
}
}
let controlName = !!this.ruleForm.controls["name"].value;
let sourceRegistry = !!this.ruleForm.controls["src_registry"].value;
let destRegistry = !!this.ruleForm.controls["dest_registry"].value;

View File

@ -617,7 +617,7 @@
"SOURCE_NAMESPACES": "Quell-Namespaces",
"DEST_REGISTRY": "Ziel-Registry",
"DEST_NAMESPACE": "Ziel-Namespace",
"NAMESPACE_TOOLTIP": "Der Name des Namespaces sollte mindestens 2 Zeichen lang sein mit Kleinschreibung, Ziffern und ._- . Er muss mit Zeichen oder Ziffern beginnen.",
"NAMESPACE_TOOLTIP": "Der Name des Namespaces sollte mindestens 2 Zeichen lang sein mit Kleinschreibung, Ziffern und ._-/ . Er muss mit Zeichen oder Ziffern beginnen.",
"TAG": "Tag",
"LABEL": "Label",
"RESOURCE": "Ressource",

View File

@ -609,7 +609,7 @@
"DELETE_ENABLED": "Enabled this policy",
"NEW": "New",
"NAME_TOOLTIP": "replication rule name should be at least 2 characters long with lower case characters, numbers and ._- and must be start with characters or numbers.",
"DESTINATION_NAME_TOOLTIP": "Destination name should be at least 2 characters long with lower case characters, numbers and ._-/ and must be start with characters or numbers.",
"DESTINATION_NAME_TOOLTIP": "Destination name should be at least 2 characters long with lower case characters, numbers and ._- and must be start with characters or numbers.",
"ACKNOWLEDGE": "Acknowledge",
"RULE_DISABLED": "This rule has been disabled because a label used in its filter has been deleted. \n Edit the rule and update its filter to enable it.",
"REPLI_MODE": "Replication mode",
@ -617,7 +617,7 @@
"SOURCE_NAMESPACES": "Source namespaces",
"DEST_REGISTRY": "Destination registry",
"DEST_NAMESPACE": "Destination namespace",
"NAMESPACE_TOOLTIP": "Namespace name should be at least 2 characters long with lower case characters, numbers and ._- and must be start with characters or numbers.",
"NAMESPACE_TOOLTIP": "Namespace name should be at least 2 characters long with lower case characters, numbers and ._-/ and must be start with characters or numbers.",
"TAG": "Tag",
"LABEL": "Label",
"RESOURCE": "Resource",

View File

@ -611,6 +611,7 @@
"DELETE_ENABLED": "Enabled this policy",
"NEW": "New",
"NAME_TOOLTIP": "replication rule name should be at least 2 characters long with lower case characters, numbers and ._- and must be start with characters or numbers.",
"DESTINATION_NAME_TOOLTIP": "Destination name should be at least 2 characters long with lower case characters, numbers and ._- and must be start with characters or numbers.",
"ACKNOWLEDGE": "Acknowledge",
"RULE_DISABLED": "This rule has been disabled because a label used in its filter has been deleted. \n Edit the rule and update its filter to enable it.",
"REPLI_MODE": "Replication mode",
@ -618,7 +619,7 @@
"SOURCE_NAMESPACES": "Source namespaces",
"DEST_REGISTRY": "Destination registry",
"DEST_NAMESPACE": "Destination namespace",
"NAMESPACE_TOOLTIP": "Namespace name should be at least 2 characters long with lower case characters, numbers and ._- and must be start with characters or numbers.",
"NAMESPACE_TOOLTIP": "Namespace name should be at least 2 characters long with lower case characters, numbers and ._-/ and must be start with characters or numbers.",
"TAG": "Tag",
"LABEL": "Label",
"RESOURCE": "Resource",

View File

@ -599,7 +599,7 @@
"DELETE_ENABLED": "Enabled this policy",
"NEW": "New",
"NAME_TOOLTIP": "replication rule name should be at least 2 characters long with lower case characters, numbers and ._- and must be start with characters or numbers.",
"DESTINATION_NAME_TOOLTIP": "Destination name should be at least 2 characters long with lower case characters, numbers and ._-/ and must be start with characters or numbers.",
"DESTINATION_NAME_TOOLTIP": "Destination name should be at least 2 characters long with lower case characters, numbers and ._- and must be start with characters or numbers.",
"ACKNOWLEDGE": "Acknowledge",
"RULE_DISABLED": "This rule has been disabled because a label used in its filter has been deleted. \n Edit the rule and update its filter to enable it.",
"REPLI_MODE": "Replication mode",
@ -607,7 +607,7 @@
"SOURCE_NAMESPACES": "Source namespaces",
"DEST_REGISTRY": "Destination registry",
"DEST_NAMESPACE": "Destination namespace",
"NAMESPACE_TOOLTIP": "Namespace name should be at least 2 characters long with lower case characters, numbers and ._- and must be start with characters or numbers.",
"NAMESPACE_TOOLTIP": "Namespace name should be at least 2 characters long with lower case characters, numbers and ._-/ and must be start with characters or numbers.",
"TAG": "Tag",
"LABEL": "Label",
"RESOURCE": "Resource",

View File

@ -609,7 +609,7 @@
"DELETE_ENABLED": "Enabled this policy",
"NEW": "Novo",
"NAME_TOOLTIP": "nome da regra de replicação deve conter ao menos 2 caracteres sendo caracteres minusculos, números e ._- e devem iniciar com letras e números.",
"DESTINATION_NAME_TOOLTIP": "Destination name should be at least 2 characters long with lower case characters, numbers and ._-/ and must be start with characters or numbers.",
"DESTINATION_NAME_TOOLTIP": "Destination name should be at least 2 characters long with lower case characters, numbers and ._- and must be start with characters or numbers.",
"ACKNOWLEDGE": "Reconhecer",
"RULE_DISABLED": "Essa regra foi desabilitada pois uma label usada no seu filtro foi removida. \n Edite a regra e atualize seu filtro para habilitá-la.",
"REPLI_MODE": "Replication mode",
@ -617,7 +617,7 @@
"SOURCE_NAMESPACES": "Source namespaces",
"DEST_REGISTRY": "Destination registry",
"DEST_NAMESPACE": "Destination namespace",
"NAMESPACE_TOOLTIP": "Namespace name should be at least 2 characters long with lower case characters, numbers and ._- and must be start with characters or numbers.",
"NAMESPACE_TOOLTIP": "Namespace name should be at least 2 characters long with lower case characters, numbers and ._-/ and must be start with characters or numbers.",
"TAG": "Tag",
"LABEL": "Label",
"RESOURCE": "Resource",

View File

@ -609,7 +609,7 @@
"DELETE_ENABLED": "Bu politika etkinleştirildi",
"NEW": "Yeni",
"NAME_TOOLTIP": "Çoğaltma kuralı adı, en küçük harf, sayı ve ._- ile en az 2 karakter uzunluğunda olmalı ve karakter ya da sayılarla başlamalıdır.",
"DESTINATION_NAME_TOOLTIP": "Hedef adı, en az 2 karakter uzunluğunda, küçük harf, rakam ve ._-/ ile yazılmalı ve karakter veya rakamlarla başlamalıdır.",
"DESTINATION_NAME_TOOLTIP": "Hedef adı, en az 2 karakter uzunluğunda, küçük harf, rakam ve ._- ile yazılmalı ve karakter veya rakamlarla başlamalıdır.",
"ACKNOWLEDGE": "Onaylamak",
"RULE_DISABLED": "Bu kural, filtresinde kullanılan bir etiket silindiğinden dolayı devre dışı bırakıldı. \n Kuralı düzenleyin ve etkinleştirmek için filtresini güncelleyin.",
"REPLI_MODE": "Çoğaltma modu",
@ -617,7 +617,7 @@
"SOURCE_NAMESPACES": "Kaynak ad alanları",
"DEST_REGISTRY": "Hedef kaydı",
"DEST_NAMESPACE": "Hedef ad alanı",
"NAMESPACE_TOOLTIP": "İsim alanı ismi en az 2 karakter uzunluğunda, küçük harfli karakterler, sayılar ve ._- ile başlamalı ve karakter veya sayılarla başlamalıdır. Ad alanı adı en az 2 karakter uzunluğunda, küçük harf, rakam ve ._- ile başlamalı ve karakter veya rakamlarla başlamalıdır.",
"NAMESPACE_TOOLTIP": "İsim alanı ismi en az 2 karakter uzunluğunda, küçük harfli karakterler, sayılar ve ._-/ ile başlamalı ve karakter veya sayılarla başlamalıdır. Ad alanı adı en az 2 karakter uzunluğunda, küçük harf, rakam ve ._- ile başlamalı ve karakter veya rakamlarla başlamalıdır.",
"TAG": "Etiketlemek",
"LABEL": "Etiket",
"RESOURCE": "Kaynak",

View File

@ -611,7 +611,7 @@
"DELETE_ENABLED": "默认启用该规则",
"NEW": "新增",
"NAME_TOOLTIP": "项目名称由小写字符、数字和._-组成且至少2个字符并以字符或者数字开头。",
"DESTINATION_NAME_TOOLTIP": "名称空间由小写字符、数字和._-/组成且至少2个字符并以字符或者数字开头。",
"DESTINATION_NAME_TOOLTIP": "名称空间由小写字符、数字和._-组成且至少2个字符并以字符或者数字开头。",
"ACKNOWLEDGE": "确认",
"RULE_DISABLED": "这个规则因为过滤选项中的标签被删除已经不能用了,更新过滤项以便重新启用规则。",
"REPLI_MODE": "复制模式",
@ -619,7 +619,7 @@
"SOURCE_NAMESPACES": "源名称空间",
"DEST_REGISTRY": "目标仓库",
"DEST_NAMESPACE": "目标名称空间",
"NAMESPACE_TOOLTIP": "名称空间名称由小写字符、数字和._-组成且至少2个字符并以字符或者数字开头。",
"NAMESPACE_TOOLTIP": "名称空间名称由小写字符、数字和._-/组成且至少2个字符并以字符或者数字开头。",
"TAG": "Tag",
"LABEL": "标签",
"RESOURCE": "资源",

View File

@ -614,7 +614,7 @@
"SOURCE_NAMESPACES":"源命名空間",
"DEST_REGISTRY":"目的註冊表",
"DEST_NAMESPACE":"目的名稱空間",
"NAMESPACE_TOOLTIP": "Namespace名稱由小寫字符、數字和._-組成且至少2個字符並以字符或者數字開頭。",
"NAMESPACE_TOOLTIP": "Namespace名稱由小寫字符、數字和._-/組成且至少2個字符並以字符或者數字開頭。",
"TAG":"標籤",
"LABEL": "標籤",
"RESOURCE": "資源",