1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 15:09:14 +00:00

repo wiki mode lib decrypt

This commit is contained in:
ilearnit
2018-12-14 08:49:55 +00:00
parent cccf826116
commit 5c26a4e1c5
2 changed files with 51 additions and 17 deletions

View File

@@ -9,6 +9,8 @@ import MainPanel from './pages/repo-wiki-mode/main-panel';
import Node from './components/tree-view/node';
import Tree from './components/tree-view/tree';
import toaster from './components/toast';
import LibDecryptDialog from './components/dialog/lib-decrypt-dialog';
import ModalPortal from './components/modal-portal';
import Dirent from './models/dirent';
import FileTag from './models/file-tag';
import './assets/css/fa-solid.css';
@@ -40,6 +42,7 @@ class Wiki extends Component {
isDirentSelected: false,
isAllDirentSelected: false,
selectedDirentList: [],
libNeedDecrypt: false
};
window.onpopstate = this.onpopstate;
this.hash = '';
@@ -53,15 +56,23 @@ class Wiki extends Component {
}
componentDidMount() {
if (isDir === 'None') {
this.setState({pathExist: false});
} else if (isDir === 'True') {
this.showDir(initialPath);
} else if (isDir === 'False') {
this.showFile(initialPath);
}
seafileAPI.getRepoInfo(repoID).then(res => {
this.setState({
libNeedDecrypt: res.data.lib_need_decrypt,
});
this.loadSidePanel(initialPath);
if (!res.data.lib_need_decrypt) {
if (isDir === 'None') {
this.setState({pathExist: false});
} else if (isDir === 'True') {
this.showDir(initialPath);
} else if (isDir === 'False') {
this.showFile(initialPath);
}
this.loadSidePanel(initialPath);
}
});
}
@@ -736,7 +747,34 @@ class Wiki extends Component {
});
}
onLibDecryptDialog = () => {
this.setState({
libNeedDecrypt: false,
})
if (isDir === 'None') {
this.setState({pathExist: false});
} else if (isDir === 'True') {
this.showDir(initialPath);
} else if (isDir === 'False') {
this.showFile(initialPath);
}
this.loadSidePanel(initialPath);
}
render() {
let { libNeedDecrypt } = this.state;
if (libNeedDecrypt) {
return (
<ModalPortal>
<LibDecryptDialog repoID={repoID}
onLibDecryptDialog={this.onLibDecryptDialog}
/>
</ModalPortal>
)
}
return (
<div id="main" className="wiki-main">
<SidePanel