mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-05 08:53:14 +00:00
fix: tags load dir
This commit is contained in:
@@ -119,7 +119,7 @@ class DirPath extends React.Component {
|
|||||||
path = path[path.length - 1] === '/' ? path.slice(0, path.length - 1) : path;
|
path = path[path.length - 1] === '/' ? path.slice(0, path.length - 1) : path;
|
||||||
let pathList = path.split('/');
|
let pathList = path.split('/');
|
||||||
let nodePath = '';
|
let nodePath = '';
|
||||||
if (pathList.length === 2 && !pathList[0] && pathList[1] === PRIVATE_FILE_TYPE.FILE_EXTENDED_PROPERTIES) {
|
if (pathList.length === 2 && !pathList[0] && [PRIVATE_FILE_TYPE.FILE_EXTENDED_PROPERTIES, PRIVATE_FILE_TYPE.TAGS_PROPERTIES].includes(pathList[1])) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
let pathElem = pathList.map((item, index) => {
|
let pathElem = pathList.map((item, index) => {
|
||||||
|
@@ -197,6 +197,9 @@ class LibContentView extends React.Component {
|
|||||||
const viewID = urlParams.get('view');
|
const viewID = urlParams.get('view');
|
||||||
if (viewID) return `/${PRIVATE_FILE_TYPE.FILE_EXTENDED_PROPERTIES}`;
|
if (viewID) return `/${PRIVATE_FILE_TYPE.FILE_EXTENDED_PROPERTIES}`;
|
||||||
|
|
||||||
|
const tagID = urlParams.get('tag');
|
||||||
|
if (tagID) return `/${PRIVATE_FILE_TYPE.TAGS_PROPERTIES}`;
|
||||||
|
|
||||||
let location = window.location.href.split('?')[0];
|
let location = window.location.href.split('?')[0];
|
||||||
location = decodeURIComponent(location);
|
location = decodeURIComponent(location);
|
||||||
let path = location.slice(location.indexOf(repoID) + repoID.length + 1);
|
let path = location.slice(location.indexOf(repoID) + repoID.length + 1);
|
||||||
@@ -392,14 +395,14 @@ class LibContentView extends React.Component {
|
|||||||
this.loadSidePanel(path);
|
this.loadSidePanel(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!path.includes(PRIVATE_FILE_TYPE.FILE_EXTENDED_PROPERTIES)) {
|
if (!(path.includes(PRIVATE_FILE_TYPE.FILE_EXTENDED_PROPERTIES) || path.includes(PRIVATE_FILE_TYPE.TAGS_PROPERTIES))) {
|
||||||
this.showDir(path);
|
this.showDir(path);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
loadSidePanel = (path) => {
|
loadSidePanel = (path) => {
|
||||||
let repoID = this.props.repoID;
|
let repoID = this.props.repoID;
|
||||||
if (path === '/' || path.includes(PRIVATE_FILE_TYPE.FILE_EXTENDED_PROPERTIES)) {
|
if (path === '/' || path.includes(PRIVATE_FILE_TYPE.FILE_EXTENDED_PROPERTIES) || path.includes(PRIVATE_FILE_TYPE.TAGS_PROPERTIES)) {
|
||||||
seafileAPI.listDir(repoID, '/').then(res => {
|
seafileAPI.listDir(repoID, '/').then(res => {
|
||||||
const { dirent_list, user_perm } = res.data;
|
const { dirent_list, user_perm } = res.data;
|
||||||
let tree = this.state.treeData;
|
let tree = this.state.treeData;
|
||||||
@@ -1863,7 +1866,8 @@ class LibContentView extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (node.object.isDir()) { // isDir
|
if (node.object.isDir()) { // isDir
|
||||||
if (this.state.path.includes(PRIVATE_FILE_TYPE.FILE_EXTENDED_PROPERTIES)) {
|
if (this.state.path.includes(PRIVATE_FILE_TYPE.FILE_EXTENDED_PROPERTIES) ||
|
||||||
|
this.state.path.includes(PRIVATE_FILE_TYPE.TAGS_PROPERTIES)) {
|
||||||
this.isNeedUpdateHistoryState = true;
|
this.isNeedUpdateHistoryState = true;
|
||||||
}
|
}
|
||||||
this.showDir(node.path);
|
this.showDir(node.path);
|
||||||
@@ -1988,22 +1992,21 @@ class LibContentView extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
resetSelected = (node) => {
|
resetSelected = (node) => {
|
||||||
|
const currentModel = this.state.currentMode;
|
||||||
|
const path = node.path || '';
|
||||||
|
let nextModel = cookie.load('seafile_view_mode') || LIST_MODE;
|
||||||
|
if (currentModel === METADATA_MODE && path.startsWith('/' + PRIVATE_FILE_TYPE.FILE_EXTENDED_PROPERTIES + '/')) {
|
||||||
|
nextModel = METADATA_MODE;
|
||||||
|
}
|
||||||
|
if (currentModel === TAGS_MODE && path.startsWith('/' + PRIVATE_FILE_TYPE.TAGS_PROPERTIES + '/')) {
|
||||||
|
nextModel = TAGS_MODE;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
isDirentSelected: false,
|
isDirentSelected: false,
|
||||||
isAllDirentSelected: false,
|
isAllDirentSelected: false,
|
||||||
|
currentMode: nextModel,
|
||||||
});
|
});
|
||||||
const path = node.path || '';
|
|
||||||
if (this.state.currentMode === METADATA_MODE) {
|
|
||||||
const isMetadataView = path.startsWith('/' + PRIVATE_FILE_TYPE.FILE_EXTENDED_PROPERTIES);
|
|
||||||
this.setState({
|
|
||||||
currentMode: cookie.load('seafile_view_mode') || (isMetadataView ? METADATA_MODE : LIST_MODE),
|
|
||||||
});
|
|
||||||
} else if (this.state.currentMode === TAGS_MODE) {
|
|
||||||
const isTagsView = path.startsWith('/' + PRIVATE_FILE_TYPE.TAGS_PROPERTIES);
|
|
||||||
this.setState({
|
|
||||||
currentMode: cookie.load('seafile_view_mode') || (isTagsView ? TAGS_MODE : LIST_MODE),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
recalculateSelectedDirents = (unSelectNames, newDirentList) => {
|
recalculateSelectedDirents = (unSelectNames, newDirentList) => {
|
||||||
@@ -2392,7 +2395,7 @@ class LibContentView extends React.Component {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{canUpload && this.state.pathExist && !this.state.isViewFile && this.state.currentMode !== METADATA_MODE && (
|
{canUpload && this.state.pathExist && !this.state.isViewFile && ![METADATA_MODE, TAGS_MODE].includes(this.state.currentMode) && (
|
||||||
<FileUploader
|
<FileUploader
|
||||||
ref={uploader => this.uploader = uploader}
|
ref={uploader => this.uploader = uploader}
|
||||||
dragAndDrop={true}
|
dragAndDrop={true}
|
||||||
|
Reference in New Issue
Block a user