You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by dg...@apache.org on 2019/03/27 12:30:28 UTC

[trafficcontrol] branch 3.0.x updated: fixes #3223. updated type of SteeringTargetNullable.Value to JSONIntStr (#3440)

This is an automated email from the ASF dual-hosted git repository.

dgelinas pushed a commit to branch 3.0.x
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/3.0.x by this push:
     new 2ed65cf  fixes #3223. updated type of SteeringTargetNullable.Value to JSONIntStr (#3440)
2ed65cf is described below

commit 2ed65cf4b1f13c53d6eb7722423529c4c732186d
Author: Steve Malenfant <sm...@users.noreply.github.com>
AuthorDate: Wed Mar 27 08:30:22 2019 -0400

    fixes #3223. updated type of SteeringTargetNullable.Value to JSONIntStr (#3440)
    
    (cherry picked from commit 3e11da43d31ce8e4469e033d633a47976a3f783b)
---
 lib/go-tc/steeringtarget.go                                         | 6 ++++--
 traffic_ops/testing/api/v13/steeringtargets_test.go                 | 2 +-
 .../form/deliveryServiceTarget/form.deliveryServiceTarget.tpl.html  | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/go-tc/steeringtarget.go b/lib/go-tc/steeringtarget.go
index e04c63d..2588b66 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/v13/steeringtargets_test.go b/traffic_ops/testing/api/v13/steeringtargets_test.go
index 5c28f62..e89421e 100644
--- a/traffic_ops/testing/api/v13/steeringtargets_test.go
+++ b/traffic_ops/testing/api/v13/steeringtargets_test.go
@@ -135,7 +135,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 1e1640d..76a8e39 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 @@ under the License.
             <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>