Skip to content

Commit 46e4cfd

Browse files
committed
CLOUDSTACK-4831: allow create network by domain admin
1 parent 0d12e3e commit 46e4cfd

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
@@ -542,6 +542,48 @@
542542
},
543543
networkDomain: {
544544
label: 'label.network.domain'
545+
},
546+
domain: {
547+
label: 'label.domain',
548+
select: function(args) {
549+
var items = [];
550+
$.ajax({
551+
url: createURL("listDomains&listAll=true"),
552+
dataType: "json",
553+
async: false,
554+
success: function(json) {
555+
var items = [];
556+
items.push({
557+
id: "",
558+
description: ""
559+
});
560+
var domainObjs = json.listdomainsresponse.domain;
561+
$(domainObjs).each(function() {
562+
items.push({
563+
id: this.id,
564+
description: this.path
565+
});
566+
});
567+
args.response.success({
568+
data: items
569+
});
570+
}
571+
});
572+
args.$select.change(function() {
573+
var $form = $(this).closest('form');
574+
if ($(this).val() == "") {
575+
$form.find('.form-item[rel=account]').hide();
576+
} else {
577+
$form.find('.form-item[rel=account]').css('display', 'inline-block');
578+
}
579+
});
580+
},
581+
},
582+
account: {
583+
label: 'label.account',
584+
validation: {
585+
required: true
586+
},
545587
}
546588
}
547589
},
@@ -581,6 +623,19 @@
581623
});
582624
}
583625

626+
if (args.$form.find('.form-item[rel=domain]').css("display") != "none") {
627+
if (args.data.domain != null && args.data.domain.length > 0) {
628+
$.extend(dataObj, {
629+
domainid: args.data.domain
630+
});
631+
}
632+
if (args.data.account != null && args.data.account.length > 0) {
633+
$.extend(dataObj, {
634+
account: args.data.account
635+
});
636+
}
637+
}
638+
584639
$.ajax({
585640
url: createURL('createNetwork'),
586641
data: dataObj,

0 commit comments

Comments
 (0)