1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-17 07:41:26 +00:00

change get group-list api

This commit is contained in:
shanshuirenjia
2018-12-10 13:30:44 +08:00
parent f6cff08bc6
commit 3240802532
2 changed files with 7 additions and 10 deletions

View File

@@ -26,13 +26,11 @@ class RepoListViewPanel extends React.Component {
componentDidMount() { componentDidMount() {
let group = this.props.group; let group = this.props.group;
seafileAPI.listGroupRepos(group.id).then(res => { let repoList = group.repos.map(item => {
let repoList = res.data.map(item => {
let repo = new RepoInfo(item); let repo = new RepoInfo(item);
return repo; return repo;
}); });
this.setState({repoList: repoList}); this.setState({repoList: repoList});
});
} }
render() { render() {
@@ -71,10 +69,10 @@ class GroupsView extends React.Component {
} }
componentDidMount() { componentDidMount() {
seafileAPI.listGroups().then((res) => { // TODO: api name seafileAPI.listGroupsV2({'with_repos': 1}).then((res) => { // TODO: api name
// `{'with_repos': 1}`: list repos of every group // `{'with_repos': 1}`: list repos of every group
// res: {data: [...], status: 200, statusText: "OK", headers: {…}, config: {…}, …} // res: {data: [...], status: 200, statusText: "OK", headers: {…}, config: {…}, …}
let groupList = res.data.groups.map(item => { let groupList = res.data.map(item => {
let group = new Group(item); let group = new Group(item);
return group; return group;
}) })
@@ -96,7 +94,6 @@ class GroupsView extends React.Component {
errorMsg: gettext("Error") errorMsg: gettext("Error")
}); });
} }
} else { } else {
this.setState({ this.setState({
isLoading: false, isLoading: false,

View File

@@ -153,7 +153,7 @@ class Groups(APIView):
contact_email_dict[email] = email2contact_email(email) contact_email_dict[email] = email2contact_email(email)
for r in group_repos: for r in group_repos:
repo_owner = repo_id_owner_dict.get(r.id, r.user), repo_owner = repo_id_owner_dict.get(r.id, r.user)
repo = { repo = {
"id": r.id, "id": r.id,
"repo_id": r.id, "repo_id": r.id,