From 5e989bca4ba8492c3dfe5a74b04637b544563dfd Mon Sep 17 00:00:00 2001 From: VirtualHotBar <96966978+VirtualHotBar@users.noreply.github.com> Date: Thu, 16 May 2024 14:16:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9=E6=8C=82=E8=BD=BD?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=90=8E=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../storage/mount/parameters/defaults.ts | 34 ++++++++++++------- src/page/mount/add.tsx | 4 +-- src/page/other/InputForm.tsx | 29 ++++++++++++---- src/type/rclone/storage/mount/parameters.d.ts | 3 +- 4 files changed, 47 insertions(+), 23 deletions(-) diff --git a/src/controller/storage/mount/parameters/defaults.ts b/src/controller/storage/mount/parameters/defaults.ts index c13c9bf..cde11e1 100644 --- a/src/controller/storage/mount/parameters/defaults.ts +++ b/src/controller/storage/mount/parameters/defaults.ts @@ -1,20 +1,29 @@ +import { StorageParamItemType } from "../../../../type/controller/storage/info"; import { MountOptions, VfsOptions } from "../../../../type/rclone/storage/mount/parameters"; +const vfsCacheModeParam: StorageParamItemType = { + label: 'CacheMode', + name: 'CacheMode', + description: 'CacheMode', + type: 'string', + default: 'full', + required: false, + advanced: false, + isPassword: false, + select: [ + { label: 'Full', value: 'full', help: '' }, + { label: 'Writes', value: 'writes', help: '' }, + { label: 'Minimal', value: 'minimal', help: '' }, + { label: 'Off', value: 'off', help: '' } + ] +} // 示例:初始化VfsOptions和MountOptions的默认值 const defaultVfsConfig: VfsOptions = { ReadOnly: false, CacheMaxAge: 3600000000000, CacheMaxSize: -1, - CacheMode: { - select: 'full', - values: [ - 'off', - 'minimal', - 'writes', - 'full', - ] - }, + CacheMode: 'full', CachePollInterval: 60000000000, CaseInsensitive: false, ChunkSize: 67108864, @@ -29,7 +38,7 @@ const defaultVfsConfig: VfsOptions = { ReadAhead: 0, ReadWait: 20000000, WriteBack: 5000000000, - WriteWait: 1000000000, + WriteWait: 1000000000, Refresh: false, BlockNormDupes: false, UsedIsSize: false, @@ -38,7 +47,6 @@ const defaultVfsConfig: VfsOptions = { UID: 4294967295, GID: 4294967295, Umask: 0, - }; const defaultMountConfig: MountOptions = { @@ -58,10 +66,10 @@ const defaultMountConfig: MountOptions = { NoAppleDouble: true, NoAppleXattr: false, WritebackCache: false, - DaemonWait: 0, + DaemonWait: 0, DeviceName: '', NetworkMode: false, //挂载为网络驱动器 //CaseInsensitive: null, }; -export { defaultVfsConfig, defaultMountConfig } \ No newline at end of file +export { defaultVfsConfig, defaultMountConfig,vfsCacheModeParam } \ No newline at end of file diff --git a/src/page/mount/add.tsx b/src/page/mount/add.tsx index c233444..925a7db 100644 --- a/src/page/mount/add.tsx +++ b/src/page/mount/add.tsx @@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next' import { useNavigate } from 'react-router-dom'; import { ParametersType } from '../../type/defaults'; import { formatPath, getProperties, getURLSearchParam, getWinFspInstallState, showPathInExplorer } from '../../utils/utils'; -import { defaultMountConfig, defaultVfsConfig } from '../../controller/storage/mount/parameters/defaults'; +import { defaultMountConfig, defaultVfsConfig, vfsCacheModeParam } from '../../controller/storage/mount/parameters/defaults'; import { rcloneInfo } from '../../services/rclone'; import { addMountStorage, getAvailableDriveLetter, getMountStorage, mountStorage } from '../../controller/storage/mount/mount'; import { osInfo } from '../../services/config'; @@ -152,7 +152,7 @@ export default function AddMount_page() { {