Skip to content

Commit

Permalink
Closes-bug: #1609728 - Backtrace is displayed instead of error messag…
Browse files Browse the repository at this point in the history
…e when

'route' is left unfilled under Route aggregates

Change-Id: I84e52e9088cf52b8565350b6cc31b7c09348c81b
  • Loading branch information
sbavanasi committed Aug 8, 2016
1 parent 34e43c9 commit 686f56d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
Expand Up @@ -72,6 +72,12 @@ define([
ctwu.getPermissionsValidation()
];

validations.push({
key : "routes",
type : cowc.OBJECT_TYPE_COLLECTION,
getValidation : "rtAggregateRoutesValidation"
});

if (this.isDeepValid(validations)) {
attr = this.model().attributes;
newRouteAggregateData = $.extend(true, {}, attr);
Expand Down
Expand Up @@ -23,6 +23,19 @@ define([
attrErrorObj[attr + cowc.ERROR_SUFFIX_ID] = (isValid == true) ?
false : isValid;
errors.set(attrErrorObj);
},

validations: {
rtAggregateRoutesValidation: {
route: function(value, attr, finalObj) {
var route = getValueByJsonPath(finalObj, "route", ""),
routeArry = route.split("/");
if(routeArry.length !== 2 || (!isIPv4(routeArry[0]) &&
!isIPv6(routeArry[0]))) {
return "Enter valid IPv4 or IPv6 Prefix";
}
}
}
}
});

Expand Down
Expand Up @@ -59,7 +59,7 @@ define([
false);
Knockback.applyBindings(self.model,
document.getElementById(modalId));
kbValidation.bind(self);
kbValidation.bind(self, {collection:self.model.model().attributes.routes});
//permissions
ctwu.bindPermissionsValidation(self);
}, null, true
Expand Down Expand Up @@ -138,14 +138,16 @@ define([
viewConfig: {
path: "routes",
collection: "routes",
validation:
"rtAggregateRoutesValidation",
templateId: cowc.TMP_EDITABLE_GRID_ACTION_VIEW,
columns: [{
elementId: "route",
name: "Routes",
name: "Route Prefix",
view: "FormInputView",
width: 350,
viewConfig: {
placeholder: "Enter Route",
placeholder: "xxx.xxx.xxx.xxx/xx",
width: 350,
path: "route",
templateId: cowc.TMPL_EDITABLE_GRID_INPUT_VIEW,
Expand Down

0 comments on commit 686f56d

Please sign in to comment.