mirror of https://github.com/apache/cloudstack.git
cloudstack 3.0 UI - VPC - add LB rule - fix a JS error "args.context.networks is undefined" when configure stickiness.
This commit is contained in:
parent
1381fa46e1
commit
f3841b3b8f
|
|
@ -14,19 +14,53 @@
|
|||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
(function($, cloudStack) {
|
||||
cloudStack.lbStickyPolicy = {
|
||||
dialog: function(args) {
|
||||
return function(args) {
|
||||
var success = args.response.success;
|
||||
var context = args.context;
|
||||
var network = args.context.networks[0];
|
||||
|
||||
var network;
|
||||
if('vpc' in args.context) { //from VPC section
|
||||
var data = {
|
||||
listAll: true,
|
||||
supportedservices: 'Lb'
|
||||
};
|
||||
if(args.context.ipAddresses[0].associatednetworkid == null) {
|
||||
$.extend(data, {
|
||||
vpcid: args.context.vpc[0].id
|
||||
});
|
||||
}
|
||||
else {
|
||||
$.extend(data, {
|
||||
id: args.context.ipAddresses[0].associatednetworkid
|
||||
});
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: createURL("listNetworks"), //check whether the VPC has a network including Lb service
|
||||
data: data,
|
||||
async: false,
|
||||
success: function(json) {
|
||||
var items = json.listnetworksresponse.network;
|
||||
if(items != null && items.length > 0) {
|
||||
network = items[0];
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else { //from Guest Network section
|
||||
network = args.context.networks[0];
|
||||
}
|
||||
|
||||
var $item = args.$item;
|
||||
|
||||
var lbService = $.grep(network.service, function(service) {
|
||||
return service.name == 'Lb';
|
||||
})[0];
|
||||
|
||||
|
||||
var stickinessCapabilities = JSON.parse($.grep(
|
||||
lbService.capability,
|
||||
function(capability) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue