Device List now properly sorts by status.

This commit is contained in:
Gunther Brunner
2014-05-29 01:40:30 +09:00
parent 0901a1a5f7
commit cb6c7a1b5c
5 changed files with 62 additions and 51 deletions

View File

@@ -92,6 +92,23 @@ module.exports = function DeviceServiceFactory($http, socket) {
break
}
}
data.stateSorting = getStateSorting(data.state)
}
// For convenience, add the sorting priority to each state
function getStateSorting(state) {
return {
'using': 1,
'available': 2,
'ready': 3,
'present': 4,
'busy': 5,
'absent': 6,
'preparing': 7,
'unauthorized': 8,
'offline': 9
}[state] || 10
}
function get(data) {