From b159b8a85c430969706dffd1cc41e3f511f42f8c Mon Sep 17 00:00:00 2001 From: BennieMeng Date: Thu, 13 Dec 2018 16:49:48 +0800 Subject: [PATCH 1/4] Prompt the user background to assign Namespace machine room --- .../create-edit-configmaptpl.component.html | 1 + .../create-edit-cronjob.component.html | 1 + .../create-edit-daemonset.component.html | 1 + .../create-edit-deployment.component.html | 1 + .../create-edit-ingress.component.html | 1 + ...it-persistentvolumeclaimtpl.component.html | 1 + .../create-edit-secrettpl.component.html | 1 + .../create-edit-statefulset.component.html | 1 + src/frontend/src/assets/i18n/zh-Hans.json | 42 +++++++++++++++---- src/frontend/src/styles.scss | 4 ++ 10 files changed, 46 insertions(+), 8 deletions(-) diff --git a/src/frontend/src/app/portal/configmap/create-edit-configmaptpl/create-edit-configmaptpl.component.html b/src/frontend/src/app/portal/configmap/create-edit-configmaptpl/create-edit-configmaptpl.component.html index d8aec231e..0e36c2f19 100644 --- a/src/frontend/src/app/portal/configmap/create-edit-configmaptpl/create-edit-configmaptpl.component.html +++ b/src/frontend/src/app/portal/configmap/create-edit-configmaptpl/create-edit-configmaptpl.component.html @@ -6,6 +6,7 @@

{{'CONFIGMAP.CREATE_TMP' | translate}}

+ {{'CONFIGMAP.CREATE_EDIT_TMP.CLUSTER_MESSAGE' | translate}}
diff --git a/src/frontend/src/app/portal/cronjob/create-edit-cronjob/create-edit-cronjob.component.html b/src/frontend/src/app/portal/cronjob/create-edit-cronjob/create-edit-cronjob.component.html index e78431474..47d133f25 100644 --- a/src/frontend/src/app/portal/cronjob/create-edit-cronjob/create-edit-cronjob.component.html +++ b/src/frontend/src/app/portal/cronjob/create-edit-cronjob/create-edit-cronjob.component.html @@ -25,6 +25,7 @@
+ {{'CRONJOB.CREATE_EDIT.CLUSTER_MESSAGE' | translate}}
{{title | translate}}
+ {{'DAEMONSET.CREATE_EDIT.CLUSTER_MESSAGE' | translate}}
{{title}}
+ {{'DEPLOYMENT.CREATE_EDIT.CLUSTER_MESSAGE' | translate}}
{{title}}
+ {{'INGRESS.CREATE_EDIT.CLUSTER_MESSAGE' | translate}}
{{'PVC.CREATE_TMP' | translate}}
+ {{'PVC.CREATE_EDIT.CLUSTER_MESSAGE' | translate}}
diff --git a/src/frontend/src/app/portal/secret/create-edit-secrettpl/create-edit-secrettpl.component.html b/src/frontend/src/app/portal/secret/create-edit-secrettpl/create-edit-secrettpl.component.html index fb0aa61c7..c3810baae 100644 --- a/src/frontend/src/app/portal/secret/create-edit-secrettpl/create-edit-secrettpl.component.html +++ b/src/frontend/src/app/portal/secret/create-edit-secrettpl/create-edit-secrettpl.component.html @@ -6,6 +6,7 @@

{{'SECRET.CREATE_TMP' | translate}}

