feat: set group to pending if all childs are paused.

This commit is contained in:
Peace 2024-10-14 00:01:55 +02:00
parent 9eda25d0b6
commit b02b21299b
No known key found for this signature in database
GPG key ID: 0EF6B46E172B739F

View file

@ -380,7 +380,11 @@ class Monitor extends BeanModel {
} else if (this.type === "group") { } else if (this.type === "group") {
const children = await Monitor.getChildren(this.id); const children = await Monitor.getChildren(this.id);
if (children.length > 0) { if (children.length > 0 && children.filter(child => child.active).length === 0) {
// Set status pending if all children are paused
bean.status = PENDING;
bean.msg = "All Children are paused.";
} else if (children.length > 0) {
bean.status = UP; bean.status = UP;
bean.msg = "All children up and running"; bean.msg = "All children up and running";
for (const child of children) { for (const child of children) {