mirror of
https://github.com/gurucomputing/headscale-ui.git
synced 2026-07-18 00:46:59 +00:00
Merge pull request #40 from gurucomputing/34-last-seen-sort-works-in-wrong-direction
fix sort based on lastseen
This commit is contained in:
commit
60bd0bed4b
1 changed files with 4 additions and 0 deletions
|
|
@ -286,6 +286,10 @@
|
|||
});
|
||||
|
||||
await headscaleDeviceResponse.json().then((data) => {
|
||||
// flip the sort direction if based on lastSeen
|
||||
if(sortKey == "lastSeen") {
|
||||
sortDirection == 'ascending' ? sortDirection = 'descending' : sortDirection = 'ascending';
|
||||
}
|
||||
if (sortDirection == 'ascending') {
|
||||
headscaleDevices = data.machines.sort((a: Device, b: Device) => (a[sortKey as keyof Device] < b[sortKey as keyof Device] ? -1 : 1));
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue