ggoodrich-ipp opened a new pull request #10: Adding/fixing sort functionality to the standard list views URL: https://github.com/apache/cloudstack-primate/pull/10 This commit loosely relates to [issue #3](https://github.com/apache/cloudstack-primate/issues/3) regarding sorting capabilities. I have pulled sorting code from the old UI project and updated it to fit into the new structure as utils/sort.js. I have altered the AutogenView to leverage this new sorting function. The original sorting code was not functioning, and I discovered that even the sample code in the Vue.js documentation doesn't actually work properly. This code will attempt to detect the data type of the data in a column, and sort based upon that type of data. This will only work when both rows being compared have the same type of data in the column being sorted. It falls through in the following **precedence**: 1. Ipv4 address/CIDR 2. Ipv6 address/CIDR 3. Numeric 4. Text This is doing client-side sorting via the ant-design-vue Table.sorter hook, which has some advantages as well as disadvantages. **Advantages:** 1. The Table Vue has built-in functionality to show the sort arrows, and to toggle them back and forth, including turning off the sort arrows on all other columns when a different column is clicked. 2. No calls back to the API to re-fetch data 3. No need to make the API capable of handing back data sorted via different columns and orders **Disadvantages:** 1. Ant-design-vue Table sorting has 3 ordering states per column, ascending, descending, and unsorted. I cannot find a way to bypass the unsorted state. When clicking a column heading, it will do ascending, then descending, then unsorted. This seems non-intuitive to me from a user perspective on click events, and leaves the list in an undefined and non-intuitive sort order. 2. The sorting seems to persist across different views when the column being sorted matches the name of the column of the prior view. This is pretty common in CloudStack Primate due to most of the views having the column "Name" as the first column. I didn't spend much time trying to determine a remedy to this. **Additional functionality**: I believe it would be beneficial to have any/all views initially sorted in some manner, probably by the first column "Name". I did not investigate how challenging this may be to accomplish. It may be fairly simple.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
