fix: Create parent group as active when cloning active monitor (#6448)
This commit is contained in:
parent
9169a647cb
commit
6d0d72e8d8
@ -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",
|
||||||
|
|||||||
@ -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();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user