mirror of
https://github.com/BluemediaGER/fancy-gatus.git
synced 2024-11-22 22:55:29 +01:00
Make group order customizable
This commit is contained in:
parent
a7547fca94
commit
f4a8cdfeb5
21
src/App.vue
21
src/App.vue
|
@ -44,11 +44,30 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
// Group endpoints by their group name
|
||||
// and sort the groups according to the config if specified
|
||||
groups() {
|
||||
return this.apiData.reduce(function(rv, x) {
|
||||
// Group
|
||||
let groups = this.apiData.reduce(function(rv, x) {
|
||||
(rv[x["group"]] = rv[x["group"]] || []).push(x);
|
||||
return rv;
|
||||
}, {});
|
||||
console.log(groups);
|
||||
// Sort
|
||||
if (this.config.groupOrder) {
|
||||
let order = [...this.config.groupOrder];
|
||||
let tmp = {};
|
||||
Object.assign(tmp, groups);
|
||||
groups = {};
|
||||
order.forEach(key => {
|
||||
if (key in tmp) {
|
||||
groups[key] = tmp[key];
|
||||
delete tmp[key];
|
||||
}
|
||||
});
|
||||
Object.assign(groups, tmp);
|
||||
console.log(groups);
|
||||
}
|
||||
return groups;
|
||||
},
|
||||
// Get an array of all failed endpoints
|
||||
failedEndpoints() {
|
||||
|
|
Loading…
Reference in a new issue