mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 23:20:51 +00:00
repair bug (#3272)
This commit is contained in:
@@ -68,6 +68,10 @@ class DirentListItem extends React.Component {
|
||||
this.setState({
|
||||
highlight: false,
|
||||
isOperationShow: false,
|
||||
}, () => {
|
||||
if (nextProps.activeDirent && nextProps.activeDirent.name === nextProps.dirent.name) {
|
||||
this.setState({isOperationShow: true});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -494,7 +498,7 @@ class DirentListItem extends React.Component {
|
||||
}
|
||||
</Fragment> :
|
||||
<Fragment>
|
||||
{(this.state.isOperationShow || (activeDirent && dirent.name === activeDirent.name)) &&
|
||||
{this.state.isOperationShow &&
|
||||
<div className="operations">
|
||||
<ul className="operation-group">
|
||||
<li className="operation-group-item">
|
||||
|
@@ -18,14 +18,23 @@ class DirentMenu extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
isItemMenuShow: false
|
||||
isItemMenuShow: false,
|
||||
menuList: [],
|
||||
};
|
||||
this.menuList = [];
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.menuList = this.calculateMenuList();
|
||||
this.listenerId = listener.register(this.onShowMenu, this.onHideMenu);
|
||||
let { currentRepoInfo, dirent, isRepoOwner } = this.props;
|
||||
let menuList = this.calculateMenuList(currentRepoInfo, dirent, isRepoOwner);
|
||||
this.setState({menuList: menuList});
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
let { currentRepoInfo, dirent, isRepoOwner } = nextProps;
|
||||
let menuList = this.calculateMenuList(currentRepoInfo, dirent, isRepoOwner);
|
||||
this.setState({menuList: menuList});
|
||||
|
||||
}
|
||||
|
||||
componentWillUnmount () {
|
||||
@@ -45,8 +54,7 @@ class DirentMenu extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
calculateMenuList() {
|
||||
let { currentRepoInfo, dirent, isRepoOwner } = this.props;
|
||||
calculateMenuList(currentRepoInfo, dirent, isRepoOwner) {
|
||||
|
||||
let type = dirent.type;
|
||||
let permission = dirent.permission;
|
||||
@@ -172,7 +180,7 @@ class DirentMenu extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
if (!this.menuList.length) {
|
||||
if (!this.state.menuList.length) {
|
||||
return '';
|
||||
}
|
||||
return (
|
||||
@@ -186,7 +194,7 @@ class DirentMenu extends React.Component {
|
||||
onClick={this.onDropdownToggleClick}
|
||||
/>
|
||||
<DropdownMenu>
|
||||
{this.menuList.map((menuItem, index) => {
|
||||
{this.state.menuList.map((menuItem, index) => {
|
||||
if (menuItem === 'Divider') {
|
||||
return <DropdownItem key={index} divider/>;
|
||||
} else {
|
||||
|
@@ -19,6 +19,7 @@ class RepoInfo {
|
||||
this.has_been_shared_out = object.has_been_shared_out;
|
||||
this.encrypted = object.encrypted;
|
||||
this.lib_need_decrypt = object.lib_need_decrypt;
|
||||
this.last_modified= object.last_modified;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -119,6 +119,7 @@ class LibContentContainer extends React.Component {
|
||||
|
||||
onItemSelected = (dirent) => {
|
||||
this.setState({currentDirent: dirent});
|
||||
this.props.onItemSelected(dirent);
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -173,7 +174,7 @@ class LibContentContainer extends React.Component {
|
||||
onAddFolder={this.props.onAddFolder}
|
||||
onAddFile={this.props.onAddFile}
|
||||
onItemClick={this.onItemClick}
|
||||
onItemSelected={this.props.onItemSelected}
|
||||
onItemSelected={this.onItemSelected}
|
||||
onItemDelete={this.props.onItemDelete}
|
||||
onItemRename={this.props.onItemRename}
|
||||
onItemMove={this.props.onItemMove}
|
||||
@@ -236,7 +237,7 @@ class LibContentContainer extends React.Component {
|
||||
onAddFolder={this.props.onAddFolder}
|
||||
onAddFile={this.props.onAddFile}
|
||||
onItemClick={this.onItemClick}
|
||||
onItemSelected={this.props.onItemSelected}
|
||||
onItemSelected={this.onItemSelected}
|
||||
onItemDelete={this.props.onItemDelete}
|
||||
onItemRename={this.props.onItemRename}
|
||||
onItemMove={this.props.onItemMove}
|
||||
|
@@ -337,6 +337,7 @@ class RepoView(APIView):
|
||||
"has_been_shared_out": has_been_shared_out,
|
||||
|
||||
"lib_need_decrypt": lib_need_decrypt,
|
||||
"last_modified": timestamp_to_isoformat_timestr(repo.last_modify),
|
||||
}
|
||||
|
||||
return Response(result)
|
||||
|
Reference in New Issue
Block a user