From 2827c6bc2eddc44597f429d1a35c446c15aa7f30 Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Thu, 21 Aug 2025 13:13:21 +0800 Subject: [PATCH] feat(dashboard): filter file by shared link, direct link, uploading status --- public/locales/en-US/dashboard.json | 6 +- public/locales/ja-JP/dashboard.json | 6 +- public/locales/zh-CN/dashboard.json | 6 +- public/locales/zh-TW/dashboard.json | 6 +- .../Admin/File/FileFilterPopover.tsx | 72 ++++++++++++++++++- src/component/Admin/File/FileSetting.tsx | 27 +++++-- 6 files changed, 113 insertions(+), 10 deletions(-) diff --git a/public/locales/en-US/dashboard.json b/public/locales/en-US/dashboard.json index 8ac9e15..de75f67 100644 --- a/public/locales/en-US/dashboard.json +++ b/public/locales/en-US/dashboard.json @@ -1284,7 +1284,11 @@ "After import, the physical file will be taken over by Cloudreve, please do not modify it externally afterwards.", "Do not import the same file multiple times.", "If the user's file conflicts, this file will be skipped." - ] + ], + "otherConditions": "Other conditions", + "shareLinkExisted": "Has share link", + "directLinkExisted": "Has direct link", + "isUploading": "Is uploading" }, "entity": { "refenenceCount": "Reference count", diff --git a/public/locales/ja-JP/dashboard.json b/public/locales/ja-JP/dashboard.json index f46c8d0..cc5a31a 100644 --- a/public/locales/ja-JP/dashboard.json +++ b/public/locales/ja-JP/dashboard.json @@ -1270,7 +1270,11 @@ "インポート後、物理ファイルはCloudreveに移行されます。外部での変更はお控えください。", "同じファイルを複数回インポートしないでください。", "ユーザーのファイルが衝突した場合、このファイルはスキップされます。" - ] + ], + "otherConditions": "その他の条件", + "shareLinkExisted": "共有リンクが存在", + "directLinkExisted": "直接リンクが存在", + "isUploading": "アップロード中" }, "entity": { "refenenceCount": "参照回数", diff --git a/public/locales/zh-CN/dashboard.json b/public/locales/zh-CN/dashboard.json index be02d28..e063bd7 100644 --- a/public/locales/zh-CN/dashboard.json +++ b/public/locales/zh-CN/dashboard.json @@ -1269,7 +1269,11 @@ "导入后,物理文件将由 Cloudreve 接管,后续请不要在外部修改此文件;", "不要重复导入相同的文件;", "如果用户文件冲突,此文件会被跳过;" - ] + ], + "otherConditions": "其他条件", + "shareLinkExisted": "存在分享链接", + "directLinkExisted": "存在中转直链", + "isUploading": "上传中" }, "entity": { "refenenceCount": "引用次数", diff --git a/public/locales/zh-TW/dashboard.json b/public/locales/zh-TW/dashboard.json index ee1940c..1ba70f5 100644 --- a/public/locales/zh-TW/dashboard.json +++ b/public/locales/zh-TW/dashboard.json @@ -1266,7 +1266,11 @@ "匯入後,物理檔案將由 Cloudreve 接管,後續請不要在外部修改此檔案;", "不要重複匯入相同的檔案;", "如果使用者檔案衝突,此檔案會被跳過;" - ] + ], + "otherConditions": "其他條件", + "shareLinkExisted": "有分享連結", + "directLinkExisted": "有中轉直鏈", + "isUploading": "上傳中" }, "entity": { "refenenceCount": "引用次數", diff --git a/src/component/Admin/File/FileFilterPopover.tsx b/src/component/Admin/File/FileFilterPopover.tsx index e33bec6..f932bba 100644 --- a/src/component/Admin/File/FileFilterPopover.tsx +++ b/src/component/Admin/File/FileFilterPopover.tsx @@ -1,7 +1,7 @@ -import { Box, Button, Popover, PopoverProps, Stack } from "@mui/material"; +import { Box, Button, Checkbox, Popover, PopoverProps, Stack, styled } from "@mui/material"; import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; -import { DenseFilledTextField } from "../../Common/StyledComponents"; +import { DenseFilledTextField, SmallFormControlLabel } from "../../Common/StyledComponents"; import SettingForm from "../../Pages/Setting/SettingForm"; import SinglePolicySelectionInput from "../Common/SinglePolicySelectionInput"; @@ -12,9 +12,21 @@ export interface FileFilterPopoverProps extends PopoverProps { setOwner: (owner: string) => void; name: string; setName: (name: string) => void; + hasShareLink: boolean; + setHasShareLink: (hasShareLink: boolean) => void; + hasDirectLink: boolean; + setHasDirectLink: (hasDirectLink: boolean) => void; + isUploading: boolean; + setIsUploading: (isUploading: boolean) => void; clearFilters: () => void; } +const StyledCheckbox = styled(Checkbox)(({ theme }) => ({ + paddingTop: 0, + paddingBottom: 0, + paddingLeft: 0, +})); + const FileFilterPopover = ({ storagePolicy, setStoragePolicy, @@ -22,6 +34,12 @@ const FileFilterPopover = ({ setOwner, name, setName, + hasShareLink, + setHasShareLink, + hasDirectLink, + setHasDirectLink, + isUploading, + setIsUploading, clearFilters, onClose, open, @@ -33,6 +51,9 @@ const FileFilterPopover = ({ const [localStoragePolicy, setLocalStoragePolicy] = useState(storagePolicy); const [localOwner, setLocalOwner] = useState(owner); const [localName, setLocalName] = useState(name); + const [localHasShareLink, setLocalHasShareLink] = useState(hasShareLink); + const [localHasDirectLink, setLocalHasDirectLink] = useState(hasDirectLink); + const [localIsUploading, setLocalIsUploading] = useState(isUploading); // Initialize local state when popup opens useEffect(() => { @@ -40,6 +61,9 @@ const FileFilterPopover = ({ setLocalStoragePolicy(storagePolicy); setLocalOwner(owner); setLocalName(name); + setLocalHasShareLink(hasShareLink); + setLocalHasDirectLink(hasDirectLink); + setLocalIsUploading(isUploading); } }, [open]); @@ -48,6 +72,9 @@ const FileFilterPopover = ({ setStoragePolicy(localStoragePolicy); setOwner(localOwner); setName(localName); + setHasShareLink(localHasShareLink); + setHasDirectLink(localHasDirectLink); + setIsUploading(localIsUploading); onClose?.({}, "backdropClick"); }; @@ -56,6 +83,9 @@ const FileFilterPopover = ({ setLocalStoragePolicy(""); setLocalOwner(""); setLocalName(""); + setLocalHasShareLink(false); + setLocalHasDirectLink(false); + setLocalIsUploading(false); clearFilters(); onClose?.({}, "backdropClick"); }; @@ -113,6 +143,44 @@ const FileFilterPopover = ({ /> + + + setLocalHasShareLink(e.target.checked)} + /> + } + label={t("file.shareLinkExisted")} + /> + setLocalHasDirectLink(e.target.checked)} + /> + } + label={t("file.directLinkExisted")} + /> + setLocalIsUploading(e.target.checked)} + /> + } + label={t("file.isUploading")} + /> + + +