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:
@@ -103,7 +103,6 @@ export const MetadataProvider = ({ repoID, hideMetadataView, selectMetadataView,
|
|||||||
view_id: view._id,
|
view_id: view._id,
|
||||||
};
|
};
|
||||||
selectMetadataView(node);
|
selectMetadataView(node);
|
||||||
setShowFirstView(false);
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [repoID, selectMetadataView]);
|
}, [repoID, selectMetadataView]);
|
||||||
|
|
||||||
@@ -166,6 +165,7 @@ export const MetadataProvider = ({ repoID, hideMetadataView, selectMetadataView,
|
|||||||
enableMetadata,
|
enableMetadata,
|
||||||
updateEnableMetadata,
|
updateEnableMetadata,
|
||||||
showFirstView,
|
showFirstView,
|
||||||
|
setShowFirstView,
|
||||||
navigation,
|
navigation,
|
||||||
viewsMap: viewsMap.current,
|
viewsMap: viewsMap.current,
|
||||||
selectView,
|
selectView,
|
||||||
|
@@ -5,7 +5,8 @@ import Context from '../context';
|
|||||||
import Store from '../store';
|
import Store from '../store';
|
||||||
import { EVENT_BUS_TYPE, PER_LOAD_NUMBER } from '../constants';
|
import { EVENT_BUS_TYPE, PER_LOAD_NUMBER } from '../constants';
|
||||||
import { Utils } from '../../../utils/utils';
|
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);
|
const MetadataContext = React.createContext(null);
|
||||||
|
|
||||||
@@ -19,6 +20,7 @@ export const MetadataProvider = ({
|
|||||||
const [metadata, setMetadata] = useState({ rows: [], columns: [] });
|
const [metadata, setMetadata] = useState({ rows: [], columns: [] });
|
||||||
const storeRef = useRef(null);
|
const storeRef = useRef(null);
|
||||||
const { collaborators } = useCollaborators();
|
const { collaborators } = useCollaborators();
|
||||||
|
const { showFirstView, setShowFirstView } = usePropsMetadata();
|
||||||
|
|
||||||
const tableChanged = useCallback(() => {
|
const tableChanged = useCallback(() => {
|
||||||
setMetadata(storeRef.current.data);
|
setMetadata(storeRef.current.data);
|
||||||
@@ -54,7 +56,11 @@ export const MetadataProvider = ({
|
|||||||
window.sfMetadataStore = storeRef.current;
|
window.sfMetadataStore = storeRef.current;
|
||||||
storeRef.current.initStartIndex();
|
storeRef.current.initStartIndex();
|
||||||
storeRef.current.load(PER_LOAD_NUMBER).then(() => {
|
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);
|
setMetadata(storeRef.current.data);
|
||||||
|
setShowFirstView(false);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
const errorMsg = Utils.getErrorMsg(error);
|
const errorMsg = Utils.getErrorMsg(error);
|
||||||
|
Reference in New Issue
Block a user