@ -620,13 +620,23 @@ export default {
} ,
} ,
pageName ( ) {
pageName ( ) {
return this . $t ( ( this . isAdd ) ? "Add New Monitor" : "Edit" ) ;
let name = "Add New Monitor" ;
if ( this . isClone ) {
name = "Clone Monitor" ;
} else if ( this . isEdit ) {
name = "Edit" ;
}
return this . $t ( name ) ;
} ,
} ,
isAdd ( ) {
isAdd ( ) {
return this . $route . path === "/add" ;
return this . $route . path === "/add" ;
} ,
} ,
isClone ( ) {
return this . $route . path . startsWith ( "/clone" ) ;
} ,
isEdit ( ) {
isEdit ( ) {
return this . $route . path . startsWith ( "/edit" ) ;
return this . $route . path . startsWith ( "/edit" ) ;
} ,
} ,
@ -804,11 +814,22 @@ message HealthCheckResponse {
this . monitor . notificationIDList [ this . $root . notificationList [ i ] . id ] = true ;
this . monitor . notificationIDList [ this . $root . notificationList [ i ] . id ] = true ;
}
}
}
}
} else if ( this . isEdit ) {
} else if ( this . isEdit || this . isClone ) {
this . $root . getSocket ( ) . emit ( "getMonitor" , this . $route . params . id , ( res ) => {
this . $root . getSocket ( ) . emit ( "getMonitor" , this . $route . params . id , ( res ) => {
if ( res . ok ) {
if ( res . ok ) {
this . monitor = res . monitor ;
this . monitor = res . monitor ;
if ( this . isClone ) {
/ * *
* Cloning a monitor will include properties that can not be posted to backend
* as they are not valid columns in the SQLite table .
* /
this . monitor . id = undefined ; / / R e m o v e i d w h e n c l o n i n g a s w e w a n t a n e w i d
this . monitor . includeSensitiveData = undefined ;
this . monitor . maintenance = undefined ;
this . monitor . tags = undefined ; / / F I X M E : C l o n i n g t a g s d o e s n o t w o r k y e t
}
/ / 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 c r e a t e d b e f o r e 1 . 7 . 0
/ / 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 c r e a t e d b e f o r e 1 . 7 . 0
if ( this . monitor . retryInterval === 0 ) {
if ( this . monitor . retryInterval === 0 ) {
this . monitor . retryInterval = this . monitor . interval ;
this . monitor . retryInterval = this . monitor . interval ;
@ -866,7 +887,7 @@ message HealthCheckResponse {
this . monitor . headers = JSON . stringify ( JSON . parse ( this . monitor . headers ) , null , 4 ) ;
this . monitor . headers = JSON . stringify ( JSON . parse ( this . monitor . headers ) , null , 4 ) ;
}
}
if ( this . isAdd ) {
if ( this . isAdd || this . isClone ) {
this . $root . add ( this . monitor , async ( res ) => {
this . $root . add ( this . monitor , async ( res ) => {
if ( res . ok ) {
if ( res . ok ) {