mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-02 07:47:32 +00:00
Merge pull request #7781 from haiwen/sdoc-right-panel-loading
add right-panel loading
This commit is contained in:
commit
adb9940d88
@ -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,14 @@ const EmbeddedFileDetails = ({ repoID, repoInfo, dirent, path, onClose, width =
|
||||
)}
|
||||
</Header>
|
||||
<Body>
|
||||
{dirent && direntDetail && (
|
||||
<div className="detail-content">
|
||||
<FileDetails repoID={repoID} isShowRepoTags={false} dirent={dirent} direntDetail={direntDetail} />
|
||||
</div>
|
||||
)}
|
||||
{isFetching ?
|
||||
<div className="detail-content"><Loading /></div>
|
||||
:
|
||||
dirent && direntDetail && (
|
||||
<div className="detail-content">
|
||||
<FileDetails repoID={repoID} isShowRepoTags={false} dirent={dirent} direntDetail={direntDetail} />
|
||||
</div>
|
||||
)}
|
||||
</Body>
|
||||
</div>
|
||||
</MetadataDetailsProvider>
|
||||
|
@ -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 (
|
||||
<div style={{ width: '300px' }}>
|
||||
<Loading/>
|
||||
</div>
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
return (
|
||||
<MetadataStatusContext.Provider
|
||||
value={{
|
||||
|
@ -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]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user