You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2019/01/15 23:37:09 UTC
[trafficcontrol] Diff for: [GitHub] rob05c merged pull request #3224: fixes
#3223. updated type of SteeringTargetNullable.Value to JSONIntStr
diff --git a/lib/go-tc/steeringtarget.go b/lib/go-tc/steeringtarget.go
index e04c63d81..2588b66e4 100644
--- a/lib/go-tc/steeringtarget.go
+++ b/lib/go-tc/steeringtarget.go
@@ -23,6 +23,8 @@ import (
"database/sql"
"errors"
"strings"
+
+ "github.com/apache/trafficcontrol/lib/go-util"
)
type SteeringTarget struct {
@@ -32,7 +34,7 @@ type SteeringTarget struct {
TargetID int `json:"targetId" db:"target"`
Type string `json:"type" db:"type"` // TODO enum?
TypeID int `json:"typeId" db:"type_id"` // TODO enum?
- Value int `json:"value" db:"value"`
+ Value util.JSONIntStr `json:"value" db:"value"`
}
type SteeringTargetNullable struct {
@@ -42,7 +44,7 @@ type SteeringTargetNullable struct {
TargetID *uint64 `json:"targetId" db:"target"`
Type *string `json:"type" db:"type_name"` // TODO enum?
TypeID *int `json:"typeId" db:"type_id"` // TODO enum?
- Value *uint64 `json:"value" db:"value"`
+ Value *util.JSONIntStr `json:"value" db:"value"`
}
func (st SteeringTargetNullable) Validate(tx *sql.Tx) error {
diff --git a/traffic_ops/testing/api/v14/steeringtargets_test.go b/traffic_ops/testing/api/v14/steeringtargets_test.go
index e41d67e42..1167933b7 100644
--- a/traffic_ops/testing/api/v14/steeringtargets_test.go
+++ b/traffic_ops/testing/api/v14/steeringtargets_test.go
@@ -113,7 +113,7 @@ func UpdateTestSteeringTargets(t *testing.T) {
}
st = sts[0]
- expected := uint64(12345)
+ expected := util.JSONIntStr(-12345)
if st.Value != nil && *st.Value == expected {
expected += 1
}
diff --git a/traffic_portal/app/src/common/modules/form/deliveryServiceTarget/form.deliveryServiceTarget.tpl.html b/traffic_portal/app/src/common/modules/form/deliveryServiceTarget/form.deliveryServiceTarget.tpl.html
index 1e1640de8..76a8e3946 100644
--- a/traffic_portal/app/src/common/modules/form/deliveryServiceTarget/form.deliveryServiceTarget.tpl.html
+++ b/traffic_portal/app/src/common/modules/form/deliveryServiceTarget/form.deliveryServiceTarget.tpl.html
@@ -57,7 +57,7 @@
<div class="form-group" ng-class="{'has-error': hasError(dsTargetForm.value), 'has-feedback': hasError(dsTargetForm.value)}">
<label class="control-label col-md-2 col-sm-2 col-xs-12">Value *</label>
<div class="col-md-10 col-sm-10 col-xs-12">
- <input name="value" type="text" class="form-control" ng-model="target.value" ng-maxlength="3" ng-pattern="/^-?\d+$/" required autofocus>
+ <input name="value" type="number" class="form-control" ng-model="target.value" ng-maxlength="3" ng-pattern="/^-?\d+$/" required autofocus>
<small class="input-error" ng-show="hasPropertyError(dsTargetForm.value, 'required')">Required</small>
<small class="input-error" ng-show="hasPropertyError(dsTargetForm.value, 'maxlength')">Too Long</small>
<small class="input-error" ng-show="hasPropertyError(dsTargetForm.value, 'pattern')">Whole Number</small>
With regards,
Apache Git Services