From 2e878e2a3717c9c94cd483bd930058b5f3b9ec05 Mon Sep 17 00:00:00 2001 From: VirtualHotBar <96966978+VirtualHotBar@users.noreply.github.com> Date: Fri, 17 May 2024 16:19:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E7=BC=96=E8=BE=91=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controller/language/pack/zh-cn.json | 6 +++ src/page/mount/add.tsx | 4 +- src/page/storage/add.tsx | 2 +- src/page/task/add.tsx | 30 +++++++++++---- src/page/task/task.tsx | 51 +++++++++++++++++++------ 5 files changed, 71 insertions(+), 22 deletions(-) diff --git a/src/controller/language/pack/zh-cn.json b/src/controller/language/pack/zh-cn.json index c828db2..b6fd14f 100644 --- a/src/controller/language/pack/zh-cn.json +++ b/src/controller/language/pack/zh-cn.json @@ -82,9 +82,12 @@ "transm_task_created": "已创建任务,请到[传输]页查看信息", "clip_board": "剪切板", "paste": "粘贴", + "edit_storage": "编辑存储", + "edit_mount": "编辑挂载", "empty_the_clipboard": "清空剪贴板", "parent_directory": "上级目录", "cut": "剪切", + "edit_task": "编辑任务", "more": "更多", "copy": "复制", "rename": "重命名", @@ -93,6 +96,8 @@ "state": "状态", "enabled": "启用", "disabled": "禁用", + "enable": "启用", + "disable": "禁用", "cycle": "周期", "run_info": "运行信息", "task_type": "任务类型", @@ -261,6 +266,7 @@ "not_add_storage": "未添加存储", "about_to_restart_self": "即将重启程序", "desktop": "桌面", + "trigger": "触发", "custom": "自定义", "recommend": "推荐", "enter_keyword_to_search": "输入关键字搜索", diff --git a/src/page/mount/add.tsx b/src/page/mount/add.tsx index e65941a..62addfa 100644 --- a/src/page/mount/add.tsx +++ b/src/page/mount/add.tsx @@ -39,8 +39,6 @@ export default function AddMount_page() { const isMountPathCustom = mountPath !== '*' && !mountPath.startsWith('~/Desktop/'); const mountPathuIsDriveLetter = isWindows && (mountPath === '*' || mountPath.endsWith(':') || mountPath.endsWith(':/')); - console.log(mountPath); - const checkWinFspState = async () => { if (osInfo.osType === 'Windows_NT' && rcloneInfo.endpoint.isLocal) { @@ -126,7 +124,7 @@ export default function AddMount_page() { return (
-

{t('add_mount')}

+

{!isEditMode ? t('add_mount'):t('edit_mount') }

dispatch({ type: 'setName', payload: value })} @@ -268,7 +284,7 @@ function AddTask_page() { } else if (taskInfo.run.mode === 'interval') { taskInfo.run.interval = timeMultiplier.multiplicand * timeMultiplier.value; } - if (nmConfig.task && nmConfig.task.forEach(item => item.name == taskInfo.name)! || !taskInfo.name) { + if (!isEditMode && nmConfig.task && (nmConfig.task.findIndex(item => item.name === taskInfo.name) !== -1) || !taskInfo.name) { Notification.error({ title: t('error'), content: t('the_task_name_is_illegal'), @@ -293,7 +309,7 @@ function AddTask_page() { navigate('/task/') } } - }}>{t('add')} + }}>{!isEditMode ? t('add'): t('save')}
diff --git a/src/page/task/task.tsx b/src/page/task/task.tsx index 6095439..d8ab1b1 100644 --- a/src/page/task/task.tsx +++ b/src/page/task/task.tsx @@ -24,7 +24,8 @@ function Task_page() { { title: t('task_name'), dataIndex: 'name', - width: '20%' + width: '20%', + ellipsis: true, }, { title: t('state'), @@ -38,12 +39,13 @@ function Task_page() { , { title: t('run_info'), dataIndex: 'runInfo', + ellipsis: true, }, { title: t('actions'), dataIndex: 'actions', align: 'right', - width: '6rem' + width: '14rem' } ]; console.log(nmConfig.task); @@ -68,18 +70,45 @@ function Task_page() { ...taskItem, state: taskItem.enable ? t('enabled') : t('disabled'), cycle: t('task_run_mode_' + taskItem.run.mode), - runInfo: { showLog(modal, taskItem.runInfo?.msg || t('none')) }}> - {(taskItem.runInfo?.msg || t('none')).split('\n').pop()} + {(taskItem.runInfo?.msg || t('none')).split('\n').pop()} + , actions: - - + + { + taskItem.enable ? <> + + + + + : + <> + + + + + } + + } })} />