Skip to content

Commit

Permalink
修改变量名,恢复配置文件,修改changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
piccaSun committed Sep 25, 2023
1 parent 8951ef2 commit a4965f8
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 36 deletions.
5 changes: 3 additions & 2 deletions .changeset/nice-kings-begin.md
Original file line number Diff line number Diff line change
@@ -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 门户系统与管理系统的页面国际化功能
2 changes: 1 addition & 1 deletion apps/auth/src/auth/bindOtpHtml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export async function renderBindOtpHtml(
const authTexts: AuthTextsType = languages[languageId];

Check warning on line 55 in apps/auth/src/auth/bindOtpHtml.ts

View check run for this annotation

Codecov / codecov/patch

apps/auth/src/auth/bindOtpHtml.ts#L54-L55

Added lines #L54 - L55 were not covered by tests

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,
Expand Down
2 changes: 1 addition & 1 deletion apps/auth/src/auth/loginHtml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
24 changes: 12 additions & 12 deletions apps/auth/views/login.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>

<head>
<title>{{ loginTexts.login.login }}</title>
<title>{{ authTexts.login.login }}</title>
<link href="{{ cssUrl }}" rel="stylesheet">
<link rel="icon" type="image/x-icon" href="{{ faviconUrl }}"></link>
<meta name="viewport" content="width=device-width, initial-scale=1">
Expand Down Expand Up @@ -42,31 +42,31 @@
<div class="w-1/2 h-screen ml-20 flex items-center justify-center">
<div class="w-80 max-w-md min-w-max bg-white rounded-lg py-12">
<form method="post" action="">
<div class="mb-16 text-2xl font-semibold text-center">{{ loginTexts.login.accountPasswordLogin }}</div>
<div class="mb-16 text-2xl font-semibold text-center">{{ authTexts.login.accountPasswordLogin }}</div>
<div class="px-14 flex flex-col items-center">
<div class="w-72 mb-10">
<input type='text' name="username" placeholder="{{ loginTexts.login.username }}" required
<input type='text' name="username" placeholder="{{ authTexts.login.username }}" required
class="px-8 w-full border rounded px-3 py-2 text-gray-700 focus:outline-none" />
</div>
<div class="w-72 mb-10">
<div class="relative flex items-center">
<input id="password" name="password" placeholder="{{ loginTexts.login.password }}" type="password" required
<input id="password" name="password" placeholder="{{ authTexts.login.password }}" type="password" required
class="px-8 w-full border rounded px-3 py-2 text-gray-700 focus:outline-none" />
<div id="eye-elem" class="absolute w-5 h-5 right-3 bg-contain"></div>
</div>
</div>
{% if enableTotp %}
<div class="w-full mb-10">
<div class="flex items-center">
<input name="otpCode" placeholder="{{ loginTexts.login.otpVCode }}" type="text" required
<input name="otpCode" placeholder="{{ authTexts.login.otpVCode }}" type="text" required
class="px-8 w-full py-2 border rounded text-gray-700 focus:outline-none"/>
</div>
</div>
{% endif %}
{% if enableCaptcha %}
<div class="w-full mb-10">
<div class="flex items-center">
<input name="code" placeholder="{{ loginTexts.login.inputVCode }}" type="text" required
<input name="code" placeholder="{{ authTexts.login.inputVCode }}" type="text" required
class=" px-8 w-full border rounded px-3 py-2 text-gray-700 focus:outline-none" />
<div id="captcha" onclick="refreshCaptcha()" class="cursor-pointer">{{ code }}</div>
<script>
Expand All @@ -81,15 +81,15 @@
).then( async function (response) {
captchaDiv.innerHTML = await response.text();
}).catch(() => {
captchaDiv.textContent = "{{ loginTexts.login.refreshError }}"
captchaDiv.textContent = "{{ authTexts.login.refreshError }}"
});
}
</script>
</div>
</div>

{% if verifyCaptchaFail %}
<p class="my-4 text-center text-red-600">{{ loginTexts.login.invalidVCode }}</p>
<p class="my-4 text-center text-red-600">{{ authTexts.login.invalidVCode }}</p>
{% endif %}

