feat: config goedge api user role
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Form, type FormInstance, Input, Switch } from "antd";
|
||||
import { Form, type FormInstance, Input, Radio, Switch } from "antd";
|
||||
import { createSchemaFieldRule } from "antd-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
@@ -18,6 +18,7 @@ export type AccessFormGoEdgeConfigProps = {
|
||||
const initFormModel = (): AccessFormGoEdgeConfigFieldValues => {
|
||||
return {
|
||||
apiUrl: "http://<your-host-addr>:7788/",
|
||||
apiRole: "user",
|
||||
accessKeyId: "",
|
||||
accessKey: "",
|
||||
};
|
||||
@@ -28,6 +29,9 @@ const AccessFormGoEdgeConfig = ({ form: formInst, formName, disabled, initialVal
|
||||
|
||||
const formSchema = z.object({
|
||||
apiUrl: z.string().url(t("common.errmsg.url_invalid")),
|
||||
role: z.union([z.literal("user"), z.literal("admin")], {
|
||||
message: t("access.form.goedge_api_role.placeholder"),
|
||||
}),
|
||||
accessKeyId: z
|
||||
.string()
|
||||
.min(1, t("access.form.goedge_access_key_id.placeholder"))
|
||||
@@ -59,6 +63,10 @@ const AccessFormGoEdgeConfig = ({ form: formInst, formName, disabled, initialVal
|
||||
<Input placeholder={t("access.form.goedge_api_url.placeholder")} />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item name="apiRole" label={t("access.form.goedge_api_role.label")} rules={[formRule]}>
|
||||
<Radio.Group options={["user", "admin"].map((s) => ({ label: t(`access.form.goedge_api_role.option.${s}.label`), value: s }))} />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
name="accessKeyId"
|
||||
label={t("access.form.goedge_access_key_id.label")}
|
||||
|
||||
@@ -199,6 +199,7 @@ export type AccessConfigForGoDaddy = {
|
||||
|
||||
export type AccessConfigForGoEdge = {
|
||||
apiUrl: string;
|
||||
apiRole: string;
|
||||
accessKeyId: string;
|
||||
accessKey: string;
|
||||
allowInsecureConnections?: boolean;
|
||||
|
||||
@@ -201,11 +201,15 @@
|
||||
"access.form.godaddy_api_secret.tooltip": "For more information, see <a href=\"https://developer.godaddy.com/\" target=\"_blank\">https://developer.godaddy.com/</a>",
|
||||
"access.form.goedge_api_url.label": "GoEdge API URL",
|
||||
"access.form.goedge_api_url.placeholder": "Please enter GoEdge API URL",
|
||||
"access.form.goedge_access_key_id.label": "GoEdge user AccessKeyId",
|
||||
"access.form.goedge_access_key_id.placeholder": "Please enter GoEdge user AccessKeyId",
|
||||
"access.form.goedge_api_role.label": "GoEdge user role",
|
||||
"access.form.goedge_api_role.placeholder": "Please select GoEdge user role",
|
||||
"access.form.goedge_api_role.option.user.label": "Platform user",
|
||||
"access.form.goedge_api_role.option.admin.label": "Administrator user",
|
||||
"access.form.goedge_access_key_id.label": "GoEdge AccessKeyId",
|
||||
"access.form.goedge_access_key_id.placeholder": "Please enter GoEdge AccessKeyId",
|
||||
"access.form.goedge_access_key_id.tooltip": "For more information, see <a href=\"https://goedge.cloud/docs/API/Auth.md\" target=\"_blank\">https://goedge.cloud/docs/API/Auth.md</a>",
|
||||
"access.form.goedge_access_key.label": "GoEdge user AccessKey",
|
||||
"access.form.goedge_access_key.placeholder": "Please enter GoEdge user AccessKey",
|
||||
"access.form.goedge_access_key.label": "GoEdge AccessKey",
|
||||
"access.form.goedge_access_key.placeholder": "Please enter GoEdge AccessKey",
|
||||
"access.form.goedge_access_key.tooltip": "For more information, see <a href=\"https://goedge.cloud/docs/API/Auth.md\" target=\"_blank\">https://goedge.cloud/docs/API/Auth.md</a>",
|
||||
"access.form.goedge_allow_insecure_conns.label": "Insecure SSL/TLS connections",
|
||||
"access.form.goedge_allow_insecure_conns.switch.on": "Allow",
|
||||
|
||||
@@ -195,11 +195,15 @@
|
||||
"access.form.godaddy_api_secret.tooltip": "这是什么?请参阅 <a href=\"https://developer.godaddy.com/\" target=\"_blank\">https://developer.godaddy.com/</a>",
|
||||
"access.form.goedge_api_url.label": "GoEdge API URL",
|
||||
"access.form.goedge_api_url.placeholder": "请输入 GoEdge API URL",
|
||||
"access.form.goedge_access_key_id.label": "GoEdge 用户 AccessKeyId",
|
||||
"access.form.goedge_access_key_id.placeholder": "请输入 GoEdge 用户 AccessKeyId",
|
||||
"access.form.goedge_api_role.label": "GoEdge 用户角色",
|
||||
"access.form.goedge_api_role.placeholder": "请选择 GoEdge 用户角色",
|
||||
"access.form.goedge_api_role.option.user.label": "平台用户",
|
||||
"access.form.goedge_api_role.option.admin.label": "系统管理员",
|
||||
"access.form.goedge_access_key_id.label": "GoEdge AccessKeyId",
|
||||
"access.form.goedge_access_key_id.placeholder": "请输入 GoEdge AccessKeyId",
|
||||
"access.form.goedge_access_key_id.tooltip": "这是什么?请参阅 <a href=\"https://goedge.cloud/docs/API/Auth.md\" target=\"_blank\">https://goedge.cloud/docs/API/Auth.md</a>",
|
||||
"access.form.goedge_access_key.label": "GoEdge 用户 AccessKey",
|
||||
"access.form.goedge_access_key.placeholder": "请输入 GoEdge 用户 AccessKey",
|
||||
"access.form.goedge_access_key.label": "GoEdge AccessKey",
|
||||
"access.form.goedge_access_key.placeholder": "请输入 GoEdge AccessKey",
|
||||
"access.form.goedge_access_key.tooltip": "这是什么?请参阅 <a href=\"https://goedge.cloud/docs/API/Auth.md\" target=\"_blank\">https://goedge.cloud/docs/API/Auth.md</a>",
|
||||
"access.form.goedge_allow_insecure_conns.label": "忽略 SSL/TLS 证书错误",
|
||||
"access.form.goedge_allow_insecure_conns.switch.on": "允许",
|
||||
|
||||
Reference in New Issue
Block a user