Skip to content

Commit

Permalink
Changes to allow VMI local preference value between 0 to 2**32 - 1
Browse files Browse the repository at this point in the history
Closes-bug: #1676498

Change-Id: Ic411afecf18b60d791883dc14ff5d1263deac819
  • Loading branch information
chennab committed Apr 5, 2017
1 parent 46525cd commit a7daffe
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 20 deletions.
12 changes: 7 additions & 5 deletions webroot/config/networking/port/ui/js/models/portModel.js
Expand Up @@ -530,11 +530,13 @@ define([
},
'virtual_machine_interface_properties.local_preference' :
function(value, attr, finalObj) {
if(value != "") {
if (!isNumber(String(value).trim()) ||
(value.toString() !== "100" &&
value.toString() !== "200")){
return "Local Preference has to be 100 or 200.";
if(value){
var numVal = Number(value);
if(isNaN(numVal) || !Number.isInteger(numVal)){
return "Local Preference has to be a integer";
}
if(numVal < 0 || numVal > 4294967295){
return "Local Preference has to be between 0 - 4294967295";
}
}
},
Expand Down
18 changes: 4 additions & 14 deletions webroot/config/networking/port/ui/js/portViewConfigs.js
Expand Up @@ -325,25 +325,15 @@
columns: [{
elementId: 'local_preference',
name: "Local Preference",
view: "FormComboboxView",
view: "FormInputView",
viewConfig: {
path: 'virtual_machine_interface_properties.local_preference',
label: 'Local Preference',
placeholder: '0 - 4294967295',
dataBindValue: 'virtual_machine_interface_properties().local_preference',
class: 'col-xs-6',
elementConfig: {
dataTextField: "text",
dataValueField: "value",
placeholder: "Select Local Preference",
dataSource:{
type: "local",
data: [
{text: "100", value: "100"},
{text: "200", value: "200"}]
}
}
class: "col-xs-6"
}
},{
}, {
elementId: 'bridge_domain_refs',
view: "FormDropdownView",
viewConfig: {
Expand Down
Expand Up @@ -143,7 +143,7 @@ define([
var localPrefValue = getValueByJsonPath(dc,
"virtual_machine_interface_properties;local_preference",
"")
if(localPrefValue != ""){
if(localPrefValue !== ""){
localPref = localPrefValue;
}
return localPref;
Expand Down

0 comments on commit a7daffe

Please sign in to comment.