From a4965f8dd9d27f0139f58c6af8708d721befd6fb Mon Sep 17 00:00:00 2001 From: picca Sun Date: Mon, 25 Sep 2023 12:08:20 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=98=E9=87=8F=E5=90=8D?= =?UTF-8?q?=EF=BC=8C=E6=81=A2=E5=A4=8D=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9changeset?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/nice-kings-begin.md | 5 ++-- apps/auth/src/auth/bindOtpHtml.ts | 2 +- apps/auth/src/auth/loginHtml.ts | 2 +- apps/auth/views/login.liquid | 24 +++++++-------- apps/auth/views/otp/bindOtp.liquid | 30 +++++++++---------- dev/vagrant/config/auth.yml | 10 +++---- dev/vagrant/config/clusters/hpc01.yaml | 10 +++++++ dev/vagrant/config/mis.yaml | 21 +++++++++++++ .../customization/custom-config-i18n.md | 1 + 9 files changed, 69 insertions(+), 36 deletions(-) diff --git a/.changeset/nice-kings-begin.md b/.changeset/nice-kings-begin.md index 9b603c6726..2d6cde6705 100644 --- a/.changeset/nice-kings-begin.md +++ b/.changeset/nice-kings-begin.md @@ -1,11 +1,12 @@ --- -"@scow/portal-server": minor +"@scow/portal-server": patch "@scow/portal-web": minor "@scow/mis-web": minor -"@scow/lib-server": minor +"@scow/lib-server": patch "@scow/auth": minor "@scow/lib-web": minor "@scow/docs": patch +"@scow/test-adapter": patch --- 实现 SCOW 门户系统与管理系统的页面国际化功能 diff --git a/apps/auth/src/auth/bindOtpHtml.ts b/apps/auth/src/auth/bindOtpHtml.ts index f59f762452..7e3b3251ed 100644 --- a/apps/auth/src/auth/bindOtpHtml.ts +++ b/apps/auth/src/auth/bindOtpHtml.ts @@ -55,7 +55,7 @@ export async function renderBindOtpHtml( const authTexts: AuthTextsType = languages[languageId]; return rep.status(err ? 401 : 200).view("/otp/bindOtp.liquid", { - bindOtpTexts: authTexts, + authTexts: authTexts, cssUrl: join(config.BASE_PATH, config.AUTH_BASE_PATH, "/public/assets/tailwind.min.css"), faviconUrl: join(config.BASE_PATH, FAVICON_URL), backgroundColor: uiConfig.primaryColor?.defaultColor ?? DEFAULT_PRIMARY_COLOR, diff --git a/apps/auth/src/auth/loginHtml.ts b/apps/auth/src/auth/loginHtml.ts index 5e8cb0822f..1190265aa7 100644 --- a/apps/auth/src/auth/loginHtml.ts +++ b/apps/auth/src/auth/loginHtml.ts @@ -50,7 +50,7 @@ export async function serveLoginHtml( return rep.status( verifyCaptchaFail ? 400 : err ? 401 : 200).view("login.liquid", { - loginTexts: authTexts, + authTexts: authTexts, cssUrl: join(config.BASE_PATH, config.AUTH_BASE_PATH, "/public/assets/tailwind.min.css"), eyeImagePath: join(config.BASE_PATH, config.AUTH_BASE_PATH, "/public/assets/icons/eye.png"), eyeCloseImagePath: join(config.BASE_PATH, config.AUTH_BASE_PATH, "/public/assets/icons/eye-close.png"), diff --git a/apps/auth/views/login.liquid b/apps/auth/views/login.liquid index f2a990bcda..7f169f2844 100644 --- a/apps/auth/views/login.liquid +++ b/apps/auth/views/login.liquid @@ -2,7 +2,7 @@ - {{ loginTexts.login.login }} + {{ authTexts.login.login }} @@ -42,15 +42,15 @@
-
{{ loginTexts.login.accountPasswordLogin }}
+
{{ authTexts.login.accountPasswordLogin }}
-
-
@@ -58,7 +58,7 @@ {% if enableTotp %}
-
@@ -66,7 +66,7 @@ {% if enableCaptcha %}
-
{{ code }}
@@ -89,7 +89,7 @@
{% if verifyCaptchaFail %} -

{{ loginTexts.login.invalidVCode }}

+

{{ authTexts.login.invalidVCode }}

{% endif %} {% else %} @@ -100,13 +100,13 @@ {% if err %} -

{{ loginTexts.login.invalidInput }}

+

{{ authTexts.login.invalidInput }}

{% endif %} {% if verifyOtpFail %} -

{{ loginTexts.login.invalidOtp }}

+

{{ authTexts.login.invalidOtp }}

{% endif %}
@@ -114,7 +114,7 @@
diff --git a/apps/auth/views/otp/bindOtp.liquid b/apps/auth/views/otp/bindOtp.liquid index b08e482ee4..2344cc22dc 100644 --- a/apps/auth/views/otp/bindOtp.liquid +++ b/apps/auth/views/otp/bindOtp.liquid @@ -2,7 +2,7 @@ - {{ bindOtpTexts.bindOtp.bindOtp }} + {{ authTexts.bindOtp.bindOtp }} @@ -17,11 +17,11 @@

- {{ bindOtpTexts.bindOtp.bindOtp }} + {{ authTexts.bindOtp.bindOtp }}

@@ -31,26 +31,26 @@
-
-
{% if err %}
-

{{ bindOtpTexts.bindOtp.invalidUserNamePassword }}

+

{{ authTexts.bindOtp.invalidUserNamePassword }}

{% endif %}
@@ -59,37 +59,37 @@ {% else %} {% if tokenNotFound %}
-

{{ bindOtpTexts.bindOtp.expiredUserInfo }}

+

{{ authTexts.bindOtp.expiredUserInfo }}

{% else %}
-

{{ bindOtpTexts.bindOtp.bindLimit1 }}{{ bindLimitMinutes }}{{ bindOtpTexts.bindOtp.bindLimit2 }}

+

{{ authTexts.bindOtp.bindLimit1 }}{{ bindLimitMinutes }}{{ authTexts.bindOtp.bindLimit2 }}

-

{{ bindOtpTexts.bindOtp.email }}({{ emailAddress }})

+

{{ authTexts.bindOtp.email }}({{ emailAddress }})

{% if sendSucceeded == true%}
-

{{ bindOtpTexts.bindOtp.bindLinkSended }}

+

{{ authTexts.bindOtp.bindLinkSended }}

{% elsif sendSucceeded == false%}
-

{{ bindOtpTexts.bindOtp.bindLinkFailed1 }}{{ timeDiffNotEnough }}{{ bindOtpTexts.bindOtp.bindLinkFailed2 }}

+

{{ authTexts.bindOtp.bindLinkFailed1 }}{{ timeDiffNotEnough }}{{ authTexts.bindOtp.bindLinkFailed2 }}

{% elsif timeDiffNotEnough %}
-

{{ bindOtpTexts.bindOtp.bindRequestError1 }}{{ timeDiffNotEnough }}{{ bindOtpTexts.bindOtp.bindRequestError2 }}

+

{{ authTexts.bindOtp.bindRequestError1 }}{{ timeDiffNotEnough }}{{ authTexts.bindOtp.bindRequestError2 }}

{% endif %} {% endif %} @@ -102,7 +102,7 @@ count--; if (count < 0.5) { clearInterval(countdown); - countDownElement.innerHTML = "{{ bindOtpTexts.bindOtp.reRequestLink }}"; + countDownElement.innerHTML = "{{ authTexts.bindOtp.reRequestLink }}"; } else { countDownElement.innerHTML = countDownElement.innerText.replace(/\d+/, count); } diff --git a/dev/vagrant/config/auth.yml b/dev/vagrant/config/auth.yml index 6740f20bf1..7d7b6b7618 100644 --- a/dev/vagrant/config/auth.yml +++ b/dev/vagrant/config/auth.yml @@ -166,11 +166,11 @@ ui: # 登录界面 slogan 文字颜色 color: "white" # 登录界面 slogan title - # title: "开源算力中心门户和管理平台" - title: - i18n: - default: "开源算力中心门户和管理平台" - zh_cn: "开源算力中心门户和管理平台" + title: "开源算力中心门户和管理平台" + # title: + # i18n: + # default: "开源算力中心门户和管理平台" + # zh_cn: "开源算力中心门户和管理平台" # 多条 slogan 文本 texts: - "图形化界面,使用方便" diff --git a/dev/vagrant/config/clusters/hpc01.yaml b/dev/vagrant/config/clusters/hpc01.yaml index 8049387ec8..f65f578a29 100644 --- a/dev/vagrant/config/clusters/hpc01.yaml +++ b/dev/vagrant/config/clusters/hpc01.yaml @@ -1,11 +1,21 @@ # 集群显示名称 displayName: hpc01 +# displayName: +# i18n: +# default: 集群1 +# en: Cluster One +# zh_cn: 集群1 adapterUrl: "192.168.88.101:8972" loginNodes: # 登录节点展示名称 - name: login + # - name: + # i18n: + # default: 登录节点1 + # en: loginNode1 + # zh_cn: 登录节点1 # 登录节点的IP或者域名 # 如果设置的是域名,请确认此节点的/etc/hosts中包含了域名到IP的解析信息 address: 192.168.88.102 diff --git a/dev/vagrant/config/mis.yaml b/dev/vagrant/config/mis.yaml index b8c9cbd4f3..483c17650d 100644 --- a/dev/vagrant/config/mis.yaml +++ b/dev/vagrant/config/mis.yaml @@ -90,3 +90,24 @@ createUser: # url: "https://hahahaha3.1.com" # # openInNewPage: true # iconPath: "" + +# # 新增自定义收费规则 +# customAmountStrategies: +# # 计费方式id,请勿重复,重复的话后面的计费方式将会覆盖前面的, +# # 定义后不能更改,自定义计费项会记录所使用的计费方式id,并存储到数据库里, +# # 其作用与"max-cpusAlloc-mem", "max-gpu-cpusAlloc", "gpu", "cpusAlloc"等同, +# # 若当前生效的自定义计费项使用了某自定义计费方式id,你不能删除它,否则系统将无法启动,如要删除,请先使该计费项失效 +# - id: "strategy1" +# # 可选,新的计量方式的显示名称,如不填写将使用id的内容 +# name: "自定义收费计算方式1" +# # 可选,计量方式描述 +# comment: "自定义收费计算方式1,运行时间低于3分钟以下的作业不计费,大于或等于3分钟的按照gpu或cpu用量计算" +# # 脚本文件路径,不包含config/scripts前缀,如my-strategy.js即等于config/scripts/my-strategy.js +# # 支持commonjs或者esm,内容不支持动态修改,修改后需重启系统 +# # 自定义计量方式的文件应该默认导出一个如下签名的函数: +# # type CustomAmountStrategyFunction = (jobInfo: JobInfo) => number | Promise; +# # JobInfo为apps/mis-server/src/bl/PriceMap.ts中的JobInfo类型,提供作业的用量信息 +# script: "my-strategy.js" + +# 自定义可查询消费类型 +# customChargeTypes: ["月租", "存储费"] diff --git a/docs/docs/deploy/config/customization/custom-config-i18n.md b/docs/docs/deploy/config/customization/custom-config-i18n.md index ed2319753d..ab013af72c 100644 --- a/docs/docs/deploy/config/customization/custom-config-i18n.md +++ b/docs/docs/deploy/config/customization/custom-config-i18n.md @@ -57,6 +57,7 @@ homeTitle: | `mis.yaml` | `createUser:userIdPattern:` **errorMessage** | | `portal.yaml` | `homeTitle:`**defaultText** | | `portal.yaml` | `homeText:` **defaultText** | +| `portal.yaml` | **submitJobPromptText** | | `{cluster}.yaml` | **displayName** | | `{cluster}.yaml` | `loginNodes:` **name** | | `{app}.yaml` | `attributes:` **label** |