diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 47a938414..f871daaa0 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -610,6 +610,10 @@ const message = { mirrorsHelper2: 'For details, see the official documents, ', registries: 'Insecure registries', cutLog: 'Log option', + cutLogHelper1: 'The current configuration will only affect newly created containers.', + cutLogHelper2: 'Existing containers need to be recreated for the configuration to take effect.', + cutLogHelper3: + 'Please note that recreating containers may result in data loss. If your containers contain important data, make sure to backup before performing the rebuilding operation.', maxSize: 'Max-Size', maxFile: 'Max-File', liveHelper: diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index a091642e8..14ab77384 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -614,6 +614,10 @@ const message = { mirrorsHelper2: '具体操作配置请参照官方文档,', registries: '私有仓库', cutLog: '日志切割', + cutLogHelper1: '当前配置只会影响新创建的容器;', + cutLogHelper2: '已经创建的容器需要重新创建使配置生效;', + cutLogHelper3: + '注意,重新创建容器可能会导致数据丢失。如果你的容器中有重要数据,确保在执行重建操作之前进行备份。', maxSize: '文件大小', maxFile: '保留份数', liveHelper: '允许在 Docker 守护进程发生意外停机或崩溃时保留正在运行的容器状态', diff --git a/frontend/src/views/container/setting/index.vue b/frontend/src/views/container/setting/index.vue index 67054032f..6f9552b42 100644 --- a/frontend/src/views/container/setting/index.vue +++ b/frontend/src/views/container/setting/index.vue @@ -102,6 +102,18 @@ + +
+ {{ $t('container.maxSize') }}: {{ form.logMaxSize }} + + {{ $t('container.maxFile') }}: {{ form.logMaxFile }} + +
+ + {{ $t('commons.button.view') }} + +
+
@@ -260,7 +272,7 @@ const rules = reactive({ const formRef = ref(); const dockerConf = ref(); -const confirmDialogRef = ref(); +const confirmDialogRefFile = ref(); const iptablesVisiable = ref(); @@ -270,7 +282,7 @@ const onSaveFile = async () => { operationInfo: i18n.global.t('database.restartNowHelper'), submitInputInfo: i18n.global.t('database.restartNow'), }; - confirmDialogRef.value!.acceptParams(params); + confirmDialogRefFile.value!.acceptParams(params); }; const onChangeMirrors = () => { diff --git a/frontend/src/views/container/setting/log/index.vue b/frontend/src/views/container/setting/log/index.vue index 080937404..32fd3a963 100644 --- a/frontend/src/views/container/setting/log/index.vue +++ b/frontend/src/views/container/setting/log/index.vue @@ -10,6 +10,15 @@ + + + @@ -17,10 +26,10 @@ @@ -66,7 +75,7 @@ interface DialogProps { const form = reactive({ logMaxSize: 10, logMaxFile: 3, - sizeUnit: 'MB', + sizeUnit: 'm', }); const rules = reactive({ logMaxSize: [checkNumberRange(1, 1024000), Rules.number], @@ -81,7 +90,7 @@ const acceptParams = (params: DialogProps): void => { form.logMaxSize = loadSize(params.logMaxSize); } else { form.logMaxSize = 10; - form.sizeUnit = 'MB'; + form.sizeUnit = 'm'; } drawerVisiable.value = true; }; @@ -114,22 +123,22 @@ const onSubmitSave = async () => { }; const loadSize = (value: string) => { + if (value.indexOf('k') !== -1 || value.indexOf('KB') !== -1) { + form.sizeUnit = 'k'; + return Number(value.replaceAll('k', '').replaceAll('KB', '')); + } + if (value.indexOf('m') !== -1 || value.indexOf('MB') !== -1) { + form.sizeUnit = 'm'; + return Number(value.replaceAll('m', '').replaceAll('MB', '')); + } + if (value.indexOf('g') !== -1 || value.indexOf('GB') !== -1) { + form.sizeUnit = 'g'; + return Number(value.replaceAll('g', '').replaceAll('GB', '')); + } if (value.indexOf('b') !== -1 || value.indexOf('B') !== -1) { - form.sizeUnit = 'B'; + form.sizeUnit = 'b'; return Number(value.replaceAll('b', '').replaceAll('B', '')); } - if (value.indexOf('k') !== -1 || value.indexOf('K') !== -1) { - form.sizeUnit = 'KB'; - return Number(value.replaceAll('k', '').replaceAll('K', '')); - } - if (value.indexOf('m') !== -1 || value.indexOf('M') !== -1) { - form.sizeUnit = 'MB'; - return Number(value.replaceAll('m', '').replaceAll('M', '')); - } - if (value.indexOf('g') !== -1 || value.indexOf('G') !== -1) { - form.sizeUnit = 'GB'; - return Number(value.replaceAll('g', '').replaceAll('G', '')); - } }; const handleClose = () => { @@ -141,8 +150,3 @@ defineExpose({ acceptParams, }); -