i18n: edit policy in pro mode

This commit is contained in:
HFO4 2022-07-07 20:07:20 +08:00
parent 8286e67cea
commit a8fd669d84
3 changed files with 165 additions and 87 deletions

View File

@ -489,6 +489,53 @@
"selectRegionDes": "Select the region where the storage bucket is located or enter the region code manually.",
"enterAccessCredentials": "Obtain a pair of access credential and fill in below:",
"accessKey": "AccessKey",
"chunkSizeLabelS3": "Specify the chunk size for resumable uploads. Allowed range is 5 MB - 5 GB."
"chunkSizeLabelS3": "Specify the chunk size for resumable uploads. Allowed range is 5 MB - 5 GB.",
"editPolicy": "Edit storage policy",
"setting":"Setting name",
"value": "Value",
"description": "Description",
"id": "ID",
"policyID": "ID of storage policy.",
"policyType": "Type of storage policy.",
"server": "Server",
"policyEndpoint": "Storage node endpoint.",
"bucketID": "Identifier of storage bucket.",
"yes": "Yes",
"no": "No",
"privateBucketDes": "Whether the storage bucket is private.",
"resourceRootURL": "File resource root URL",
"resourceRootURLDes": "Prefix of URL generated for previewing and downloading.",
"akDes": "AccessKey / RefreshToken",
"maxSizeBytes": "Max single file size (Bytes)",
"maxSizeBytesDes": "Max file size can be uploaded, 0 means no limit.",
"autoRename": "Auto rename",
"autoRenameDes": "Whether to automatically rename files.",
"storagePath": "Storage path",
"storagePathDes": "Physical path of uploaded files.",
"fileName": "File name",
"fileNameDes": "Physical name of uploaded files.",
"allowGetSourceLink": "Allow getting source link",
"allowGetSourceLinkDes": "Whether to allow getting source links. Note that some storage policy types are not supported, and even if they are turned on here, the obtained source links will be invalid.",
"upyunToken": "Upyun anti-hotlinking token",
"upyunOnly": "Available only for Upyun policy.",
"allowedFileExtension": "Allowed file extensions",
"emptyIsNoLimit": "Blank means not limit.",
"allowedMimetype": "Allowed MimeType",
"qiniuOnly": "Available only for Qiniu policy.",
"odRedirectURL": "OneDrive redirect URL",
"noModificationNeeded": "Generally no modification is needed.",
"odReverseProxy": "OneDrive reverse proxy server",
"odOnly": "Available only for OneDrive policy.",
"odDriverID": "OneDrive/SharePoint driver ID",
"odDriverIDDes": "Available only for OneDrive policy, blank means use default OneDrive driver.",
"s3Region": "Amazon S3 Region",
"s3Only": "Available only for AWS S3 policy.",
"lanEndpoint": "Intranet EndPoint.",
"ossOnly": "Available only for OSS policy.",
"chunkSizeBytes": "Chunk size (Bytes)",
"chunkSizeBytesDes": "Size of chunk for resumable uploads. Only supported in partial storage policy.",
"placeHolderWithSize": "Use placeholder before uploading",
"placeHolderWithSizeDes": "Whether to create a placeholder file before uploading .Only supported in partial storage policy.",
"saveChanges": "Save changes"
}
}

View File

@ -488,6 +488,53 @@
"selectRegionDes": "选择存储桶所在的区域,或者手动输入区域代码",
"enterAccessCredentials": "获取访问密钥,并填写在下方。",
"accessKey": "AccessKey",
"chunkSizeLabelS3": "请指定分片上传时的分片大小,范围 5 MB ~ 5 GB。"
"chunkSizeLabelS3": "请指定分片上传时的分片大小,范围 5 MB ~ 5 GB。",
"editPolicy": "编辑存储策略",
"setting":"设置项",
"value": "值",
"description": "描述",
"id": "ID",
"policyID": "存储策略编号",
"policyType": "存储策略类型",
"server": "Server",
"policyEndpoint": "存储端 Endpoint",
"bucketID": "存储桶标识",
"yes": "是",
"no": "否",
"privateBucketDes": "是否为私有空间",
"resourceRootURL": "文件资源根 URL",
"resourceRootURLDes": "预览/获取文件外链时生成 URL 的前缀",
"akDes": "AccessKey / 刷新 Token",
"maxSizeBytes": "最大单文件尺寸 (Bytes)",
"maxSizeBytesDes": "最大可上传的文件尺寸,填写为 0 表示不限制",
"autoRename": "自动重命名",
"autoRenameDes": "是否根据规则对上传物理文件重命名",
"storagePath": "存储路径",
"storagePathDes": "文件物理存储路径",
"fileName": "存储文件名",
"fileNameDes": "文件物理存储文件名",
"allowGetSourceLink": "允许获取外链",
"allowGetSourceLinkDes": "是否允许获取外链。注意,某些存储策略类型不支持,即使在此开启,获取的外链也无法使用",
"upyunToken": "又拍云防盗链 Token",
"upyunOnly": "仅对又拍云存储策略有效",
"allowedFileExtension": "允许文件扩展名",
"emptyIsNoLimit": "留空表示不限制",
"allowedMimetype": "允许的 MimeType",
"qiniuOnly": "仅对七牛存储策略有效",
"odRedirectURL": "OneDrive 重定向地址",
"noModificationNeeded": "一般添加后无需修改",
"odReverseProxy": "OneDrive 反代服务器地址",
"odOnly": "仅对 OneDrive 存储策略有效",
"odDriverID": "OneDrive/SharePoint 驱动器资源标识",
"odDriverIDDes": "仅对 OneDrive 存储策略有效,留空则使用用户的默认 OneDrive 驱动器",
"s3Region": "Amazon S3 Region",
"s3Only": "仅对 Amazon S3 存储策略有效",
"lanEndpoint": "内网 EndPoint",
"ossOnly": "仅对 OSS 存储策略有效",
"chunkSizeBytes": "上传分片大小 (Bytes)",
"chunkSizeBytesDes": "分片上传时单个分片的大小,仅部分存储策略支持",
"placeHolderWithSize": "上传前预支用户存储",
"placeHolderWithSizeDes": "是否在上传会话创建时就对用户存储进行预支,仅部分存储策略支持",
"saveChanges": "保存更改"
}
}

