I was first wondering if natural sort would solve this issue, so I gave it a try and screenshots show as follows:
I also do some refactorings:
natural_time_delta_sort Flag: declared in facts.py assigned True if fact=uptime and it's for setting sorting type of DataTable in _macros.html. Fact is also available in template so I think we can determine sorting type by fact directly without any flags. In other words, I'd like to add logics like if fact="uptime", then type="natural-time-delta" just inside template, and natural_time_delta_sort will be removed.
Sorter Map: Create a map whose key=fact and value=sorter. Key-value will be isolated in a new html file named _facts_sorter.html, now having (uptime, natural-time-delta) and (kernelrelease, natural). In this way it's easier to maintain if there is a new request for custom sorting.
The values of kernelrelease fact for my Centos 7 nodes sorted in descending order are now sorted as alphanumeric strings, so for example like this:
...while I would expect them interpreted as package versions and shown from latest to oldest so like this: