From c9e15e44762a816715639e32a47f7ea6c71f79df Mon Sep 17 00:00:00 2001 From: VirtualHotBar <96966978+VirtualHotBar@users.noreply.github.com> Date: Fri, 17 May 2024 15:31:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=96=87=E4=BB=B6=E6=B5=8F?= =?UTF-8?q?=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controller/language/pack/zh-cn.json | 4 +++- src/controller/test.ts | 14 +++++++---- src/page/mount/add.tsx | 3 ++- src/page/storage/explorer.tsx | 31 +++++++++++++++---------- src/page/task/task.tsx | 20 ++++++++++------ 5 files changed, 47 insertions(+), 25 deletions(-) diff --git a/src/controller/language/pack/zh-cn.json b/src/controller/language/pack/zh-cn.json index 2d1a345..c828db2 100644 --- a/src/controller/language/pack/zh-cn.json +++ b/src/controller/language/pack/zh-cn.json @@ -15,6 +15,7 @@ "Webdav": "WebDAV是一组基于超文本传输协议的技术集合,有利于用户间协同编辑和管理存储在万维网服务器文档。", "url": "地址", "vendor": "提供商", + "execute": "执行", "user": "用户", "pass": "密码", "save": "保存", @@ -254,7 +255,8 @@ "runtime_error": "运行错误", "view_log": "查看日志", "version": "版本", - "filelist_load_Fail": "文件列表加载失败,请检查网络或存储配置", + "filelist_load_fail": "文件列表加载失败,请检查网络或存储配置", + "filelist_loading": "文件列表加载中", "devtools": "开发者工具", "not_add_storage": "未添加存储", "about_to_restart_self": "即将重启程序", diff --git a/src/controller/test.ts b/src/controller/test.ts index e7db8c1..8d1c043 100644 --- a/src/controller/test.ts +++ b/src/controller/test.ts @@ -1,6 +1,6 @@ import { rclone_api_post } from "../utils/rclone/request"; import { createStorage } from "./storage/create"; -import { getFileList, reupStorage } from "./storage/storage"; +import { convertStoragePath, getFileList, reupStorage } from "./storage/storage"; import { invoke } from '@tauri-apps/api'; import { appWindow } from "@tauri-apps/api/window"; @@ -26,10 +26,16 @@ export async function Test() { console.log(await rclone_api_post('/options/get')); console.log(await rclone_api_post('/rc/list'),); - console.log(await alist_api_get('/api/me')); - console.log(roConfig.env.path.homeDir); - console.log(storageInfoList); + /* console.log(await rclone_api_post('/operations/publiclink',{ + fs: convertStoragePath('S3_new',undefined,undefined,undefined,true), + remote :convertStoragePath('S3_new','Package/HotPE-V2.7.240201.7z',undefined,true,false), + })); */ + + //console.log(await alist_api_get('/api/me')); + //console.log(roConfig.env.path.homeDir); + + //console.log(storageInfoList); //await addAlistInRclone() diff --git a/src/page/mount/add.tsx b/src/page/mount/add.tsx index 0262f61..e65941a 100644 --- a/src/page/mount/add.tsx +++ b/src/page/mount/add.tsx @@ -12,6 +12,7 @@ import { homeDir } from '@tauri-apps/api/path'; import { InputForm_module, paramsType2FormItems } from '../other/InputForm'; import { filterHideStorage } from '../../controller/storage/storage'; import { MountOptions, VfsOptions } from '../../type/rclone/storage/mount/parameters'; +import { searchStorageInfo } from '../../controller/storage/allList'; const FormItem = Form.Item; @@ -134,7 +135,7 @@ export default function AddMount_page() { { storageList.map((item) => { return ( - {item.name}({item.type}) + {item.name}({t(searchStorageInfo(item.type).label)}) ) }) } diff --git a/src/page/storage/explorer.tsx b/src/page/storage/explorer.tsx index 509cb81..14ef5c5 100644 --- a/src/page/storage/explorer.tsx +++ b/src/page/storage/explorer.tsx @@ -5,7 +5,7 @@ import { rcloneInfo } from '../../services/rclone'; import { useTranslation } from 'react-i18next'; import { copyDir, copyFile, delDir, delFile, filterHideStorage, formatPathRclone, getFileList, mkDir, moveDir, moveFile, uploadFileRequest } from '../../controller/storage/storage'; import { FileInfo } from '../../type/rclone/rcloneInfo'; -import { formatSize, getURLSearchParam } from '../../utils/utils'; +import { formatSize, getURLSearchParam, sleep } from '../../utils/utils'; import { RequestOptions } from '@arco-design/web-react/es/Upload'; import { NoData_module } from '../other/noData'; import { clipListItem } from '../../type/page/storage/explorer'; @@ -73,7 +73,7 @@ function ExplorerItem() { const [fileList, setFileInfo] = useState>() - const [loading, setLoading] = useState(false) + const [loading, setLoading] = useState() const [clipList, setClipList] = useState>([]) @@ -110,9 +110,12 @@ function ExplorerItem() { //刷新文件列表 async function fileInfo() { setLoading(true) - const l = await getFileList(storageName!, path!) - setLoading(false) - setFileInfo(l) + try { + const l = await getFileList(storageName!, path!) + setFileInfo(l) + } finally { + setLoading(false) + } } // 创建一个自定义函数用于更新路径,确保路径始终符合规范 @@ -193,7 +196,7 @@ function ExplorerItem() { title: t('upload_file'), icon: null, content: <> - {uploadFileRequest(option,storageName,path)}} >, + { uploadFileRequest(option, storageName, path) }} >, onOk: fileInfo, onCancel: fileInfo }) @@ -220,9 +223,9 @@ function ExplorerItem() { }) } - const openFile=( path:string )=>{ - console.log(path); - Message.info({ content:t('mount_the_storage_to_download_files'),id:'openfile' }) + const openFile = (path: string) => { + console.log(path); + Message.info({ content: t('mount_the_storage_to_download_files'), id: 'openfile' }) } return ( @@ -306,7 +309,7 @@ function ExplorerItem() { data={ fileList.map((item) => { return { - ...item, fileName: { item.isDir ?updatePath(item.path): openFile(item.path) }}>{item.name}, + ...item, fileName: { item.isDir ? updatePath(item.path) : openFile(item.path) }}>{item.name}, fileSize: (item.size != -1 ? formatSize(item.size) : t('dir')), fileModTime: (new Date(item.modTime)).toLocaleString(), actions: @@ -332,10 +335,14 @@ function ExplorerItem() { } })} /> - :

{t('filelist_load_Fail')}

+ :
+

{loading ? : t('filelist_load_fail')}

+
} : - !storageName && {t('please_select_storage')} + !storageName && + {t('please_select_storage')} + } diff --git a/src/page/task/task.tsx b/src/page/task/task.tsx index 9d86b92..6095439 100644 --- a/src/page/task/task.tsx +++ b/src/page/task/task.tsx @@ -4,7 +4,7 @@ import { Button, Grid, Link, Modal, Space, Table, TableColumnProps, Typography } import { useTranslation } from 'react-i18next' import { nmConfig, roConfig } from '../../services/config' import { useNavigate } from 'react-router-dom' -import { delTask } from '../../controller/task/task' +import { delTask, taskScheduler } from '../../controller/task/task' import { NoData_module } from '../other/noData' import { IconQuestionCircle } from '@arco-design/web-react/icon' import { openUrlInBrowser } from '../../utils/utils' @@ -24,16 +24,16 @@ function Task_page() { { title: t('task_name'), dataIndex: 'name', - width:'20%' + width: '20%' }, { title: t('state'), dataIndex: 'state', - width:'5rem' + width: '5rem' }, { title: t('cycle'), dataIndex: 'cycle', - width:'5rem' + width: '5rem' } , { title: t('run_info'), @@ -43,7 +43,7 @@ function Task_page() { title: t('actions'), dataIndex: 'actions', align: 'right', - width:'6rem' + width: '6rem' } ]; console.log(nmConfig.task); @@ -72,9 +72,15 @@ function Task_page() { onClick={() => { showLog(modal, taskItem.runInfo?.msg || t('none')) }}> {(taskItem.runInfo?.msg || t('none')).split('\n').pop()} , - actions: <> + actions: - + + } })} />