fix: Create parent group as active when cloning active monitor (#6448)

This commit is contained in:
Clayton 2026-01-19 05:43:14 -06:00 committed by Clayton
parent 9169a647cb
commit 6d0d72e8d8
2 changed files with 22 additions and 3 deletions

View File

@ -1057,6 +1057,14 @@ let needSetup = false;
await startMonitor(socket.userID, monitorID); await startMonitor(socket.userID, monitorID);
await server.sendUpdateMonitorIntoList(socket, monitorID); await server.sendUpdateMonitorIntoList(socket, monitorID);
const monitor = await R.findOne("monitor", " id = ? ", [monitorID]);
if (monitor && monitor.type === "group") {
const childrenIDs = await Monitor.getAllChildrenIDs(monitorID);
for (const childID of childrenIDs) {
await server.sendUpdateMonitorIntoList(socket, childID);
}
}
callback({ callback({
ok: true, ok: true,
msg: "successResumed", msg: "successResumed",
@ -1076,6 +1084,14 @@ let needSetup = false;
await pauseMonitor(socket.userID, monitorID); await pauseMonitor(socket.userID, monitorID);
await server.sendUpdateMonitorIntoList(socket, monitorID); await server.sendUpdateMonitorIntoList(socket, monitorID);
const monitor = await R.findOne("monitor", " id = ? ", [monitorID]);
if (monitor && monitor.type === "group") {
const childrenIDs = await Monitor.getAllChildrenIDs(monitorID);
for (const childID of childrenIDs) {
await server.sendUpdateMonitorIntoList(socket, childID);
}
}
callback({ callback({
ok: true, ok: true,
msg: "successPaused", msg: "successPaused",

View File

@ -3171,9 +3171,12 @@ message HealthCheckResponse {
} }
let createdNewParent = false; let createdNewParent = false;
let parentCreatedAsActive = false;
if (this.draftGroupName && this.monitor.parent === -1) { if (this.draftGroupName && this.monitor.parent === -1) {
// Create Monitor with name of draft group // Create Monitor with name of draft group
const parentActive = this.isClone ? (this.monitor.active !== false) : false;
parentCreatedAsActive = parentActive;
const res = await new Promise((resolve) => { const res = await new Promise((resolve) => {
this.$root.add( this.$root.add(
{ {
@ -3181,7 +3184,7 @@ message HealthCheckResponse {
type: "group", type: "group",
name: this.draftGroupName, name: this.draftGroupName,
interval: this.monitor.interval, interval: this.monitor.interval,
active: false, active: parentActive,
}, },
resolve resolve
); );
@ -3203,7 +3206,7 @@ message HealthCheckResponse {
await this.$refs.tagsManager.submit(res.monitorID); await this.$refs.tagsManager.submit(res.monitorID);
// Start the new parent monitor after edit is done // Start the new parent monitor after edit is done
if (createdNewParent) { if (createdNewParent && !parentCreatedAsActive) {
await this.startParentGroupMonitor(); await this.startParentGroupMonitor();
} }
this.processing = false; this.processing = false;
@ -3223,7 +3226,7 @@ message HealthCheckResponse {
this.init(); this.init();
// Start the new parent monitor after edit is done // Start the new parent monitor after edit is done
if (createdNewParent) { if (createdNewParent && !parentCreatedAsActive) {
this.startParentGroupMonitor(); this.startParentGroupMonitor();
} }
}); });