Natural ordering of filenames in job artifact browser
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Instead of 1,10,2,20 , the files should be sorted 1,2,10,20. So not the ASCII order but natural order.
Screenshot of 11.11.3 :
Further reading: https://blog.codinghorror.com/sorting-for-humans-natural-sort-order/
Technical proposal
- Change the
updatehook for thejobArtifactsquery to sort the artifacts using natural sort. https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/assets/javascripts/ci/artifacts/components/job_artifacts_table.vue#L89 - The natural sort utility function should live inside the related utility file for the artifacts app https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/assets/javascripts/ci/artifacts/utils.js
- We should add tests for the natural sort function to ensure it orders how we expect it to. The article provided in the description should help with the implementation details.
Due to the change in the order of the artifacts, the
job-checkboxcomponent https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/assets/javascripts/ci/artifacts/components/job_artifacts_table.vue#L432 might need to be adjusted so that the checkboxes, when selected, reflect the correct selection from the user.
Edited by 🤖 GitLab Bot 🤖
