feat: set childs under maintenance if parent is too

This commit is contained in:
Peace
2023-01-28 14:02:10 +01:00
parent aba515e172
commit f3ac351d75
3 changed files with 40 additions and 8 deletions

View File

@@ -1322,7 +1322,17 @@ class Monitor extends BeanModel {
ON maintenance_timeslot.maintenance_id = maintenance.id
WHERE ${activeCondition}
LIMIT 1`, [ monitorID ]);
return maintenance.count !== 0;
if (maintenance.count !== 0) {
return true;
}
// Check if parent is under maintenance
const parent = await Monitor.getParent(monitorID);
if (parent === null) {
return false;
}
return await Monitor.isUnderMaintenance(parent.id);
}
/** Make sure monitor interval is between bounds */