1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-13 13:50:07 +00:00

feat: metadata init tip (#6644)

* feat: metadata init tip

* feat: optimize tip

* feat: update code

* feat: update code

---------

Co-authored-by: 杨国璇 <ygx@Hello-word.local>
This commit is contained in:
杨国璇
2024-08-27 13:34:26 +08:00
committed by GitHub
parent 0c29c4f27c
commit d2d264c1f9
2 changed files with 8 additions and 2 deletions

View File

@@ -103,7 +103,6 @@ export const MetadataProvider = ({ repoID, hideMetadataView, selectMetadataView,
view_id: view._id,
};
selectMetadataView(node);
setShowFirstView(false);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [repoID, selectMetadataView]);
@@ -166,6 +165,7 @@ export const MetadataProvider = ({ repoID, hideMetadataView, selectMetadataView,
enableMetadata,
updateEnableMetadata,
showFirstView,
setShowFirstView,
navigation,
viewsMap: viewsMap.current,
selectView,

View File

@@ -5,7 +5,8 @@ import Context from '../context';
import Store from '../store';
import { EVENT_BUS_TYPE, PER_LOAD_NUMBER } from '../constants';
import { Utils } from '../../../utils/utils';
import { useCollaborators } from '../../hooks';
import { useCollaborators, useMetadata as usePropsMetadata } from '../../hooks';
import { gettext } from '../utils';
const MetadataContext = React.createContext(null);
@@ -19,6 +20,7 @@ export const MetadataProvider = ({
const [metadata, setMetadata] = useState({ rows: [], columns: [] });
const storeRef = useRef(null);
const { collaborators } = useCollaborators();
const { showFirstView, setShowFirstView } = usePropsMetadata();
const tableChanged = useCallback(() => {
setMetadata(storeRef.current.data);
@@ -54,7 +56,11 @@ export const MetadataProvider = ({
window.sfMetadataStore = storeRef.current;
storeRef.current.initStartIndex();
storeRef.current.load(PER_LOAD_NUMBER).then(() => {
if (showFirstView && storeRef.current.data.rows.length === 0) {
toaster.success(gettext('The files\' metadata is being created. This may take a minute or so. Please refresh the page later.'));
}
setMetadata(storeRef.current.data);
setShowFirstView(false);
setLoading(false);
}).catch(error => {
const errorMsg = Utils.getErrorMsg(error);