|
1548 | 1548 | v-model="monitor.domainExpiryNotification" |
1549 | 1549 | class="form-check-input" |
1550 | 1550 | type="checkbox" |
1551 | | - :disabled="!hasDomain" |
1552 | 1551 | /> |
1553 | 1552 | <label class="form-check-label" for="domain-expiry-notification"> |
1554 | 1553 | {{ $t("labelDomainNameExpiryNotification") }} |
1555 | 1554 | </label> |
1556 | | - <div v-if="hasDomain" class="form-text"> |
| 1555 | + <div class="form-text"> |
1557 | 1556 | {{ $t("domainExpiryNotificationHelp") }} |
1558 | 1557 | </div> |
1559 | | - <div v-if="!hasDomain && domainExpiryUnsupportedReason" class="form-text"> |
| 1558 | + <div |
| 1559 | + v-if="monitor.domainExpiryNotification && domainExpiryUnsupportedReason" |
| 1560 | + class="form-text" |
| 1561 | + > |
1560 | 1562 | {{ domainExpiryUnsupportedReason }} |
1561 | 1563 | </div> |
1562 | 1564 | </div> |
@@ -2867,7 +2869,7 @@ const monitorDefaults = { |
2867 | 2869 | ignoreTls: false, |
2868 | 2870 | upsideDown: false, |
2869 | 2871 | expiryNotification: false, |
2870 | | - domainExpiryNotification: false, |
| 2872 | + domainExpiryNotification: true, |
2871 | 2873 | maxredirects: 10, |
2872 | 2874 | accepted_statuscodes: defaultValueList.http.accepted_statuscodes, |
2873 | 2875 | saveResponse: false, |
@@ -2929,9 +2931,8 @@ export default { |
2929 | 2931 | notificationIDList: {}, |
2930 | 2932 | // Do not add default value here, please check init() method |
2931 | 2933 | }, |
2932 | | - hasDomain: false, |
2933 | 2934 | domainExpiryUnsupportedReason: null, |
2934 | | - checkMonitorDebounce: null, |
| 2935 | + checkDomainDebounce: null, |
2935 | 2936 | acceptedStatusCodeOptions: [], |
2936 | 2937 | acceptedWebsocketCodeOptions: [], |
2937 | 2938 | dnsresolvetypeOptions: [], |
@@ -2990,16 +2991,6 @@ export default { |
2990 | 2991 | return this.$t("defaultFriendlyName"); |
2991 | 2992 | }, |
2992 | 2993 |
|
2993 | | - monitorTypeUrlHost() { |
2994 | | - const { type, url, hostname, grpcUrl } = this.monitor; |
2995 | | - return { |
2996 | | - type, |
2997 | | - url, |
2998 | | - hostname, |
2999 | | - grpcUrl, |
3000 | | - }; |
3001 | | - }, |
3002 | | -
|
3003 | 2994 | showDomainExpiryNotification() { |
3004 | 2995 | return this.monitor.type in TYPES_WITH_DOMAIN_EXPIRY_SUPPORT_VIA_FIELD; |
3005 | 2996 | }, |
@@ -3293,30 +3284,25 @@ message HealthCheckResponse { |
3293 | 3284 | } |
3294 | 3285 | }, |
3295 | 3286 |
|
3296 | | - monitorTypeUrlHost(data) { |
3297 | | - if (this.checkMonitorDebounce != null) { |
3298 | | - clearTimeout(this.checkMonitorDebounce); |
3299 | | - } |
| 3287 | + showDomainExpiryNotification() { |
| 3288 | + this.checkDomain(); |
| 3289 | + }, |
3300 | 3290 |
|
3301 | | - if (!this.showDomainExpiryNotification) { |
3302 | | - this.hasDomain = false; |
3303 | | - this.domainExpiryUnsupportedReason = null; |
3304 | | - return; |
3305 | | - } |
| 3291 | + "monitor.hostname"() { |
| 3292 | + this.checkDomain(); |
| 3293 | + }, |
3306 | 3294 |
|
3307 | | - this.checkMonitorDebounce = setTimeout(() => { |
3308 | | - this.$root.getSocket().emit("checkMointor", data, (res) => { |
3309 | | - const wasSupported = this.hasDomain; |
3310 | | - this.hasDomain = !!res?.ok; |
3311 | | - if (this.hasDomain !== wasSupported) { |
3312 | | - this.monitor.domainExpiryNotification = this.hasDomain; |
3313 | | - } |
3314 | | - this.domainExpiryUnsupportedReason = res.msgi18n ? this.$t(res.msg, res.meta) : res.msg; |
3315 | | - }); |
3316 | | - }, 500); |
| 3295 | + "monitor.url"() { |
| 3296 | + this.checkDomain(); |
| 3297 | + }, |
| 3298 | +
|
| 3299 | + "monitor.grpcUrl"() { |
| 3300 | + this.checkDomain(); |
3317 | 3301 | }, |
3318 | 3302 |
|
3319 | 3303 | "monitor.type"(newType, oldType) { |
| 3304 | + this.checkDomain(); |
| 3305 | +
|
3320 | 3306 | if (newType === "globalping" && !this.monitor.subtype) { |
3321 | 3307 | this.monitor.subtype = "ping"; |
3322 | 3308 | } |
@@ -4015,6 +4001,39 @@ message HealthCheckResponse { |
4015 | 4001 | } |
4016 | 4002 | } |
4017 | 4003 | }, |
| 4004 | +
|
| 4005 | + // Check Domain |
| 4006 | + // Do nothing if not checked |
| 4007 | + checkDomain() { |
| 4008 | + console.log("checkDomain called"); |
| 4009 | + if (this.checkDomainDebounce != null) { |
| 4010 | + clearTimeout(this.checkDomainDebounce); |
| 4011 | + } |
| 4012 | +
|
| 4013 | + if (!this.showDomainExpiryNotification) { |
| 4014 | + this.domainExpiryUnsupportedReason = null; |
| 4015 | + return; |
| 4016 | + } |
| 4017 | +
|
| 4018 | + this.checkDomainDebounce = setTimeout(() => { |
| 4019 | + const { type, url, hostname, grpcUrl } = this.monitor; |
| 4020 | + const data = { |
| 4021 | + type, |
| 4022 | + url, |
| 4023 | + hostname, |
| 4024 | + grpcUrl, |
| 4025 | + }; |
| 4026 | +
|
| 4027 | + this.$root.getSocket().emit("checkDomain", data, (res) => { |
| 4028 | + console.log(data); |
| 4029 | + if (!res.ok) { |
| 4030 | + this.domainExpiryUnsupportedReason = res.msgi18n ? this.$t(res.msg, res.meta) : res.msg; |
| 4031 | + } else { |
| 4032 | + this.domainExpiryUnsupportedReason = null; |
| 4033 | + } |
| 4034 | + }); |
| 4035 | + }, 500); |
| 4036 | + }, |
4018 | 4037 | }, |
4019 | 4038 | }; |
4020 | 4039 | </script> |
|
0 commit comments