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

order file-chooser list (#2791)

This commit is contained in:
杨顺强
2019-01-09 14:40:36 +08:00
committed by Daniel Pan
parent 9c230cc5db
commit 300251b5b1
3 changed files with 12 additions and 7 deletions

View File

@@ -2,6 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { seafileAPI } from '../../utils/seafile-api';
import Dirent from '../../models/dirent';
import { Utils } from '../../utils/utils';
const propTypes = {
isShowFile: PropTypes.bool,
@@ -52,6 +53,7 @@ class DirentListItem extends React.Component {
direntList.push(dirent);
}
}
direntList = Utils.sortDirents(direntList, 'name', 'asc');
this.setState({
hasRequest: true,
direntList: direntList,

View File

@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import { seafileAPI } from '../../utils/seafile-api';
import Dirent from '../../models/dirent';
import DirentListItem from './dirent-list-item';
import { Utils } from '../../utils/utils';
const propTypes = {
isShowFile: PropTypes.bool,
@@ -29,14 +30,14 @@ class DirentListView extends React.Component {
if (this.props.isShowFile === true) {
let dirent = new Dirent(item);
direntList.push(dirent);
} else {
if (item.type === 'dir') {
let dirent = new Dirent(item);
direntList.push(dirent);
}
}
else if (item.type === 'dir') {
let dirent = new Dirent(item);
direntList.push(dirent);
}
this.setState({
direntList: direntList,
});
direntList = Utils.sortDirents(direntList, 'name', 'asc');
this.setState({direntList: direntList});
});
});
}

View File

@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import RepoListView from './repo-list-view';
import { seafileAPI } from '../../utils/seafile-api';
import { gettext } from '../../utils/constants';
import { Utils } from '../../utils/utils';
import RepoInfo from '../../models/repo-info';
import '../../css/file-chooser.css';
@@ -63,6 +64,7 @@ class FileChooser extends React.Component {
repoList.push(repos[i]);
repoIdList.push(repos[i].repo_id);
}
repoList = Utils.sortRepos(repoList, 'name', 'asc');
this.setState({
repoList: repoList,
isOtherRepoShow: !this.state.isOtherRepoShow,