From 9df8d7bc215ee6ebfb09b91dc43709007bb6e6bb Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Mon, 1 Jul 2019 18:24:39 +0530 Subject: [PATCH] ui: create L2, Isolated network - filter offerings for domain Signed-off-by: Abhishek Kumar --- ui/scripts/network.js | 104 +++++++++++++++++---------------- ui/scripts/sharedFunctions.js | 105 ++++++++++++++++++---------------- 2 files changed, 110 insertions(+), 99 deletions(-) diff --git a/ui/scripts/network.js b/ui/scripts/network.js index 933f53f7e82..2d85fdf5ad5 100644 --- a/ui/scripts/network.js +++ b/ui/scripts/network.js @@ -504,12 +504,60 @@ }); } }, + domain: { + label: 'label.domain', + isHidden: function(args) { + if (isAdmin() || isDomainAdmin()) + return false; + else + return true; + }, + select: function(args) { + if (isAdmin() || isDomainAdmin()) { + $.ajax({ + url: createURL("listDomains&listAll=true"), + success: function(json) { + var items = []; + items.push({ + id: "", + description: "" + }); + var domainObjs = json.listdomainsresponse.domain; + $(domainObjs).each(function() { + items.push({ + id: this.id, + description: this.path + }); + }); + items.sort(function(a, b) { + return a.description.localeCompare(b.description); + }); + args.response.success({ + data: items + }); + } + }); + args.$select.change(function() { + var $form = $(this).closest('form'); + if ($(this).val() == "") { + $form.find('.form-item[rel=account]').hide(); + } else { + $form.find('.form-item[rel=account]').css('display', 'inline-block'); + } + }); + } else { + args.response.success({ + data: null + }); + } + } + }, networkOfferingId: { label: 'label.network.offering', validation: { required: true }, - dependsOn: 'zoneId', + dependsOn: ['zoneId', 'domain'], docID: 'helpGuestNetworkNetworkOffering', select: function(args) { var data = { @@ -519,6 +567,12 @@ state: 'Enabled' }; + if (args.domain != undefined && args.domain != null) { + $.extend(data, { + domainid: args.domain + }); + } + if ('vpc' in args.context) { //from VPC section $.extend(data, { forVpc: true @@ -657,54 +711,6 @@ networkDomain: { label: 'label.network.domain' }, - domain: { - label: 'label.domain', - isHidden: function(args) { - if (isAdmin() || isDomainAdmin()) - return false; - else - return true; - }, - select: function(args) { - if (isAdmin() || isDomainAdmin()) { - $.ajax({ - url: createURL("listDomains&listAll=true"), - success: function(json) { - var items = []; - items.push({ - id: "", - description: "" - }); - var domainObjs = json.listdomainsresponse.domain; - $(domainObjs).each(function() { - items.push({ - id: this.id, - description: this.path - }); - }); - items.sort(function(a, b) { - return a.description.localeCompare(b.description); - }); - args.response.success({ - data: items - }); - } - }); - args.$select.change(function() { - var $form = $(this).closest('form'); - if ($(this).val() == "") { - $form.find('.form-item[rel=account]').hide(); - } else { - $form.find('.form-item[rel=account]').css('display', 'inline-block'); - } - }); - } else { - args.response.success({ - data: null - }); - } - } - }, account: { label: 'label.account', validation: { diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js index 11465afa9bd..b4abc67b316 100644 --- a/ui/scripts/sharedFunctions.js +++ b/ui/scripts/sharedFunctions.js @@ -894,12 +894,60 @@ var addL2GuestNetwork = { }); } }, + domain: { + label: 'label.domain', + isHidden: function(args) { + if (isAdmin() || isDomainAdmin()) + return false; + else + return true; + }, + select: function(args) { + if (isAdmin() || isDomainAdmin()) { + $.ajax({ + url: createURL("listDomains&listAll=true"), + success: function(json) { + var items = []; + items.push({ + id: "", + description: "" + }); + var domainObjs = json.listdomainsresponse.domain; + $(domainObjs).each(function() { + items.push({ + id: this.id, + description: this.path + }); + }); + items.sort(function(a, b) { + return a.description.localeCompare(b.description); + }); + args.response.success({ + data: items + }); + } + }); + args.$select.change(function() { + var $form = $(this).closest('form'); + if ($(this).val() == "") { + $form.find('.form-item[rel=account]').hide(); + } else { + $form.find('.form-item[rel=account]').css('display', 'inline-block'); + } + }); + } else { + args.response.success({ + data: null + }); + } + } + }, networkOfferingId: { label: 'label.network.offering', validation: { required: true }, - dependsOn: 'zoneId', + dependsOn: ['zoneId', 'domain'], docID: 'helpGuestNetworkNetworkOffering', select: function(args) { var data = { @@ -908,6 +956,12 @@ var addL2GuestNetwork = { state: 'Enabled' }; + if (args.domain != undefined && args.domain != null) { + $.extend(data, { + domainid: args.domain + }); + } + if ('vpc' in args.context) { //from VPC section $.extend(data, { forVpc: true @@ -988,55 +1042,6 @@ var addL2GuestNetwork = { label: 'label.bypass.vlan.overlap.check', isBoolean: true, isHidden: true - }, - - domain: { - label: 'label.domain', - isHidden: function(args) { - if (isAdmin() || isDomainAdmin()) - return false; - else - return true; - }, - select: function(args) { - if (isAdmin() || isDomainAdmin()) { - $.ajax({ - url: createURL("listDomains&listAll=true"), - success: function(json) { - var items = []; - items.push({ - id: "", - description: "" - }); - var domainObjs = json.listdomainsresponse.domain; - $(domainObjs).each(function() { - items.push({ - id: this.id, - description: this.path - }); - }); - items.sort(function(a, b) { - return a.description.localeCompare(b.description); - }); - args.response.success({ - data: items - }); - } - }); - args.$select.change(function() { - var $form = $(this).closest('form'); - if ($(this).val() == "") { - $form.find('.form-item[rel=account]').hide(); - } else { - $form.find('.form-item[rel=account]').css('display', 'inline-block'); - } - }); - } else { - args.response.success({ - data: null - }); - } - } }, account: { label: 'label.account',