diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index a83f91cab..fe19b32a9 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -109,7 +109,7 @@
- +
@@ -1157,6 +1157,23 @@ export default { }, computed: { + defaultFriendlyName() { + if (this.monitor.hostname) { + return this.monitor.hostname; + } + if (this.monitor.url) { + try { + const url = new URL(this.monitor.url); + return url.hostname; + } catch (e) { + // Handle invalid URL, maybe return a generic placeholder or empty string + return this.$t("My Monitor"); + } + } + // Default placeholder if neither hostname nor URL is available + return this.$t("My Monitor"); + }, + ipRegex() { // Allow to test with simple dns server with port (127.0.0.1:5300) @@ -1700,6 +1717,11 @@ message HealthCheckResponse { this.processing = true; + // Use defaultFriendlyName if Friendly Name is empty + if (!this.monitor.name) { + this.monitor.name = this.defaultFriendlyName; + } + if (!this.isInputValid()) { this.processing = false; return;