-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sort files and folders in the share path #1960
Conversation
@bsekachev I am not sure if I should update this change as a patch or a minor version. I am also not sure if should mention this small change in the documentation. Do you have input regarding this? |
Pull Request Test Coverage Report for Build 6655
💛 - Coveralls |
@BenjiSchlotter Hi, please |
@@ -129,6 +129,8 @@ export default class FileManager extends React.PureComponent<Props, State> { | |||
|
|||
private renderShareSelector(): JSX.Element { | |||
function renderTreeNodes(data: TreeNodeNormal[]): JSX.Element[] { | |||
// sort alphabetically | |||
data.sort((a, b) => (a.key > b.key) ? 1 : -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Static linter shows the issue here: Arrow function used ambiguously with a conditional expression.eslintno-confusing-arrow
Maybe use such kind of sorting?
data.sort((a: TreeNodeNormal, b: TreeNodeNormal): number => a.key.localeCompare(b.key));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to your suggestion.
@BenjiSchlotter Thanks again for the contribution |
Motivation and context
Currently the files and folders lists under share path in the task creation view are not sorted. This can be annoying to work with when creating tasks manually for a lot of folders.
How has this been tested?
Added a path as share path with a lot of sub folders and checked manually that those folders are sorted alphabetically.
Checklist
develop
branch- [ ] I have added tests to cover my changescvat-core, cvat-data and cvat-ui)
License
Feel free to contact the maintainers if that's a concern.
- [ ] I have updated the license header for each file (see an example below)