diff --git a/frontend/src/components/dialog/wiki-select-dialog.js b/frontend/src/components/dialog/wiki-select-dialog.js index 32ca5bd854..5f661b1611 100644 --- a/frontend/src/components/dialog/wiki-select-dialog.js +++ b/frontend/src/components/dialog/wiki-select-dialog.js @@ -4,6 +4,8 @@ import { gettext, siteRoot } from '../../utils/constants'; import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; import { seafileAPI } from '../../utils/seafile-api'; import moment from 'moment'; +import Repo from '../../models/repo'; +import { Utils } from '../../utils/utils'; const propTypes = { toggleCancel: PropTypes.func.isRequired, @@ -24,9 +26,12 @@ class WikiSelectDialog extends React.Component { componentDidMount() { seafileAPI.listRepos().then(res => { - this.setState({ - repos: res.data.repos, - }); + let repoList = res.data.repos.map(item => { + let repo = new Repo(item); + return repo; + }); + repoList = Utils.sortRepos(repoList, 'name', 'asc'); + this.setState({repos: repoList}); }); } @@ -66,7 +71,7 @@ class WikiSelectDialog extends React.Component { return (