Skip to content

Commit

Permalink
fix(web): fix bucket display name in edit mode (#1606)
Browse files Browse the repository at this point in the history
  • Loading branch information
newfish-cmyk authored Oct 25, 2023
1 parent adaed0c commit d16bb36
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
5 changes: 3 additions & 2 deletions web/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
"EditBucket": "Edit Bucket",
"DeleteBucket": "Delete Buckets",
"BucketNameRule": "The bucket name must consist of lowercase letters, numbers and hyphens (-), with a length between 3 and 32 characters, and cannot start or end with a hyphen (-).",
"BucketNamePlaceholder": "bucket-name",
"BucketNamePlaceholder": "bucket name",
"StorageList": "Storages",
"EmptyStorageTip": "You have not created a Bucket",
"UploadFile": "Upload File",
Expand Down Expand Up @@ -659,5 +659,6 @@
"SavedSuccessfully": "Saved Successfully",
"Bind": "Bind",
"UnBind": "Unbind",
"UnBindSuccess": "Unbind Successfully"
"UnBindSuccess": "Unbind Successfully",
"CreateSuccess": "create success"
}
5 changes: 3 additions & 2 deletions web/public/locales/zh-CN/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@
"CreateBucket": "创建 Bucket",
"EditBucket": "编辑 Bucket",
"DeleteBucket": "删除 Bucket",
"BucketNamePlaceholder": "bucket-name",
"BucketNamePlaceholder": "bucket 名称",
"EmptyStorageTip": "您还没有创建 Bucket",
"UploadFile": "上传文件",
"UploadFolder": "上传文件夹",
Expand Down Expand Up @@ -659,5 +659,6 @@
"Bind": "绑定",
"UnBind": "解绑",
"UnBindSuccess": "解绑成功",
"SavedSuccessfully": "保存成功"
"SavedSuccessfully": "保存成功",
"CreateSuccess": "创建成功"
}
5 changes: 3 additions & 2 deletions web/public/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@
"CreateBucket": "创建 Bucket",
"EditBucket": "编辑 Bucket",
"DeleteBucket": "删除 Bucket",
"BucketNamePlaceholder": "bucket-name",
"BucketNamePlaceholder": "bucket 名称",
"EmptyStorageTip": "您还没有创建 Bucket",
"UploadFile": "上传文件",
"UploadFolder": "上传文件夹",
Expand Down Expand Up @@ -659,5 +659,6 @@
"Bind": "绑定",
"UnBind": "解绑",
"UnBindSuccess": "解绑成功",
"SavedSuccessfully": "保存成功"
"SavedSuccessfully": "保存成功",
"CreateSuccess": "创建成功"
}
15 changes: 9 additions & 6 deletions web/src/pages/app/storages/mods/CreateBucketModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function CreateBucketModal(props: { storage?: TBucket; children: React.ReactElem
res = await bucketUpdateMutation.mutateAsync(values);
if (!res.error) {
store.setCurrentStorage(res.data);
showSuccess("update success.");
showSuccess(t("UpdateSuccess"));
onClose();
}
} else {
Expand All @@ -79,7 +79,7 @@ function CreateBucketModal(props: { storage?: TBucket; children: React.ReactElem
});
if (!res.error) {
store.setCurrentStorage(res.data);
showSuccess("create success.");
showSuccess(t("CreateSuccess"));
onClose();
}
}
Expand Down Expand Up @@ -109,9 +109,11 @@ function CreateBucketModal(props: { storage?: TBucket; children: React.ReactElem
<FormControl isInvalid={!!errors?.name}>
<FormLabel htmlFor="name"> {t("StoragePanel.BucketName")}</FormLabel>
<InputGroup>
<InputAddon className="!mr-0 !rounded-r-none !pr-0">
{currentApp.appid + "-"}
</InputAddon>
{!isEdit && (
<InputAddon className="!mr-0 !rounded-r-none !pr-0">
{currentApp.appid + "-"}
</InputAddon>
)}
<Input
{...register("name", {
required: t("StoragePanel.BucketNameisRequired").toString(),
Expand All @@ -124,8 +126,9 @@ function CreateBucketModal(props: { storage?: TBucket; children: React.ReactElem
placeholder={String(t("StoragePanel.BucketNamePlaceholder"))}
disabled={isEdit}
className={clsx(
"!ml-0 !rounded-l-none !border-none !pl-0",
"!rounded-l-none !border-none",
darkMode ? "!bg-[#FFFFFF0A]" : "!bg-lafWhite-600",
isEdit ? "" : "!ml-0 !pl-0",
)}
/>
</InputGroup>
Expand Down

0 comments on commit d16bb36

Please sign in to comment.