feat(added new tests for testing vue components Routers, updated routes logic, added nan check for route fields):
This commit is contained in:
@@ -13,6 +13,54 @@ export default {
|
||||
default: -1,
|
||||
type: Number
|
||||
},
|
||||
isCbOn: {
|
||||
default: false,
|
||||
type: Boolean
|
||||
},
|
||||
isOnline: {
|
||||
default: false,
|
||||
type: Boolean
|
||||
},
|
||||
path: {
|
||||
default: "",
|
||||
type: String
|
||||
},
|
||||
role: {
|
||||
default: null,
|
||||
type: Number
|
||||
},
|
||||
description: {
|
||||
default: "",
|
||||
type: String
|
||||
},
|
||||
errorPercent: {
|
||||
default: 0,
|
||||
type: Number
|
||||
},
|
||||
intervalDuration: {
|
||||
default: 0,
|
||||
type: Number
|
||||
},
|
||||
minRequests: {
|
||||
default: 0,
|
||||
type: Number
|
||||
},
|
||||
openStateTimeout: {
|
||||
default: 0,
|
||||
type: Number
|
||||
},
|
||||
requestLimit: {
|
||||
default: 0,
|
||||
type: Number
|
||||
},
|
||||
deepness: {
|
||||
default: 0,
|
||||
type: Number
|
||||
},
|
||||
order: {
|
||||
default: 0,
|
||||
type: Number
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -23,51 +71,7 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('proxy', ["selectedSite", "routes", 'routeOptions', 'routesLib']),
|
||||
path() {
|
||||
return this.routesLib[this.id]?.path || ""
|
||||
},
|
||||
role() {
|
||||
return this.routesLib[this.id]?.role || ""
|
||||
},
|
||||
description() {
|
||||
return this.routesLib[this.id]?.description || ""
|
||||
},
|
||||
errorPercent() {
|
||||
if (!this.routesLib[this.id]?.cb_error_threshold_percentage && this.routesLib[this.id]?.cb_error_threshold_percentage !== 0) return ""
|
||||
return this.routesLib[this.id]?.cb_error_threshold_percentage
|
||||
},
|
||||
intervalDuration() {
|
||||
if (!this.routesLib[this.id]?.cb_interval_duration && this.routesLib[this.id]?.cb_interval_duration !== 0) return ""
|
||||
return this.routesLib[this.id]?.cb_interval_duration
|
||||
},
|
||||
minRequests() {
|
||||
if (!this.routesLib[this.id]?.cb_min_requests && this.routesLib[this.id]?.cb_min_requests !== 0) return ""
|
||||
return this.routesLib[this.id]?.cb_min_requests
|
||||
},
|
||||
openStateTimeout() {
|
||||
if (!this.routesLib[this.id]?.cb_open_state_timeout && this.routesLib[this.id]?.cb_open_state_timeout !== 0) return ""
|
||||
return this.routesLib[this.id]?.cb_open_state_timeout
|
||||
},
|
||||
requestLimit() {
|
||||
if (!this.routesLib[this.id]?.cb_request_limit && this.routesLib[this.id]?.cb_request_limit !== 0) return ""
|
||||
return this.routesLib[this.id]?.cb_request_limit
|
||||
},
|
||||
deepness() {
|
||||
if (!this.routesLib[this.id]?.deepness && this.routesLib[this.id]?.deepness !== 0) return ""
|
||||
return this.routesLib[this.id]?.deepness
|
||||
},
|
||||
order() {
|
||||
if (!this.routesLib[this.id]?.order && this.routesLib[this.id]?.order !== 0) return ""
|
||||
return this.routesLib[this.id]?.order
|
||||
},
|
||||
isCbOn() {
|
||||
return this.routesLib[this.id]?.is_cb_on
|
||||
},
|
||||
isOnline() {
|
||||
return this.routesLib[this.id]?.is_online
|
||||
},
|
||||
|
||||
...mapGetters('proxy', ["selectedSite", "routes", 'routeOptions', 'newRoute']),
|
||||
},
|
||||
methods: {
|
||||
...mapActions('proxy', ["updateRouteRow", "removeRoute", "breateAddingRoute"]),
|
||||
@@ -77,17 +81,21 @@ export default {
|
||||
},
|
||||
setValue(key, value) {
|
||||
this.updateRouteRow({
|
||||
...this.routesLib[this.id],
|
||||
id: this.id,
|
||||
[key]: value
|
||||
})
|
||||
},
|
||||
setInputValue(params) {
|
||||
const value = params.isNumber ? parseFloat(params.value) : params.value
|
||||
const value = params.isNumber ? this.parseNumber(params.value) : params.value
|
||||
this.updateRouteRow({
|
||||
...this.routesLib[this.id],
|
||||
id: this.id,
|
||||
[params.key]: value
|
||||
})
|
||||
},
|
||||
parseNumber (value) {
|
||||
if (!value || value !== 0) return 0
|
||||
return parseFloat(value)
|
||||
},
|
||||
removeCurrentRoute() {
|
||||
this.removeRoute({id: this.id})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user