mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 07:27:04 +00:00
order file-chooser list (#2791)
This commit is contained in:
@@ -2,6 +2,7 @@ import React from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
import Dirent from '../../models/dirent';
|
import Dirent from '../../models/dirent';
|
||||||
|
import { Utils } from '../../utils/utils';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
isShowFile: PropTypes.bool,
|
isShowFile: PropTypes.bool,
|
||||||
@@ -52,6 +53,7 @@ class DirentListItem extends React.Component {
|
|||||||
direntList.push(dirent);
|
direntList.push(dirent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
direntList = Utils.sortDirents(direntList, 'name', 'asc');
|
||||||
this.setState({
|
this.setState({
|
||||||
hasRequest: true,
|
hasRequest: true,
|
||||||
direntList: direntList,
|
direntList: direntList,
|
||||||
|
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
|
|||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
import Dirent from '../../models/dirent';
|
import Dirent from '../../models/dirent';
|
||||||
import DirentListItem from './dirent-list-item';
|
import DirentListItem from './dirent-list-item';
|
||||||
|
import { Utils } from '../../utils/utils';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
isShowFile: PropTypes.bool,
|
isShowFile: PropTypes.bool,
|
||||||
@@ -29,14 +30,14 @@ class DirentListView extends React.Component {
|
|||||||
if (this.props.isShowFile === true) {
|
if (this.props.isShowFile === true) {
|
||||||
let dirent = new Dirent(item);
|
let dirent = new Dirent(item);
|
||||||
direntList.push(dirent);
|
direntList.push(dirent);
|
||||||
|
} else {
|
||||||
|
if (item.type === 'dir') {
|
||||||
|
let dirent = new Dirent(item);
|
||||||
|
direntList.push(dirent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (item.type === 'dir') {
|
direntList = Utils.sortDirents(direntList, 'name', 'asc');
|
||||||
let dirent = new Dirent(item);
|
this.setState({direntList: direntList});
|
||||||
direntList.push(dirent);
|
|
||||||
}
|
|
||||||
this.setState({
|
|
||||||
direntList: direntList,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
|
|||||||
import RepoListView from './repo-list-view';
|
import RepoListView from './repo-list-view';
|
||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
import { gettext } from '../../utils/constants';
|
import { gettext } from '../../utils/constants';
|
||||||
|
import { Utils } from '../../utils/utils';
|
||||||
import RepoInfo from '../../models/repo-info';
|
import RepoInfo from '../../models/repo-info';
|
||||||
|
|
||||||
import '../../css/file-chooser.css';
|
import '../../css/file-chooser.css';
|
||||||
@@ -63,6 +64,7 @@ class FileChooser extends React.Component {
|
|||||||
repoList.push(repos[i]);
|
repoList.push(repos[i]);
|
||||||
repoIdList.push(repos[i].repo_id);
|
repoIdList.push(repos[i].repo_id);
|
||||||
}
|
}
|
||||||
|
repoList = Utils.sortRepos(repoList, 'name', 'asc');
|
||||||
this.setState({
|
this.setState({
|
||||||
repoList: repoList,
|
repoList: repoList,
|
||||||
isOtherRepoShow: !this.state.isOtherRepoShow,
|
isOtherRepoShow: !this.state.isOtherRepoShow,
|
||||||
|
Reference in New Issue
Block a user