Skip to content

Commit 5cec27c

Browse files
committed
CLOUDSTACK-5481: fix ui bug when regular user add isolated network
1 parent 11c7fad commit 5cec27c

1 file changed

Lines changed: 44 additions & 26 deletions

File tree

‎ui/scripts/network.js‎

Lines changed: 44 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -539,42 +539,60 @@
539539
},
540540
domain: {
541541
label: 'label.domain',
542+
isHidden: function(args) {
543+
if (isAdmin() || isDomainAdmin())
544+
return false;
545+
else
546+
return true;
547+
},
542548
select: function(args) {
543-
$.ajax({
544-
url: createURL("listDomains&listAll=true"),
545-
success: function(json) {
546-
var items = [];
547-
items.push({
548-
id: "",
549-
description: ""
550-
});
551-
var domainObjs = json.listdomainsresponse.domain;
552-
$(domainObjs).each(function() {
549+
if (isAdmin() || isDomainAdmin()) {
550+
$.ajax({
551+
url: createURL("listDomains&listAll=true"),
552+
success: function(json) {
553+
var items = [];
553554
items.push({
554-
id: this.id,
555-
description: this.path
555+
id: "",
556+
description: ""
556557
});
557-
});
558-
args.response.success({
559-
data: items
560-
});
561-
}
562-
});
563-
args.$select.change(function() {
564-
var $form = $(this).closest('form');
565-
if ($(this).val() == "") {
566-
$form.find('.form-item[rel=account]').hide();
567-
} else {
568-
$form.find('.form-item[rel=account]').css('display', 'inline-block');
569-
}
570-
});
558+
var domainObjs = json.listdomainsresponse.domain;
559+
$(domainObjs).each(function() {
560+
items.push({
561+
id: this.id,
562+
description: this.path
563+
});
564+
});
565+
args.response.success({
566+
data: items
567+
});
568+
}
569+
});
570+
args.$select.change(function() {
571+
var $form = $(this).closest('form');
572+
if ($(this).val() == "") {
573+
$form.find('.form-item[rel=account]').hide();
574+
} else {
575+
$form.find('.form-item[rel=account]').css('display', 'inline-block');
576+
}
577+
});
578+
} else {
579+
args.response.success({
580+
data: null
581+
});
582+
}
571583
},
572584
},
573585
account: {
574586
label: 'label.account',
575587
validation: {
576588
required: true
577589
},
590+
isHidden: function(args) {
591+
if (isAdmin() || isDomainAdmin())
592+
return false;
593+
else
594+
return true;
595+
}
578596
}
579597
}
580598
},

0 commit comments

Comments
 (0)