{% else %}
Expand All @@ -100,21 +100,21 @@
<input type="hidden" name="callbackUrl" value="{{ callbackUrl }}" />

{% if err %}
<p class="my-4 text-center text-red-600">{{ loginTexts.login.invalidInput }}</p>
<p class="my-4 text-center text-red-600">{{ authTexts.login.invalidInput }}</p>
{% endif %}
{% if verifyOtpFail %}
<p class="my-4 text-center text-red-600">{{ loginTexts.login.invalidOtp }}</p>
<p class="my-4 text-center text-red-600">{{ authTexts.login.invalidOtp }}</p>
{% endif %}
<button type="submit" class="w-72 py-2 mb-14 rounded button-primary text-gray-100 focus:outline-none">
{{ loginTexts.login.login }}
{{ authTexts.login.login }}
</button>
</div>
</form>
{% if showBindOtpButton %}
<div class="px-12 mt-4">
<form action="{{ otpBasePath }}/bind" method="get">
<button type="submit" name="action" value="bindOtp" class="px text-gray-400">
{{ loginTexts.login.bindOtp }}
{{ authTexts.login.bindOtp }}
</button>
<input type="hidden" name="callbackUrl" value="{{ callbackUrl }}" />
</form>
Expand Down
30 changes: 15 additions & 15 deletions apps/auth/views/otp/bindOtp.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>

<head>
<title>{{ bindOtpTexts.bindOtp.bindOtp }}</title>
<title>{{ authTexts.bindOtp.bindOtp }}</title>
<link href="{{ cssUrl }}" rel="stylesheet">
<link rel="icon" type="image/x-icon" href="{{ faviconUrl }}"></link>
<meta name="viewport" content="width=device-width, initial-scale=1">
Expand All @@ -17,11 +17,11 @@
<div class="w-full md:w-1/3 bg-white rounded-lg py-4">
<div class="flex mb-4 ml-8 justify-between">
<h2 class="border-b-2 border-red-300 text-2xl text-center text-red-700">
{{ bindOtpTexts.bindOtp.bindOtp }}
{{ authTexts.bindOtp.bindOtp }}
</h2>
<form action="{{ otpBasePath }}/bind" method="get">
<button type="submit" name="action" value="backToLoginUI" class="text-x text-gray-500 mr-4">
{{ bindOtpTexts.bindOtp.returnLogin }}
{{ authTexts.bindOtp.returnLogin }}
</button>
<input type="hidden" name="callbackUrl" value="{{ callbackUrl }}">
</form>
Expand All @@ -31,26 +31,26 @@
<div class="px-8">
<div class="w-full mb-4">
<div class="flex items-center">
<input type='text' name="username" placeholder="{{ bindOtpTexts.bindOtp.userName }}" required
<input type='text' name="username" placeholder="{{ authTexts.bindOtp.userName }}" required
class="-mx-2 px-8 w-full border rounded py-2 text-gray-700 focus:outline-none" />
</div>
</div>
<div class="w-full mb-4">
<div class="flex items-center">
<input name="password" placeholder="{{ bindOtpTexts.bindOtp.password }}" type="password" required
<input name="password" placeholder="{{ authTexts.bindOtp.password }}" type="password" required
class="-mx-2 px-8 w-full border rounded px-3 py-2 text-gray-700 focus:outline-none" />
</div>
</div>
</div>
{% if err %}
<div>
<p class="my-4 text-center text-red-600">{{ bindOtpTexts.bindOtp.invalidUserNamePassword }}</p>
<p class="my-4 text-center text-red-600">{{ authTexts.bindOtp.invalidUserNamePassword }}</p>
</div>
{% endif %}
<div class="flex justify-center">
<button type="submit" name="action" value=""
class="w-1/3 py-2 rounded-full button-primary text-gray-100 focus:outline-none">
{{ bindOtpTexts.bindOtp.confirm }}
{{ authTexts.bindOtp.confirm }}
</button>
</div>
<input type="hidden" name="callbackUrl" value="{{ callbackUrl }}">
Expand All @@ -59,37 +59,37 @@
{% else %}
{% if tokenNotFound %}
<div class="w-full mt-8 mb-8 justify-center items-center">
<p class="text-center text-xl text-red-700"> {{ bindOtpTexts.bindOtp.expiredUserInfo }} </p>
<p class="text-center text-xl text-red-700"> {{ authTexts.bindOtp.expiredUserInfo }} </p>
</div>
{% else %}

