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

add-group

This commit is contained in:
Michael18811380328
2018-12-12 18:24:47 +08:00
parent a088b50514
commit 88b5f119d1
3 changed files with 137 additions and 3 deletions

View File

@@ -5,8 +5,9 @@ import { seafileAPI } from '../../utils/seafile-api';
import Loading from '../../components/loading';
import Group from '../../models/group';
import RepoInfo from '../../models/repoInfo';
import GeneralToolbar from '../../components/toolbar/general-toolbar';
import GroupsToolbar from '../../components/toolbar/groups-toolbar';
import SharedRepoListView from '../../components/shared-repo-list-view/shared-repo-list-view';
import CreateGroupDialog from '../../components/dialog/create-group-dialog';
import '../../css/groups.css';
@@ -76,10 +77,11 @@ class GroupsView extends React.Component {
isLoading: true,
errorMsg: '',
groupList: [],
showAddGroupModal: false,
}
}
componentDidMount() {
listGroups = () => {
seafileAPI.listGroupsV2({'with_repos': 1}).then((res) => { // TODO: api name
// `{'with_repos': 1}`: list repos of every group
// res: {data: [...], status: 200, statusText: "OK", headers: {…}, config: {…}, …}
@@ -114,10 +116,24 @@ class GroupsView extends React.Component {
});
}
toggleAddGroupModal = () => {
this.setState({
showAddGroupModal: !this.state.showAddGroupModal
});
}
componentDidMount() {
this.listGroups();
}
render() {
return (
<Fragment>
<GeneralToolbar onShowSidePanel={this.props.onShowSidePanel} onSearchedClick={this.props.onSearchedClick}/>
<GroupsToolbar
onShowSidePanel={this.props.onShowSidePanel}
onSearchedClick={this.props.onSearchedClick}
toggleAddGroupModal={this.toggleAddGroupModal}
/>
<div className="main-panel-center">
<div className="cur-view-container">
<div className="cur-view-path">
@@ -135,11 +151,24 @@ class GroupsView extends React.Component {
</div>
</div>
</div>
{ this.state.showAddGroupModal &&
<CreateGroupDialog
toggleAddGroupModal={this.toggleAddGroupModal}
listGroups={this.listGroups}
showAddGroupModal={this.state.showAddGroupModal}
/>
}
</Fragment>
);
}
}
const GroupsViewPropTypes = {
onShowSidePanel: PropTypes.func.isRequired,
onSearchedClick: PropTypes.func.isRequired,
};
GroupsView.propTypes = GroupsViewPropTypes;
// Groups.propTypes = propTypes;
export default GroupsView;