ui: create L2, Isolated network - filter offerings for domain

Signed-off-by: Abhishek Kumar <abhishek.kumar@shapeblue.com>
This commit is contained in:
Abhishek Kumar 2019-07-01 18:24:39 +05:30
parent d75a26d38b
commit 9df8d7bc21
2 changed files with 110 additions and 99 deletions

View File

@ -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: {

View File

@ -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',