<form class="w-full flex flex-wrap" method="post" action="{{ otpBasePath }}/sendEmail">
<div class="w-full mb-8 ml-8 justify-between">
<p class="mt-1">{{ bindOtpTexts.bindOtp.bindLimit1 }}{{ bindLimitMinutes }}{{ bindOtpTexts.bindOtp.bindLimit2 }}</p>
<p class="mt-1">{{ authTexts.bindOtp.bindLimit1 }}{{ bindLimitMinutes }}{{ authTexts.bindOtp.bindLimit2 }}</p>
</div>
<div class="w-full overflow-x-scroll">
<div class="flex w-full mb-4 items-center justify-between">
<div class="flex-grow">
<p class="border-b-2 ml-8">{{ bindOtpTexts.bindOtp.email }}({{ emailAddress }})</p>
<p class="border-b-2 ml-8">{{ authTexts.bindOtp.email }}({{ emailAddress }})</p>
</div>
<div>
<button type="submit" name="action" value="requestValidationMessage"
class="mr-1 text-sm py-1 px-1 rounded-full button-primary text-gray-100 focus:outline-none">
{{ bindOtpTexts.bindOtp.getBindLink }}
{{ authTexts.bindOtp.getBindLink }}
</button>
</div>
</div>
{% if sendSucceeded == true%}
<div class="flex items-center justify-between mb-4 mt-6">
<p class="ml-8"> {{ bindOtpTexts.bindOtp.bindLinkSended }} </p>
<p class="ml-8"> {{ authTexts.bindOtp.bindLinkSended }} </p>
</div>
{% elsif sendSucceeded == false%}
<div class="flex items-center justify-between mb-4 mt-6">
<p class="ml-8" id="countdown"> {{ bindOtpTexts.bindOtp.bindLinkFailed1 }}{{ timeDiffNotEnough }}{{ bindOtpTexts.bindOtp.bindLinkFailed2 }} </p>
<p class="ml-8" id="countdown"> {{ authTexts.bindOtp.bindLinkFailed1 }}{{ timeDiffNotEnough }}{{ authTexts.bindOtp.bindLinkFailed2 }} </p>
</div>
{% elsif timeDiffNotEnough %}
<div class="flex items-center justify-between mb-4 mt-6">
<p class="ml-8 text-red" id="countdown"> {{ bindOtpTexts.bindOtp.bindRequestError1 }}{{ timeDiffNotEnough }}{{ bindOtpTexts.bindOtp.bindRequestError2 }} </p>
<p class="ml-8 text-red" id="countdown"> {{ authTexts.bindOtp.bindRequestError1 }}{{ timeDiffNotEnough }}{{ authTexts.bindOtp.bindRequestError2 }} </p>
</div>
{% endif %}
{% endif %}
Expand All @@ -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);
}
Expand Down
10 changes: 5 additions & 5 deletions dev/vagrant/config/auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ ui:
# 登录界面 slogan 文字颜色
color: "white"
# 登录界面 slogan title
# title: "开源算力中心门户和管理平台"
title:
i18n:
default: "开源算力中心门户和管理平台"
zh_cn: "开源算力中心门户和管理平台"
title: "开源算力中心门户和管理平台"
# title:
# i18n:
# default: "开源算力中心门户和管理平台"
# zh_cn: "开源算力中心门户和管理平台"
# 多条 slogan 文本
texts:
- "图形化界面,使用方便"
Expand Down
10 changes: 10 additions & 0 deletions dev/vagrant/config/clusters/hpc01.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
21 changes: 21 additions & 0 deletions dev/vagrant/config/mis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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<number>;
# # JobInfo为apps/mis-server/src/bl/PriceMap.ts中的JobInfo类型,提供作业的用量信息
# script: "my-strategy.js"

# 自定义可查询消费类型
# customChargeTypes: ["月租", "存储费"]
Original file line number Diff line number Diff line change
Expand Up @@ -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** |
Expand Down

0 comments on commit a4965f8

Please sign in to comment.