From 7f74be9e080720299e75ca885ae0b17498583381 Mon Sep 17 00:00:00 2001 From: zhichaona <1255628593@qq.com> Date: Mon, 28 Apr 2025 14:06:30 +0800 Subject: [PATCH 1/3] add right-panel loading --- .../embedded-file-details/index.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/dirent-detail/embedded-file-details/index.js b/frontend/src/components/dirent-detail/embedded-file-details/index.js index 9ad2dfd549..ab917621bb 100644 --- a/frontend/src/components/dirent-detail/embedded-file-details/index.js +++ b/frontend/src/components/dirent-detail/embedded-file-details/index.js @@ -10,6 +10,7 @@ import { MetadataContext } from '../../../metadata'; import { MetadataDetailsProvider } from '../../../metadata/hooks'; import AIIcon from '../../../metadata/components/metadata-details/ai-icon'; import SettingsIcon from '../../../metadata/components/metadata-details/settings-icon'; +import Loading from '../../loading'; import './index.css'; @@ -18,6 +19,7 @@ const { enableSeafileAI } = window.app.config; const EmbeddedFileDetails = ({ repoID, repoInfo, dirent, path, onClose, width = 300, className, component = {} }) => { const { headerComponent } = component; const [direntDetail, setDirentDetail] = useState(''); + const [isFetching, setIsFetching] = useState(true); const isView = useMemo(() => { const urlParams = new URLSearchParams(window.location.search); @@ -28,6 +30,7 @@ const EmbeddedFileDetails = ({ repoID, repoInfo, dirent, path, onClose, width = const fullPath = path.split('/').pop() === dirent?.name ? path : Utils.joinPath(path, dirent?.name || ''); seafileAPI.getFileInfo(repoID, fullPath).then(res => { setDirentDetail(res.data); + setIsFetching(false); }).catch(error => { const errMessage = Utils.getErrorMsg(error); toaster.danger(errMessage); @@ -79,11 +82,15 @@ const EmbeddedFileDetails = ({ repoID, repoInfo, dirent, path, onClose, width = )} - {dirent && direntDetail && ( -
- -
- )} + {isFetching ? + (
+ +
) : + dirent && direntDetail && ( +
+ +
+ )} From e967eb01345c9e3d133780bdf6b42a0e21a1fec3 Mon Sep 17 00:00:00 2001 From: zhichaona <1255628593@qq.com> Date: Mon, 28 Apr 2025 18:11:06 +0800 Subject: [PATCH 2/3] open right-panel in sync && add loading --- frontend/src/hooks/metadata-status.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frontend/src/hooks/metadata-status.js b/frontend/src/hooks/metadata-status.js index 85fcaed513..8144e4c5c9 100644 --- a/frontend/src/hooks/metadata-status.js +++ b/frontend/src/hooks/metadata-status.js @@ -3,6 +3,7 @@ import metadataAPI from '../metadata/api'; import { Utils } from '../utils/utils'; import toaster from '../components/toast'; import { MetadataAIOperationsProvider } from './metadata-ai-operation'; +import Loading from '../components/loading'; // This hook provides content related to seahub interaction, such as whether to enable extended attributes const MetadataStatusContext = React.createContext(null); @@ -123,6 +124,15 @@ export const MetadataStatusProvider = ({ repoID, repoInfo, hideMetadataView, sta }); }, [repoID, detailsSettings]); + if (isLoading) { + return ( +
+ +
+ ); + + } + return ( Date: Tue, 29 Apr 2025 10:37:28 +0800 Subject: [PATCH 3/3] fix code warnings --- .../components/dirent-detail/embedded-file-details/index.js | 5 ++--- .../popover/filter-popover/basic-filters/tags-filter.js | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/dirent-detail/embedded-file-details/index.js b/frontend/src/components/dirent-detail/embedded-file-details/index.js index ab917621bb..d0fbf4b598 100644 --- a/frontend/src/components/dirent-detail/embedded-file-details/index.js +++ b/frontend/src/components/dirent-detail/embedded-file-details/index.js @@ -83,9 +83,8 @@ const EmbeddedFileDetails = ({ repoID, repoInfo, dirent, path, onClose, width = {isFetching ? - (
- -
) : +
+ : dirent && direntDetail && (
diff --git a/frontend/src/metadata/components/popover/filter-popover/basic-filters/tags-filter.js b/frontend/src/metadata/components/popover/filter-popover/basic-filters/tags-filter.js index df2f802ffa..ec5cd58146 100644 --- a/frontend/src/metadata/components/popover/filter-popover/basic-filters/tags-filter.js +++ b/frontend/src/metadata/components/popover/filter-popover/basic-filters/tags-filter.js @@ -85,6 +85,7 @@ const TagsFilter = ({ readOnly, value: oldValue, onChange: onChangeAPI }) => { const onDeleteFilter = useCallback((event) => { event.nativeEvent.stopImmediatePropagation(); onChangeAPI([]); + // eslint-disable-next-line oldValue = []; }, [value, onChangeAPI, oldValue]);