diff --git a/package.json b/package.json index 0067aaba..80f4beec 100644 --- a/package.json +++ b/package.json @@ -145,6 +145,7 @@ "monaco-editor": "0.33.0", "nodemon": "^3.0.1", "prettier": "^2.5.1", + "pretty-bytes": "6.1.1", "qiniu": "^7.4.0", "qrcode.react": "^1.0.1", "query-string": "^7.1.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6dfce188..97ffe1e2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -264,6 +264,9 @@ devDependencies: prettier: specifier: ^2.5.1 version: 2.8.8 + pretty-bytes: + specifier: 6.1.1 + version: 6.1.1 qiniu: specifier: ^7.4.0 version: 7.8.0 @@ -12522,6 +12525,11 @@ packages: hasBin: true dev: true + /pretty-bytes@6.1.1: + resolution: {integrity: sha512-mQUvGU6aUFQ+rNvTIAcZuWGRT9a6f6Yrg9bHs4ImKF+HZCEK+plBvnAZYSIQztknZF2qnzNtr6F8s0+IuptdlQ==} + engines: {node: ^14.13.1 || >=16.0.0} + dev: true + /pretty-error@4.0.0: resolution: {integrity: sha512-AoJ5YMAcXKYxKhuJGdcvse+Voc6v1RgnsR3nWcYU7q4t6z0Q6T86sv5Zq8VIRbOWWFpvdGE83LtdSMNd+6Y0xw==} dependencies: diff --git a/src/locales/en-US.json b/src/locales/en-US.json index 9bc2f504..eca398a1 100644 --- a/src/locales/en-US.json +++ b/src/locales/en-US.json @@ -475,5 +475,6 @@ "代理地址, 支持HTTP(S)/SOCK5": "Proxy Address, supports HTTP(S)/SOCK5", "NPM 镜像源": "NPM Mirror Source", "PyPI 镜像源": "PyPI Mirror Source", - "alpine linux 镜像源, 例如 https://mirrors.aliyun.com": "Alpine Linux Mirror Source, e.g. https://mirrors.aliyun.com" + "alpine linux 镜像源, 例如 https://mirrors.aliyun.com": "Alpine Linux Mirror Source, e.g. https://mirrors.aliyun.com", + "如果恢复失败,可进入容器执行": "If recovery fails, you can enter the container and execute" } diff --git a/src/locales/zh-CN.json b/src/locales/zh-CN.json index 1d3ef7a5..b53219f9 100644 --- a/src/locales/zh-CN.json +++ b/src/locales/zh-CN.json @@ -475,5 +475,6 @@ "代理地址, 支持HTTP(S)/SOCK5": "代理地址, 支持HTTP(S)/SOCK5", "NPM 镜像源": "NPM 镜像源", "PyPI 镜像源": "PyPI 镜像源", - "alpine linux 镜像源, 例如 https://mirrors.aliyun.com": "alpine linux 镜像源, 例如 https://mirrors.aliyun.com" + "alpine linux 镜像源, 例如 https://mirrors.aliyun.com": "alpine linux 镜像源, 例如 https://mirrors.aliyun.com", + "如果恢复失败,可进入容器执行": "如果恢复失败,可进入容器执行" } diff --git a/src/pages/log/index.tsx b/src/pages/log/index.tsx index b71ad925..eb2d1eb8 100644 --- a/src/pages/log/index.tsx +++ b/src/pages/log/index.tsx @@ -25,6 +25,7 @@ import { depthFirstSearch } from '@/utils'; import debounce from 'lodash/debounce'; import uniq from 'lodash/uniq'; import useFilterTreeData from '@/hooks/useFilterTreeData'; +import prettyBytes from 'pretty-bytes'; const { Text } = Typography; @@ -186,8 +187,16 @@ const Log = () => { <> {select} {currentNode?.type === 'file' && ( - - {(currentNode.size / 1024).toFixed(3)}KB + + {prettyBytes(currentNode.size)} )} diff --git a/src/pages/script/index.tsx b/src/pages/script/index.tsx index 8b6914a1..ec9daeb5 100644 --- a/src/pages/script/index.tsx +++ b/src/pages/script/index.tsx @@ -45,6 +45,7 @@ import IconFont from '@/components/iconfont'; import RenameModal from './renameModal'; import { langs } from '@uiw/codemirror-extensions-langs'; import { useHotkeys } from 'react-hotkeys-hook'; +import prettyBytes from 'pretty-bytes'; const { Text } = Typography; const Script = () => { @@ -466,8 +467,16 @@ const Script = () => { <> {select} {currentNode?.type === 'file' && ( - - {(currentNode.size / 1024).toFixed(3)}KB + + {prettyBytes(currentNode.size)} )} diff --git a/src/pages/setting/other.tsx b/src/pages/setting/other.tsx index 5f463135..1ab46d66 100644 --- a/src/pages/setting/other.tsx +++ b/src/pages/setting/other.tsx @@ -132,7 +132,12 @@ const Other = ({ maskClosable: false, title: intl.get('确认重启'), centered: true, - content: intl.get('备份数据上传成功,确认覆盖数据'), + content: ( + <> +
{intl.get('备份数据上传成功,确认覆盖数据')}
+
{intl.get('如果恢复失败,可进入容器执行')} ql reload data
+ + ), okText: intl.get('重启'), onOk() { request