diff --git a/src/lang/en.json b/src/lang/en.json index 0d076db00..81b6350ed 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -1231,5 +1231,7 @@ "Allow Notifications": "Allow Notifications", "Browser not supported": "Browser not supported", "Unable to get permission to notify": "Unable to get permission to notify (request either denied or ignored).", - "Webpush Helptext": "Web push only works with SSL (HTTPS) connections. For iOS devices, webpage must be added to homescreen beforehand." + "Webpush Helptext": "Web push only works with SSL (HTTPS) connections. For iOS devices, webpage must be added to homescreen beforehand.", + "minimumIntervalWarning": "Intervals below 20 seconds may result in poor performance.", + "lowIntervalWarning": "Are you sure want to set the interval value below 20 seconds? Performance may be degraded, particularly if there are a large number of monitors." } diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index f1efb4cfc..824b5be2e 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -717,10 +717,26 @@
- + +
{{ monitor.humanReadableInterval }}
+ +
+ {{ $t("minimumIntervalWarning") }} +
@@ -736,7 +752,19 @@ {{ $t("Heartbeat Retry Interval") }} ({{ $t("retryCheckEverySecond", [ monitor.retryInterval ]) }}) - + +
+ {{ $t("minimumIntervalWarning") }} +
@@ -1251,6 +1279,10 @@ + +

{{ $t("lowIntervalWarning") }}

+

{{ $t("Please use this option carefully!") }}

+
@@ -1261,6 +1293,7 @@ import { useToast } from "vue-toastification"; import ActionSelect from "../components/ActionSelect.vue"; import CopyableInput from "../components/CopyableInput.vue"; import CreateGroupDialog from "../components/CreateGroupDialog.vue"; +import Confirm from "../components/Confirm.vue"; import NotificationDialog from "../components/NotificationDialog.vue"; import DockerHostDialog from "../components/DockerHostDialog.vue"; import RemoteBrowserDialog from "../components/RemoteBrowserDialog.vue"; @@ -1336,6 +1369,7 @@ export default { ProxyDialog, CopyableInput, CreateGroupDialog, + Confirm, NotificationDialog, DockerHostDialog, RemoteBrowserDialog, @@ -1368,6 +1402,10 @@ export default { }, draftGroupName: null, remoteBrowsersEnabled: false, + lowIntervalConfirmation: { + confirmed: false, + editedValue: false, + }, }; }, @@ -1995,6 +2033,11 @@ message HealthCheckResponse { this.monitor.pushToken = genSecret(pushTokenLength); }, + handleIntervalConfirm() { + this.lowIntervalConfirmation.confirmed = true; + this.submit(); + }, + /** * Submit the form data for processing * @returns {Promise} @@ -2003,6 +2046,15 @@ message HealthCheckResponse { this.processing = true; + // Check user has confirmed use of low interval value. Only + // do this if the interval value has changed since last save. + if (this.lowIntervalConfirmation.editedValue && (this.monitor.interval < 20 || this.monitor.retryInterval < 20) && !this.lowIntervalConfirmation.confirmed) { + // The dialog will then re-call submit + this.$refs.confirmLowIntervalValue.show(); + this.processing = false; + return; + } + if (!this.monitor.name) { this.monitor.name = this.defaultFriendlyName; } @@ -2012,6 +2064,9 @@ message HealthCheckResponse { return; } + this.lowIntervalConfirmation.confirmed = false; + this.lowIntervalConfirmation.editedValue = false; + // Beautify the JSON format (only if httpBodyEncoding is not set or === json) if (this.monitor.body && (!this.monitor.httpBodyEncoding || this.monitor.httpBodyEncoding === "json")) { this.monitor.body = JSON.stringify(JSON.parse(this.monitor.body), null, 4); diff --git a/src/util.js b/src/util.js index e6b77d18b..a156ae762 100644 --- a/src/util.js +++ b/src/util.js @@ -30,7 +30,7 @@ exports.SQL_DATE_FORMAT = "YYYY-MM-DD"; exports.SQL_DATETIME_FORMAT = "YYYY-MM-DD HH:mm:ss"; exports.SQL_DATETIME_FORMAT_WITHOUT_SECOND = "YYYY-MM-DD HH:mm"; exports.MAX_INTERVAL_SECOND = 2073600; -exports.MIN_INTERVAL_SECOND = 20; +exports.MIN_INTERVAL_SECOND = 1; exports.PING_PACKET_SIZE_MIN = 1; exports.PING_PACKET_SIZE_MAX = 65500; exports.PING_PACKET_SIZE_DEFAULT = 56; diff --git a/src/util.ts b/src/util.ts index f689abbe7..2fe92bf7c 100644 --- a/src/util.ts +++ b/src/util.ts @@ -44,7 +44,7 @@ export const SQL_DATETIME_FORMAT = "YYYY-MM-DD HH:mm:ss"; export const SQL_DATETIME_FORMAT_WITHOUT_SECOND = "YYYY-MM-DD HH:mm"; export const MAX_INTERVAL_SECOND = 2073600; // 24 days -export const MIN_INTERVAL_SECOND = 20; // 20 seconds +export const MIN_INTERVAL_SECOND = 1; // 1 second // Packet Size limits export const PING_PACKET_SIZE_MIN = 1;