CLOUDSTACK-5481: fix ui bug when regular user add isolated network

This commit is contained in:
Wei Zhou 2013-12-13 10:28:00 +01:00
parent 11c7fad535
commit 5cec27c858
1 changed files with 44 additions and 26 deletions

View File

@ -539,35 +539,47 @@
},
domain: {
label: 'label.domain',
isHidden: function(args) {
if (isAdmin() || isDomainAdmin())
return false;
else
return true;
},
select: function(args) {
$.ajax({
url: createURL("listDomains&listAll=true"),
success: function(json) {
var items = [];
items.push({
id: "",
description: ""
});
var domainObjs = json.listdomainsresponse.domain;
$(domainObjs).each(function() {
if (isAdmin() || isDomainAdmin()) {
$.ajax({
url: createURL("listDomains&listAll=true"),
success: function(json) {
var items = [];
items.push({
id: this.id,
description: this.path
id: "",
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');
}
});
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');
}
});
} else {
args.response.success({
data: null
});
}
},
},
account: {
@ -575,6 +587,12 @@
validation: {
required: true
},
isHidden: function(args) {
if (isAdmin() || isDomainAdmin())
return false;
else
return true;
}
}
}
},