1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-12 12:22:13 +00:00

Merge pull request #7781 from haiwen/sdoc-right-panel-loading

add right-panel loading
This commit is contained in:
Michael An 2025-04-29 10:39:56 +08:00 committed by GitHub
commit adb9940d88
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 5 deletions

View File

@ -10,6 +10,7 @@ import { MetadataContext } from '../../../metadata';
import { MetadataDetailsProvider } from '../../../metadata/hooks'; import { MetadataDetailsProvider } from '../../../metadata/hooks';
import AIIcon from '../../../metadata/components/metadata-details/ai-icon'; import AIIcon from '../../../metadata/components/metadata-details/ai-icon';
import SettingsIcon from '../../../metadata/components/metadata-details/settings-icon'; import SettingsIcon from '../../../metadata/components/metadata-details/settings-icon';
import Loading from '../../loading';
import './index.css'; import './index.css';
@ -18,6 +19,7 @@ const { enableSeafileAI } = window.app.config;
const EmbeddedFileDetails = ({ repoID, repoInfo, dirent, path, onClose, width = 300, className, component = {} }) => { const EmbeddedFileDetails = ({ repoID, repoInfo, dirent, path, onClose, width = 300, className, component = {} }) => {
const { headerComponent } = component; const { headerComponent } = component;
const [direntDetail, setDirentDetail] = useState(''); const [direntDetail, setDirentDetail] = useState('');
const [isFetching, setIsFetching] = useState(true);
const isView = useMemo(() => { const isView = useMemo(() => {
const urlParams = new URLSearchParams(window.location.search); 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 || ''); const fullPath = path.split('/').pop() === dirent?.name ? path : Utils.joinPath(path, dirent?.name || '');
seafileAPI.getFileInfo(repoID, fullPath).then(res => { seafileAPI.getFileInfo(repoID, fullPath).then(res => {
setDirentDetail(res.data); setDirentDetail(res.data);
setIsFetching(false);
}).catch(error => { }).catch(error => {
const errMessage = Utils.getErrorMsg(error); const errMessage = Utils.getErrorMsg(error);
toaster.danger(errMessage); toaster.danger(errMessage);
@ -79,7 +82,10 @@ const EmbeddedFileDetails = ({ repoID, repoInfo, dirent, path, onClose, width =
)} )}
</Header> </Header>
<Body> <Body>
{dirent && direntDetail && ( {isFetching ?
<div className="detail-content"><Loading /></div>
:
dirent && direntDetail && (
<div className="detail-content"> <div className="detail-content">
<FileDetails repoID={repoID} isShowRepoTags={false} dirent={dirent} direntDetail={direntDetail} /> <FileDetails repoID={repoID} isShowRepoTags={false} dirent={dirent} direntDetail={direntDetail} />
</div> </div>

View File

@ -3,6 +3,7 @@ import metadataAPI from '../metadata/api';
import { Utils } from '../utils/utils'; import { Utils } from '../utils/utils';
import toaster from '../components/toast'; import toaster from '../components/toast';
import { MetadataAIOperationsProvider } from './metadata-ai-operation'; 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 // This hook provides content related to seahub interaction, such as whether to enable extended attributes
const MetadataStatusContext = React.createContext(null); const MetadataStatusContext = React.createContext(null);
@ -123,6 +124,15 @@ export const MetadataStatusProvider = ({ repoID, repoInfo, hideMetadataView, sta
}); });
}, [repoID, detailsSettings]); }, [repoID, detailsSettings]);
if (isLoading) {
return (
<div style={{ width: '300px' }}>
<Loading/>
</div>
);
}
return ( return (
<MetadataStatusContext.Provider <MetadataStatusContext.Provider
value={{ value={{

View File

@ -85,6 +85,7 @@ const TagsFilter = ({ readOnly, value: oldValue, onChange: onChangeAPI }) => {
const onDeleteFilter = useCallback((event) => { const onDeleteFilter = useCallback((event) => {
event.nativeEvent.stopImmediatePropagation(); event.nativeEvent.stopImmediatePropagation();
onChangeAPI([]); onChangeAPI([]);
// eslint-disable-next-line
oldValue = []; oldValue = [];
}, [value, onChangeAPI, oldValue]); }, [value, onChangeAPI, oldValue]);