From 47b7457378362ea4352d89911d635c50d37cba9c Mon Sep 17 00:00:00 2001 From: Will Sun <30999793+AllForNothing@users.noreply.github.com> Date: Fri, 11 Jun 2021 11:58:43 +0800 Subject: [PATCH] Add validator to destination namespace input (#15120) Signed-off-by: AllForNothing --- .../create-edit-rule/create-edit-rule.component.html | 6 +++--- .../create-edit-rule/create-edit-rule.component.ts | 5 +++++ src/portal/src/i18n/lang/de-de-lang.json | 2 +- src/portal/src/i18n/lang/en-us-lang.json | 4 ++-- src/portal/src/i18n/lang/es-es-lang.json | 3 ++- src/portal/src/i18n/lang/fr-fr-lang.json | 4 ++-- src/portal/src/i18n/lang/pt-br-lang.json | 4 ++-- src/portal/src/i18n/lang/tr-tr-lang.json | 4 ++-- src/portal/src/i18n/lang/zh-cn-lang.json | 4 ++-- src/portal/src/i18n/lang/zh-tw-lang.json | 2 +- 10 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/portal/src/app/base/left-side-nav/replication/replication/create-edit-rule/create-edit-rule.component.html b/src/portal/src/app/base/left-side-nav/replication/replication/create-edit-rule/create-edit-rule.component.html index 563527c1c..7d0336e90 100644 --- a/src/portal/src/app/base/left-side-nav/replication/replication/create-edit-rule/create-edit-rule.component.html +++ b/src/portal/src/app/base/left-side-nav/replication/replication/create-edit-rule/create-edit-rule.component.html @@ -146,7 +146,7 @@
-
+
- - {{'REPLICATION.DESTINATION_NAME_TOOLTIP' | translate}} + + {{'REPLICATION.NAMESPACE_TOOLTIP' | translate}}
diff --git a/src/portal/src/app/base/left-side-nav/replication/replication/create-edit-rule/create-edit-rule.component.ts b/src/portal/src/app/base/left-side-nav/replication/replication/create-edit-rule/create-edit-rule.component.ts index a1605961f..6a599f6a1 100644 --- a/src/portal/src/app/base/left-side-nav/replication/replication/create-edit-rule/create-edit-rule.component.ts +++ b/src/portal/src/app/base/left-side-nav/replication/replication/create-edit-rule/create-edit-rule.component.ts @@ -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; diff --git a/src/portal/src/i18n/lang/de-de-lang.json b/src/portal/src/i18n/lang/de-de-lang.json index 90177032b..e7467afc5 100644 --- a/src/portal/src/i18n/lang/de-de-lang.json +++ b/src/portal/src/i18n/lang/de-de-lang.json @@ -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", diff --git a/src/portal/src/i18n/lang/en-us-lang.json b/src/portal/src/i18n/lang/en-us-lang.json index ebbbafdf0..403bb224f 100644 --- a/src/portal/src/i18n/lang/en-us-lang.json +++ b/src/portal/src/i18n/lang/en-us-lang.json @@ -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", diff --git a/src/portal/src/i18n/lang/es-es-lang.json b/src/portal/src/i18n/lang/es-es-lang.json index 1b43799d6..b182cfb9d 100644 --- a/src/portal/src/i18n/lang/es-es-lang.json +++ b/src/portal/src/i18n/lang/es-es-lang.json @@ -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", diff --git a/src/portal/src/i18n/lang/fr-fr-lang.json b/src/portal/src/i18n/lang/fr-fr-lang.json index 78d176a2c..04eea2bdb 100644 --- a/src/portal/src/i18n/lang/fr-fr-lang.json +++ b/src/portal/src/i18n/lang/fr-fr-lang.json @@ -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", diff --git a/src/portal/src/i18n/lang/pt-br-lang.json b/src/portal/src/i18n/lang/pt-br-lang.json index c3e5bd6ad..c07cb9da6 100644 --- a/src/portal/src/i18n/lang/pt-br-lang.json +++ b/src/portal/src/i18n/lang/pt-br-lang.json @@ -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", diff --git a/src/portal/src/i18n/lang/tr-tr-lang.json b/src/portal/src/i18n/lang/tr-tr-lang.json index 87b4dfae2..078ba32e9 100644 --- a/src/portal/src/i18n/lang/tr-tr-lang.json +++ b/src/portal/src/i18n/lang/tr-tr-lang.json @@ -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", diff --git a/src/portal/src/i18n/lang/zh-cn-lang.json b/src/portal/src/i18n/lang/zh-cn-lang.json index 07af21e58..2c88657f9 100644 --- a/src/portal/src/i18n/lang/zh-cn-lang.json +++ b/src/portal/src/i18n/lang/zh-cn-lang.json @@ -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": "资源", diff --git a/src/portal/src/i18n/lang/zh-tw-lang.json b/src/portal/src/i18n/lang/zh-tw-lang.json index cb8c24f73..a5c12533b 100644 --- a/src/portal/src/i18n/lang/zh-tw-lang.json +++ b/src/portal/src/i18n/lang/zh-tw-lang.json @@ -614,7 +614,7 @@ "SOURCE_NAMESPACES":"源命名空間", "DEST_REGISTRY":"目的註冊表", "DEST_NAMESPACE":"目的名稱空間", - "NAMESPACE_TOOLTIP": "Namespace名稱由小寫字符、數字和._-組成且至少2個字符並以字符或者數字開頭。", + "NAMESPACE_TOOLTIP": "Namespace名稱由小寫字符、數字和._-/組成且至少2個字符並以字符或者數字開頭。", "TAG":"標籤", "LABEL": "標籤", "RESOURCE": "資源",