@ -393,7 +393,7 @@
<!-- Interval -- >
<!-- Interval -- >
< div class = "my-3" >
< div class = "my-3" >
< label for = "interval" class = "form-label" > { { $t ( "Heartbeat Interval" ) } } ( { { $t ( "checkEverySecond" , [ monitor . interval ] ) } } ) < / label >
< label for = "interval" class = "form-label" > { { $t ( "Heartbeat Interval" ) } } ( { { $t ( "checkEverySecond" , [ monitor . interval ] ) } } ) < / label >
< input id = "interval" v-model ="monitor.interval" type="number" class="form-control" required :min="minInterval" step="1" :max ="maxInterval">
< input id = "interval" v-model ="monitor.interval" type="number" class="form-control" required :min="minInterval" step="1" :max="maxInterval" @blur="finishUpdate Interval">
< / div >
< / div >
< div class = "my-3" >
< div class = "my-3" >
@ -412,6 +412,12 @@
< input id = "retry-interval" v-model ="monitor.retryInterval" type="number" class="form-control" required :min="minInterval" step="1" >
< input id = "retry-interval" v-model ="monitor.retryInterval" type="number" class="form-control" required :min="minInterval" step="1" >
< / div >
< / div >
<!-- Timeout : HTTP / Keyword only -- >
< div v-if ="monitor.type === 'http' || monitor.type === 'keyword'" class="my-3" >
< label for = "timeout" class = "form-label" > { { $t ( "Request Timeout" ) } } ( { { $t ( "timeoutAfter" , [ monitor . timeout || clampTimeout ( monitor . interval ) ] ) } } ) < / label >
< input id = "timeout" v-model ="monitor.timeout" type="number" class="form-control" required min="0" step="0.1" >
< / div >
< div class = "my-3" >
< div class = "my-3" >
< label for = "resend-interval" class = "form-label" >
< label for = "resend-interval" class = "form-label" >
{ { $t ( "Resend Notification if Down X times consecutively" ) } }
{ { $t ( "Resend Notification if Down X times consecutively" ) } }
@ -840,6 +846,7 @@ const monitorDefaults = {
retryInterval : 60 ,
retryInterval : 60 ,
resendInterval : 0 ,
resendInterval : 0 ,
maxretries : 1 ,
maxretries : 1 ,
timeout : 48 ,
notificationIDList : { } ,
notificationIDList : { } ,
ignoreTls : false ,
ignoreTls : false ,
upsideDown : false ,
upsideDown : false ,
@ -1113,6 +1120,13 @@ message HealthCheckResponse {
}
}
} ,
} ,
"monitor.timeout" ( value , oldValue ) {
/ / k e e p t i m e o u t w i t h i n 8 0 % r a n g e
if ( value && value !== oldValue ) {
this . monitor . timeout = this . clampTimeout ( value ) ;
}
} ,
"monitor.type" ( ) {
"monitor.type" ( ) {
if ( this . monitor . type === "push" ) {
if ( this . monitor . type === "push" ) {
if ( ! this . monitor . pushToken ) {
if ( ! this . monitor . pushToken ) {
@ -1274,6 +1288,10 @@ message HealthCheckResponse {
if ( this . monitor . retryInterval === 0 ) {
if ( this . monitor . retryInterval === 0 ) {
this . monitor . retryInterval = this . monitor . interval ;
this . monitor . retryInterval = this . monitor . interval ;
}
}
/ / H a n d l i n g f o r m o n i t o r s t h a t a r e m i s s i n g / z e r o e d t i m e o u t
if ( ! this . monitor . timeout ) {
this . monitor . timeout = ~ ~ ( this . monitor . interval * 8 ) / 10 ;
}
} else {
} else {
toast . error ( res . msg ) ;
toast . error ( res . msg ) ;
}
}
@ -1445,7 +1463,26 @@ message HealthCheckResponse {
addedDraftGroup ( draftGroupName ) {
addedDraftGroup ( draftGroupName ) {
this . draftGroupName = draftGroupName ;
this . draftGroupName = draftGroupName ;
this . monitor . parent = - 1 ;
this . monitor . parent = - 1 ;
}
} ,
/ / C l a m p t i m e o u t
clampTimeout ( timeout ) {
/ / l i m i t t o 8 0 % o f i n t e r v a l , n a r r o w l y a v o i d i n g e p s i l o n b u g
const maxTimeout = ~ ~ ( this . monitor . interval * 8 ) / 10 ;
const clamped = Math . max ( 0 , Math . min ( timeout , maxTimeout ) ) ;
/ / 0 w i l l b e t r e a t e d a s 8 0 % o f i n t e r v a l
return Number . isFinite ( clamped ) ? clamped : maxTimeout ;
} ,
finishUpdateInterval ( ) {
/ / U p d a t e t i m e o u t i f i t i s g r e a t e r t h a n t h e c l a m p t i m e o u t
let clampedValue = this . clampTimeout ( this . monitor . interval ) ;
if ( this . monitor . timeout > clampedValue ) {
this . monitor . timeout = clampedValue ;
}
} ,
} ,
} ,
} ;
} ;
< / script >
< / script >