Skip to content

Commit 57036e3

Browse files
committed
CLOUDSTACK-4831: allow create network by domain admin
(cherry picked from commit 46e4cfd)
1 parent 5109498 commit 57036e3

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

‎ui/scripts/network.js‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,48 @@
536536
},
537537
networkDomain: {
538538
label: 'label.network.domain'
539+
},
540+
domain: {
541+
label: 'label.domain',
542+
select: function(args) {
543+
var items = [];
544+
$.ajax({
545+
url: createURL("listDomains&listAll=true"),
546+
dataType: "json",
547+
async: false,
548+
success: function(json) {
549+
var items = [];
550+
items.push({
551+
id: "",
552+
description: ""
553+
});
554+
var domainObjs = json.listdomainsresponse.domain;
555+
$(domainObjs).each(function() {
556+
items.push({
557+
id: this.id,
558+
description: this.path
559+
});
560+
});
561+
args.response.success({
562+
data: items
563+
});
564+
}
565+
});
566+
args.$select.change(function() {
567+
var $form = $(this).closest('form');
568+
if ($(this).val() == "") {
569+
$form.find('.form-item[rel=account]').hide();
570+
} else {
571+
$form.find('.form-item[rel=account]').css('display', 'inline-block');
572+
}
573+
});
574+
},
575+
},
576+
account: {
577+
label: 'label.account',
578+
validation: {
579+
required: true
580+
},
539581
}
540582
}
541583
},
@@ -575,6 +617,19 @@
575617
});
576618
}
577619

620+
if (args.$form.find('.form-item[rel=domain]').css("display") != "none") {
621+
if (args.data.domain != null && args.data.domain.length > 0) {
622+
$.extend(dataObj, {
623+
domainid: args.data.domain
624+
});
625+
}
626+
if (args.data.account != null && args.data.account.length > 0) {
627+
$.extend(dataObj, {
628+
account: args.data.account
629+
});
630+
}
631+
}
632+
578633
$.ajax({
579634
url: createURL('createNetwork'),
580635
data: dataObj,

0 commit comments

Comments
 (0)