mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-12 12:22:13 +00:00
check tags status before initialize repo tags
This commit is contained in:
parent
dfa86ebc45
commit
ac3280aaaa
@ -7,7 +7,7 @@ import { MetadataAIOperationsProvider } from './metadata-ai-operation';
|
|||||||
// 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);
|
||||||
|
|
||||||
export const MetadataStatusProvider = ({ repoID, repoInfo, hideMetadataView, children }) => {
|
export const MetadataStatusProvider = ({ repoID, repoInfo, hideMetadataView, updateUsedRepoTags, clearRepoTags, children }) => {
|
||||||
const enableMetadataManagement = useMemo(() => {
|
const enableMetadataManagement = useMemo(() => {
|
||||||
if (repoInfo?.encrypted) return false;
|
if (repoInfo?.encrypted) return false;
|
||||||
return window.app.pageOptions.enableMetadataManagement;
|
return window.app.pageOptions.enableMetadataManagement;
|
||||||
@ -60,6 +60,9 @@ export const MetadataStatusProvider = ({ repoID, repoInfo, hideMetadataView, chi
|
|||||||
if (!enableMetadata) {
|
if (!enableMetadata) {
|
||||||
cancelMetadataURL();
|
cancelMetadataURL();
|
||||||
}
|
}
|
||||||
|
if (enableTags) {
|
||||||
|
updateUsedRepoTags();
|
||||||
|
}
|
||||||
setEnableTags(enableTags);
|
setEnableTags(enableTags);
|
||||||
setTagsLang(tagsLang || 'en');
|
setTagsLang(tagsLang || 'en');
|
||||||
setDetailsSettings(JSON.parse(detailsSettings));
|
setDetailsSettings(JSON.parse(detailsSettings));
|
||||||
@ -93,10 +96,12 @@ export const MetadataStatusProvider = ({ repoID, repoInfo, hideMetadataView, chi
|
|||||||
if (newValue === enableTags && lang === tagsLang) return;
|
if (newValue === enableTags && lang === tagsLang) return;
|
||||||
if (!newValue) {
|
if (!newValue) {
|
||||||
cancelMetadataURL(true);
|
cancelMetadataURL(true);
|
||||||
|
clearRepoTags();
|
||||||
}
|
}
|
||||||
setEnableTags(newValue);
|
setEnableTags(newValue);
|
||||||
|
if (newValue) updateUsedRepoTags();
|
||||||
setTagsLang(lang);
|
setTagsLang(lang);
|
||||||
}, [enableTags, tagsLang, cancelMetadataURL]);
|
}, [enableTags, tagsLang, cancelMetadataURL, clearRepoTags, updateUsedRepoTags]);
|
||||||
|
|
||||||
const updateEnableOCR = useCallback((newValue) => {
|
const updateEnableOCR = useCallback((newValue) => {
|
||||||
if (newValue === enableOCR) return;
|
if (newValue === enableOCR) return;
|
||||||
|
@ -420,6 +420,14 @@ class LibContentView extends React.Component {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
clearRepoTags = () => {
|
||||||
|
this.setState({
|
||||||
|
fileTags: [],
|
||||||
|
repoTags: [],
|
||||||
|
usedRepoTags: [],
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
updateColumnMarkdownData = (filePath) => {
|
updateColumnMarkdownData = (filePath) => {
|
||||||
let repoID = this.props.repoID;
|
let repoID = this.props.repoID;
|
||||||
// update state
|
// update state
|
||||||
@ -454,9 +462,6 @@ class LibContentView extends React.Component {
|
|||||||
|
|
||||||
// load data
|
// load data
|
||||||
loadDirData = (path) => {
|
loadDirData = (path) => {
|
||||||
// list used FileTags
|
|
||||||
this.updateUsedRepoTags();
|
|
||||||
|
|
||||||
if (this.state.isTreePanelShown) {
|
if (this.state.isTreePanelShown) {
|
||||||
this.loadSidePanel(path);
|
this.loadSidePanel(path);
|
||||||
}
|
}
|
||||||
@ -2315,7 +2320,7 @@ class LibContentView extends React.Component {
|
|||||||
}
|
}
|
||||||
const detailDirent = currentDirent || currentNode?.object || null;
|
const detailDirent = currentDirent || currentNode?.object || null;
|
||||||
return (
|
return (
|
||||||
<MetadataStatusProvider repoID={repoID} repoInfo={currentRepoInfo} hideMetadataView={this.hideMetadataView}>
|
<MetadataStatusProvider repoID={repoID} repoInfo={currentRepoInfo} hideMetadataView={this.hideMetadataView} updateUsedRepoTags={this.updateUsedRepoTags} clearRepoTags={this.clearRepoTags} >
|
||||||
<TagsProvider repoID={repoID} currentPath={path} repoInfo={currentRepoInfo} selectTagsView={this.onTreeNodeClick} >
|
<TagsProvider repoID={repoID} currentPath={path} repoInfo={currentRepoInfo} selectTagsView={this.onTreeNodeClick} >
|
||||||
<MetadataProvider repoID={repoID} currentPath={path} repoInfo={currentRepoInfo} selectMetadataView={this.onTreeNodeClick} >
|
<MetadataProvider repoID={repoID} currentPath={path} repoInfo={currentRepoInfo} selectMetadataView={this.onTreeNodeClick} >
|
||||||
<CollaboratorsProvider repoID={repoID}>
|
<CollaboratorsProvider repoID={repoID}>
|
||||||
|
Loading…
Reference in New Issue
Block a user