Merge def053af79 into 9169a647cb
This commit is contained in:
commit
313745b502
@ -1857,6 +1857,15 @@ class Monitor extends BeanModel {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.type === "mongodb" && this.databaseQuery) {
|
||||
// Validate that databaseQuery is valid JSON
|
||||
try {
|
||||
JSON.parse(this.databaseQuery);
|
||||
} catch (error) {
|
||||
throw new Error(`Invalid JSON in database query: ${error.message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -2393,6 +2393,7 @@ export default {
|
||||
confirmed: false,
|
||||
editedValue: false,
|
||||
},
|
||||
isLoadingMonitor: false,
|
||||
};
|
||||
},
|
||||
|
||||
@ -2915,6 +2916,7 @@ message HealthCheckResponse {
|
||||
}
|
||||
}
|
||||
|
||||
this.isLoadingMonitor = true;
|
||||
this.monitor = res.monitor;
|
||||
|
||||
if (this.isClone) {
|
||||
@ -2958,6 +2960,11 @@ message HealthCheckResponse {
|
||||
this.monitor.timeout = ~~(this.monitor.interval * 8) / 10;
|
||||
}
|
||||
}
|
||||
|
||||
// Reset loading flag after all reactive updates
|
||||
this.$nextTick(() => {
|
||||
this.isLoadingMonitor = false;
|
||||
});
|
||||
} else {
|
||||
this.$root.toastError(res.msg);
|
||||
}
|
||||
@ -3314,8 +3321,15 @@ message HealthCheckResponse {
|
||||
// Calculate the minimum required interval based on ping configuration
|
||||
const calculatedPingInterval = this.calculatePingInterval();
|
||||
|
||||
// If the configured interval is too small, adjust it to the minimum required value
|
||||
if (this.monitor.interval < calculatedPingInterval) {
|
||||
// Don't auto-adjust interval when:
|
||||
// 1. Loading monitor data from server (isLoadingMonitor flag)
|
||||
// 2. User explicitly edited the interval value (editedValue flag)
|
||||
// This respects the user's choice of low intervals they've confirmed
|
||||
if (
|
||||
!this.isLoadingMonitor &&
|
||||
!this.lowIntervalConfirmation.editedValue &&
|
||||
this.monitor.interval < calculatedPingInterval
|
||||
) {
|
||||
this.monitor.interval = calculatedPingInterval;
|
||||
|
||||
// Notify the user that the interval has been automatically adjusted
|
||||
|
||||
Loading…
Reference in New Issue
Block a user