View File

@ -15,8 +15,10 @@ import React, { useCallback, useState } from "react";
import { useDispatch } from "react-redux";
import { toggleSnackbar } from "../../../../redux/explorer";
import API from "../../../../middleware/Api";
import { useTranslation } from "react-i18next";
export default function EditPro(props) {
const { t } = useTranslation("dashboard", { keyPrefix: "policy" });
const [, setLoading] = useState(false);
const [policy, setPolicy] = useState(props.policy);
@ -85,7 +87,7 @@ export default function EditPro(props) {
ToggleSnackbar(
"top",
"right",
"存储策略已" + (props.policy ? "保存" : "添加"),
props.policy ? t("policySaved") : t("policyAdded"),
"success"
);
})
@ -101,35 +103,35 @@ export default function EditPro(props) {
return (
<div>
<Typography variant={"h6"}>编辑存储策略</Typography>
<Typography variant={"h6"}>{t("editPolicy")}</Typography>
<TableContainer>
<form onSubmit={submitPolicy}>
<Table aria-label="simple table">
<TableHead>
<TableRow>
<TableCell>设置项</TableCell>
<TableCell></TableCell>
<TableCell>描述</TableCell>
<TableCell>{t("setting")}</TableCell>
<TableCell>{t("value")}</TableCell>
<TableCell>{t("description")}</TableCell>
</TableRow>
</TableHead>
<TableBody>
<TableRow>
<TableCell component="th" scope="row">
ID
{t("id")}
</TableCell>
<TableCell>{policy.ID}</TableCell>
<TableCell>存储策略编号</TableCell>
<TableCell>{t("policyID")}</TableCell>
</TableRow>
<TableRow>
<TableCell component="th" scope="row">
类型
{t("type")}
</TableCell>
<TableCell>{policy.Type}</TableCell>
<TableCell>存储策略类型</TableCell>
<TableCell>{t("policyType")}</TableCell>
</TableRow>
<TableRow>
<TableCell component="th" scope="row">
名称
{t("name")}
</TableCell>
<TableCell>
<FormControl>
@ -140,11 +142,11 @@ export default function EditPro(props) {
/>
</FormControl>
</TableCell>
<TableCell>存储策名称</TableCell>
<TableCell>{t("policyName")}</TableCell>
</TableRow>
<TableRow>
<TableCell component="th" scope="row">
Server
{t("server")}
</TableCell>
<TableCell>
<FormControl>
@ -158,7 +160,7 @@ export default function EditPro(props) {
</TableRow>
<TableRow>
<TableCell component="th" scope="row">
BucketName
{t("bucketName")}
</TableCell>
<TableCell>
<FormControl>
@ -170,11 +172,11 @@ export default function EditPro(props) {
/>
</FormControl>
</TableCell>
<TableCell>存储桶标识</TableCell>
<TableCell>{t("bucketID")}</TableCell>
</TableRow>
<TableRow>
<TableCell component="th" scope="row">
私有空间
{t("privateBucket")}
</TableCell>
<TableCell>
<FormControl>
@ -189,23 +191,23 @@ export default function EditPro(props) {
control={
<Radio color={"primary"} />
}
label="是"
label={t("yes")}
/>
<FormControlLabel
value={"false"}
control={
<Radio color={"primary"} />
}
label="否"
label={t("no")}
/>
</RadioGroup>
</FormControl>
</TableCell>
<TableCell>是否为私有空间</TableCell>
<TableCell>{t("privateBucketDes")}</TableCell>
</TableRow>
<TableRow>
<TableCell component="th" scope="row">
文件资源根URL
{t("resourceRootURL")}
</TableCell>
<TableCell>
<FormControl>
@ -215,13 +217,11 @@ export default function EditPro(props) {
/>
</FormControl>
</TableCell>
<TableCell>
预览/获取文件外链时生成URL的前缀
</TableCell>
<TableCell>{t("resourceRootURLDes")}</TableCell>
</TableRow>
<TableRow>
<TableCell component="th" scope="row">
AccessKey
{t("accessKey")}
</TableCell>
<TableCell>
<FormControl>
@ -233,11 +233,11 @@ export default function EditPro(props) {
/>
</FormControl>
</TableCell>
<TableCell>AccessKey / 刷新Token</TableCell>
<TableCell>{t("akDes")}</TableCell>
</TableRow>
<TableRow>
<TableCell component="th" scope="row">
SecretKey
{t("secretKey")}
</TableCell>
<TableCell>
<FormControl>
@ -249,11 +249,11 @@ export default function EditPro(props) {
/>
</FormControl>
</TableCell>
<TableCell>SecretKey</TableCell>
<TableCell>{t("secretKey")}</TableCell>
</TableRow>
<TableRow>
<TableCell component="th" scope="row">
最大单文件尺寸 (Bytes)
{t("maxSizeBytes")}
</TableCell>
<TableCell>
<FormControl>
@ -268,13 +268,11 @@ export default function EditPro(props) {
/>
</FormControl>
</TableCell>
<TableCell>
最大可上传的文件尺寸填写为0表示不限制
</TableCell>
<TableCell>{t("maxSizeBytesDes")}</TableCell>
</TableRow>
<TableRow>
<TableCell component="th" scope="row">
自动重命名
{t("autoRename")}
</TableCell>
<TableCell>
<FormControl>
@ -291,25 +289,23 @@ export default function EditPro(props) {
control={
<Radio color={"primary"} />
}
label="是"
label={t("yes")}
/>
<FormControlLabel
value={"false"}
control={
<Radio color={"primary"} />
}
label="否"
label={t("no")}
/>
</RadioGroup>
</FormControl>
</TableCell>
<TableCell>
是否根据规则对上传物理文件重命名
</TableCell>
<TableCell>{t("autoRenameDes")}</TableCell>
</TableRow>
<TableRow>
<TableCell component="th" scope="row">
存储路径
{t("storagePath")}
</TableCell>
<TableCell>
<FormControl>
@ -322,11 +318,11 @@ export default function EditPro(props) {
/>
</FormControl>
</TableCell>
<TableCell>文件物理存储路径</TableCell>
<TableCell>{t("storagePathDes")}</TableCell>
</TableRow>
<TableRow>
<TableCell component="th" scope="row">
存储文件名
{t("fileName")}
</TableCell>
<TableCell>
<FormControl>
@ -339,11 +335,11 @@ export default function EditPro(props) {
/>
</FormControl>
</TableCell>
<TableCell>文件物理存储文件名</TableCell>
<TableCell>{t("fileNameDes")}</TableCell>
</TableRow>
<TableRow>
<TableCell component="th" scope="row">
允许获取外链
{t("allowGetSourceLink")}
</TableCell>
<TableCell>
<FormControl>
@ -360,25 +356,25 @@ export default function EditPro(props) {
control={
<Radio color={"primary"} />
}
label="是"
label={t("yes")}
/>
<FormControlLabel
value={"false"}
control={
<Radio color={"primary"} />
}
label="否"
label={t("no")}
/>
</RadioGroup>
</FormControl>
</TableCell>
<TableCell>
是否允许获取外链注意某些存储策略类型不支持即使在此开启获取的外链也无法使用
{t("allowGetSourceLinkDes")}
</TableCell>
</TableRow>
<TableRow>
<TableCell component="th" scope="row">
又拍云防盗链 Token
{t("upyunToken")}
</TableCell>
<TableCell>
<FormControl>
@ -393,11 +389,11 @@ export default function EditPro(props) {
/>
</FormControl>
</TableCell>
<TableCell>仅对又拍云存储策略有效</TableCell>
<TableCell>{t("upyunOnly")}</TableCell>
</TableRow>
<TableRow>
<TableCell component="th" scope="row">
允许文件扩展名
{t("allowedFileExtension")}
</TableCell>
<TableCell>
<FormControl>
@ -413,11 +409,11 @@ export default function EditPro(props) {
/>
</FormControl>
</TableCell>
<TableCell>留空表示不限制</TableCell>
<TableCell>{t("emptyIsNoLimit")}</TableCell>
</TableRow>
<TableRow>
<TableCell component="th" scope="row">
允许的 MimeType
{t("allowedMimetype")}
</TableCell>
<TableCell>
<FormControl>
@ -433,11 +429,11 @@ export default function EditPro(props) {
/>
</FormControl>
</TableCell>
<TableCell>仅对七牛存储策略有效</TableCell>
<TableCell>{t("qiniuOnly")}</TableCell>
</TableRow>
<TableRow>
<TableCell component="th" scope="row">
OneDrive 重定向地址
{t("odRedirectURL")}
</TableCell>
<TableCell>
<FormControl>
@ -453,11 +449,13 @@ export default function EditPro(props) {
/>
</FormControl>
</TableCell>
<TableCell>一般添加后无需修改</TableCell>
<TableCell>
{t("noModificationNeeded")}
</TableCell>
</TableRow>
<TableRow>
<TableCell component="th" scope="row">
OneDrive 反代服务器地址
{t("odReverseProxy")}
</TableCell>
<TableCell>
<FormControl>
@ -473,13 +471,11 @@ export default function EditPro(props) {
/>
</FormControl>
</TableCell>
<TableCell>
仅对 OneDrive 存储策略有效
</TableCell>
<TableCell>{t("odOnly")}</TableCell>
</TableRow>
<TableRow>
<TableCell component="th" scope="row">
OneDrive/SharePoint 驱动器资源标识
{t("odDriverID")}
</TableCell>
<TableCell>
<FormControl>
@ -495,15 +491,11 @@ export default function EditPro(props) {
/>
</FormControl>
</TableCell>
<TableCell>
仅对 OneDrive
存储策略有效留空则使用用户的默认 OneDrive
驱动器
</TableCell>
<TableCell>{t("odDriverIDDes")}</TableCell>
</TableRow>
<TableRow>
<TableCell component="th" scope="row">
Amazon S3 Region
{t("s3Region")}
</TableCell>
<TableCell>
<FormControl>
@ -518,13 +510,11 @@ export default function EditPro(props) {
/>
</FormControl>
</TableCell>
<TableCell>
仅对 Amazon S3 存储策略有效
</TableCell>
<TableCell>{t("s3Only")}</TableCell>
</TableRow>
<TableRow>
<TableCell component="th" scope="row">
内网 EndPoint
{t("lanEndpoint")}
</TableCell>
<TableCell>
<FormControl>
@ -540,11 +530,11 @@ export default function EditPro(props) {
/>
</FormControl>
</TableCell>
<TableCell>仅对 OSS 存储策略有效</TableCell>
<TableCell>{t("ossOnly")}</TableCell>
</TableRow>
<TableRow>
<TableCell component="th" scope="row">
上传分片大小 (Bytes)
{t("chunkSizeBytes")}
</TableCell>
<TableCell>
<FormControl>
@ -564,13 +554,11 @@ export default function EditPro(props) {
/>
</FormControl>
</TableCell>
<TableCell>
分片上传时单个分片的大小仅部分存储策略支持
</TableCell>
<TableCell>{t("chunkSizeBytesDes")}</TableCell>
</TableRow>
<TableRow>
<TableCell component="th" scope="row">
上传前预支用户存储
{t("placeHolderWithSize")}
</TableCell>
<TableCell>
<FormControl>
@ -590,25 +578,25 @@ export default function EditPro(props) {
control={
<Radio color={"primary"} />
}
label="是"
label={t("yes")}
/>
<FormControlLabel
value={"false"}
control={
<Radio color={"primary"} />
}
label="否"
label={t("no")}
/>
</RadioGroup>
</FormControl>
</TableCell>
<TableCell>
是否在上传会话创建时就对用户存储进行预支仅部分存储策略支持
{t("placeHolderWithSizeDes")}
</TableCell>
</TableRow>
<TableRow>
<TableCell component="th" scope="row">
TPS 限制
{t("tps")}
</TableCell>
<TableCell>
<FormControl>
@ -627,13 +615,11 @@ export default function EditPro(props) {
/>
</FormControl>
</TableCell>
<TableCell>
OneDrive 存储策略支持
</TableCell>
<TableCell>{t("odOnly")}</TableCell>
</TableRow>
<TableRow>
<TableCell component="th" scope="row">
TPS 突发请求
{t("tpsBurst")}
</TableCell>
<TableCell>
<FormControl>
@ -652,9 +638,7 @@ export default function EditPro(props) {
/>
</FormControl>
</TableCell>
<TableCell>
OneDrive 存储策略支持
</TableCell>
<TableCell>{t("odOnly")}</TableCell>
</TableRow>
</TableBody>
</Table>
@ -664,7 +648,7 @@ export default function EditPro(props) {
variant={"contained"}
style={{ margin: 8 }}
>
保存更改
{t("saveChanges")}
</Button>
</form>
</TableContainer>