d8c14b51a3
* Create ConsulNodeList component * Implement ConsulNodeList and the new Search/Sort to Node List page * Minor styling fix to align the first icons in composite row * Fix-up and add tests for the redesigned Node List page * Add Leader to composite row for Node List page * Add test for node leader
38 lines
962 B
JavaScript
38 lines
962 B
JavaScript
export default () => key => {
|
|
if (key.startsWith('Status:')) {
|
|
return function(serviceA, serviceB) {
|
|
const [, dir] = key.split(':');
|
|
let a, b;
|
|
if (dir === 'asc') {
|
|
b = serviceA;
|
|
a = serviceB;
|
|
} else {
|
|
a = serviceA;
|
|
b = serviceB;
|
|
}
|
|
switch (true) {
|
|
case a.ChecksCritical > b.ChecksCritical:
|
|
return 1;
|
|
case a.ChecksCritical < b.ChecksCritical:
|
|
return -1;
|
|
default:
|
|
switch (true) {
|
|
case a.ChecksWarning > b.ChecksWarning:
|
|
return 1;
|
|
case a.ChecksWarning < b.ChecksWarning:
|
|
return -1;
|
|
default:
|
|
switch (true) {
|
|
case a.ChecksPassing < b.ChecksPassing:
|
|
return 1;
|
|
case a.ChecksPassing > b.ChecksPassing:
|
|
return -1;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
};
|
|
}
|
|
return key;
|
|
};
|