CLOUDSTACK-4831: allow create network by domain admin

This commit is contained in:
Wei Zhou 2013-10-30 15:12:32 +01:00
parent 0d12e3eb9d
commit 46e4cfd3c3
1 changed files with 55 additions and 0 deletions

View File

@ -542,6 +542,48 @@
},
networkDomain: {
label: 'label.network.domain'
},
domain: {
label: 'label.domain',
select: function(args) {
var items = [];
$.ajax({
url: createURL("listDomains&listAll=true"),
dataType: "json",
async: false,
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
});
});
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');
}
});
},
},
account: {
label: 'label.account',
validation: {
required: true
},
}
}
},
@ -581,6 +623,19 @@
});
}
if (args.$form.find('.form-item[rel=domain]').css("display") != "none") {
if (args.data.domain != null && args.data.domain.length > 0) {
$.extend(dataObj, {
domainid: args.data.domain
});
}
if (args.data.account != null && args.data.account.length > 0) {
$.extend(dataObj, {
account: args.data.account
});
}
}
$.ajax({
url: createURL('createNetwork'),
data: dataObj,