feat: add tool for anvil sorting

main
Josue 4 years ago committed by Tsu-ba-me
parent 54d777b989
commit d416ec2980
  1. 14
      striker-ui/components/Anvils/sortAnvils.ts

@ -0,0 +1,14 @@
const sortAnvils = (unsortedList: AnvilListItem[]): AnvilListItem[] => {
const optimal: AnvilListItem[] = [];
const notReady: AnvilListItem[] = [];
const degraded: AnvilListItem[] = [];
unsortedList.forEach((anvil) => {
if (anvil.anvil_state === 'optimal') optimal.push(anvil);
else if (anvil.anvil_state === 'not_ready') notReady.push(anvil);
else degraded.push(anvil);
});
return [...degraded, ...notReady, ...optimal];
};
export default sortAnvils;
Loading…
Cancel
Save