+ {{'SECRET.CREATE_EDIT.CLUSTER_MESSAGE' | translate}}
diff --git a/src/frontend/src/app/portal/statefulset/create-edit-statefulset/create-edit-statefulset.component.html b/src/frontend/src/app/portal/statefulset/create-edit-statefulset/create-edit-statefulset.component.html index fc04bca7c..27340997b 100644 --- a/src/frontend/src/app/portal/statefulset/create-edit-statefulset/create-edit-statefulset.component.html +++ b/src/frontend/src/app/portal/statefulset/create-edit-statefulset/create-edit-statefulset.component.html @@ -28,6 +28,7 @@
+ {{'STATEFULSET.CREATE_EDIT.CLUSTER_MESSAGE' | translate}}
Date: Fri, 14 Dec 2018 14:58:01 +0800 Subject: [PATCH 2/4] frontend: add ignore rule of i18n format --- src/frontend/lang.js | 7 +++++++ src/frontend/src/assets/i18n/zh-Hans.json | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/frontend/lang.js b/src/frontend/lang.js index a264aaf01..16d70c17d 100644 --- a/src/frontend/lang.js +++ b/src/frontend/lang.js @@ -43,9 +43,16 @@ if (process.argv[2] === 'format') { } if (process.argv[3] === 'zh-Hans') { const filePath = path.resolve(__dirname, 'src/assets/i18n', 'zh-Hans.json'); + const enSet = new Set(['CPU']); const result = JSON.stringify(defaultValue, null, 2).replace(/([\u4e00-\u9fa5]+)([a-zA-Z]+)/g, function (match, $1, $2) { + if (enSet.has($2)) { + return match + } return $1 + ' ' + $2; }).replace(/([a-zA-Z]+)([\u4e00-\u9fa5]+)/g, function (match, $1, $2) { + if (enSet.has($1)) { + return match; + } return $1 + ' ' + $2; }); fs.writeFile(filePath, result, err => { diff --git a/src/frontend/src/assets/i18n/zh-Hans.json b/src/frontend/src/assets/i18n/zh-Hans.json index 8dcd7f8f2..d0381f8b6 100644 --- a/src/frontend/src/assets/i18n/zh-Hans.json +++ b/src/frontend/src/assets/i18n/zh-Hans.json @@ -141,8 +141,8 @@ "CREATE_APP": "创建项目", "DEPARTMENT_NAME": "部门名称", "CREATE_TIME": "创建时间", - "CPU_USAGE": "CPU 使用(核)", - "CPU_USAGE_SHORT": "CPU 使用(核)", + "CPU_USAGE": "CPU使用(核)", + "CPU_USAGE_SHORT": "CPU使用(核)", "MEMORY_USAGE": "内存使用(G)", "MEMORY_USAGE_SHORT": "内存使用(G)", "DEPLOY_FREQ": "部署上线频数", From 628fdcac6680906316fb3cd5375caf50cac7efea Mon Sep 17 00:00:00 2001 From: BennieMeng Date: Fri, 14 Dec 2018 15:09:18 +0800 Subject: [PATCH 3/4] frontend: add format --- src/frontend/lang.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/frontend/lang.js b/src/frontend/lang.js index 16d70c17d..f5c0e1326 100644 --- a/src/frontend/lang.js +++ b/src/frontend/lang.js @@ -43,14 +43,16 @@ if (process.argv[2] === 'format') { } if (process.argv[3] === 'zh-Hans') { const filePath = path.resolve(__dirname, 'src/assets/i18n', 'zh-Hans.json'); - const enSet = new Set(['CPU']); + const enSet = new Set([]); + const zhSet = new Set([]); + const matchSet = new Set(['CPU使用']); const result = JSON.stringify(defaultValue, null, 2).replace(/([\u4e00-\u9fa5]+)([a-zA-Z]+)/g, function (match, $1, $2) { - if (enSet.has($2)) { + if (matchSet.has(match) || zhSet.has($1) || enSet.has($2)) { return match } return $1 + ' ' + $2; }).replace(/([a-zA-Z]+)([\u4e00-\u9fa5]+)/g, function (match, $1, $2) { - if (enSet.has($1)) { + if (matchSet.has(match) || zhSet.has($2) || enSet.has($1)) { return match; } return $1 + ' ' + $2; From 302131f4f3dfec8f4959e4948320df77923a6b5d Mon Sep 17 00:00:00 2001 From: BennieMeng Date: Fri, 14 Dec 2018 07:48:24 +0000 Subject: [PATCH 4/4] frontend: update zh-Hans.json --- src/frontend/src/assets/i18n/zh-Hans.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/frontend/src/assets/i18n/zh-Hans.json b/src/frontend/src/assets/i18n/zh-Hans.json index d0381f8b6..cb4898b34 100644 --- a/src/frontend/src/assets/i18n/zh-Hans.json +++ b/src/frontend/src/assets/i18n/zh-Hans.json @@ -351,7 +351,7 @@ "EDIT": "编辑状态副本集", "DELETE": "删除状态副本集", "CREATE_EDIT": { - "CLUSTER_MESSAGE": "需要先在后台配置 Namespace 可用集群才可以创建部署" + "CLUSTER_MESSAGE": "需要先在后台配置 Namespace 可用集群才可以创建状态副本集" } }, "DAEMONSET": { @@ -360,7 +360,7 @@ "EDIT": "编辑守护进程集", "DELETE": "删除守护进程集", "CREATE_EDIT": { - "CLUSTER_MESSAGE": "需要先在后台配置 Namespace 可用集群才可以创建部署" + "CLUSTER_MESSAGE": "需要先在后台配置 Namespace 可用集群才可以创建守护进程集" } }, "CRONJOB": { @@ -369,7 +369,7 @@ "EDIT": "编辑计划任务", "DELETE": "删除计划任务", "CREATE_EDIT": { - "CLUSTER_MESSAGE": "需要先在后台配置 Namespace 可用集群才可以创建部署" + "CLUSTER_MESSAGE": "需要先在后台配置 Namespace 可用集群才可以创建计划任务" }, "LIST": "计划任务列表", "DELETE_LIST": "已删除计划任务列表", @@ -391,7 +391,7 @@ }, "INGRESS": { "CREATE_EDIT": { - "CLUSTER_MESSAGE": "需要先在后台配置 Namespace 可用集群才可以创建部署" + "CLUSTER_MESSAGE": "需要先在后台配置 Namespace 可用集群才可以创建 Ingress" } }, "CONFIGMAP": { @@ -400,7 +400,7 @@ "EDIT": "编辑配置集", "DELETE": "删除配置集", "CREATE_EDIT_TMP": { - "CLUSTER_MESSAGE": "需要先在后台配置 Namespace 可用集群才可以创建部署" + "CLUSTER_MESSAGE": "需要先在后台配置 Namespace 可用集群才可以创建配置集" } }, "SECRET": { @@ -409,7 +409,7 @@ "EDIT": "编辑加密字典", "DELETE": "删除加密字典", "CREATE_EDIT_TMP": { - "CLUSTER_MESSAGE": "需要先在后台配置 Namespace 可用集群才可以创建部署" + "CLUSTER_MESSAGE": "需要先在后台配置 Namespace 可用集群才可以创建加密字典" } }, "PVC": { @@ -439,7 +439,7 @@ "ROLLBACK_SNAPSHOOT": "回滚快照", "RECORD": "共{{value}}条快照记录", "CREATE_EDIT_TMP": { - "CLUSTER_MESSAGE": "需要先在后台配置 Namespace 可用集群才可以创建部署" + "CLUSTER_MESSAGE": "需要先在后台配置 Namespace 可用集群才可以创建 PVC" } }, "WEBHOOK": { @@ -451,4 +451,4 @@ }, "OTHER": "其他", "OF": "的" -} \ No newline at end of file +}