mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CS-15292: Split long OS Type list when create Template,ISO.
This commit is contained in:
parent
1075344f03
commit
f090fdeea7
@ -204,11 +204,42 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
osTypeId: {
|
osCategory: {
|
||||||
label: 'label.os.type',
|
label: 'OS Category',
|
||||||
select: function(args) {
|
select: function(args) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: createURL("listOsTypes"),
|
url: createURL("listOsCategories"),
|
||||||
|
dataType: "json",
|
||||||
|
async: true,
|
||||||
|
success: function(json) {
|
||||||
|
var osCats = json.listoscategoriesresponse.oscategory;
|
||||||
|
var items = [];
|
||||||
|
if (isAdmin())
|
||||||
|
items.push({id: -1, description: "All OS"});
|
||||||
|
$(osCats).each(function() {
|
||||||
|
items.push({id: this.id, description: this.name});
|
||||||
|
});
|
||||||
|
args.response.success({data: items});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
osTypeId: {
|
||||||
|
label: 'label.os.type',
|
||||||
|
dependsOn: 'osCategory',
|
||||||
|
select: function(args) {
|
||||||
|
if(args.osCategory == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var apiCmd;
|
||||||
|
if(args.osCategory == -1)
|
||||||
|
apiCmd = "listOsTypes";
|
||||||
|
else
|
||||||
|
apiCmd = "listOsTypes&oscategoryid=" + args.osCategory;
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: createURL(apiCmd),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
async: true,
|
async: true,
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
@ -784,14 +815,45 @@
|
|||||||
isChecked: true
|
isChecked: true
|
||||||
},
|
},
|
||||||
|
|
||||||
|
osCategory: {
|
||||||
|
label: 'OS Category',
|
||||||
|
dependsOn: 'isBootable',
|
||||||
|
select: function(args) {
|
||||||
|
$.ajax({
|
||||||
|
url: createURL("listOsCategories"),
|
||||||
|
dataType: "json",
|
||||||
|
async: true,
|
||||||
|
success: function(json) {
|
||||||
|
var osCats = json.listoscategoriesresponse.oscategory;
|
||||||
|
var items = [];
|
||||||
|
if (isAdmin())
|
||||||
|
items.push({id: -1, description: "All OS"});
|
||||||
|
$(osCats).each(function() {
|
||||||
|
items.push({id: this.id, description: this.name});
|
||||||
|
});
|
||||||
|
args.response.success({data: items});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
osTypeId: {
|
osTypeId: {
|
||||||
label: 'label.os.type',
|
label: 'label.os.type',
|
||||||
dependsOn: 'isBootable',
|
dependsOn: ['isBootable','osCategory'],
|
||||||
isHidden: false,
|
isHidden: false,
|
||||||
validation: { required: true },
|
validation: { required: true },
|
||||||
select: function(args) {
|
select: function(args) {
|
||||||
|
if(args.osCategory == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var apiCmd;
|
||||||
|
if(args.osCategory == -1)
|
||||||
|
apiCmd = "listOsTypes";
|
||||||
|
else
|
||||||
|
apiCmd = "listOsTypes&oscategoryid=" + args.osCategory;
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: createURL("listOsTypes"),
|
url: createURL(apiCmd),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
async: true,
|
async: true,
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
|
|||||||
@ -117,11 +117,14 @@
|
|||||||
var $value = $('<div>').addClass('value')
|
var $value = $('<div>').addClass('value')
|
||||||
.appendTo($formItem);
|
.appendTo($formItem);
|
||||||
var $input, $dependsOn, selectFn, selectArgs;
|
var $input, $dependsOn, selectFn, selectArgs;
|
||||||
var dependsOn = field.dependsOn;
|
var dependsOn = $.isArray(field.dependsOn) ? field.dependsOn : [field.dependsOn] ; //now an array
|
||||||
|
|
||||||
// Depends on fields
|
// Depends on fields
|
||||||
if (field.dependsOn) {
|
if (dependsOn.length) {
|
||||||
$formItem.attr('depends-on', dependsOn);
|
$.each(dependsOn, function(key, value){
|
||||||
|
var dependsOn = value;
|
||||||
|
|
||||||
|
$formItem.attr('depends-on-'+value, dependsOn);
|
||||||
$dependsOn = $form.find('input, select').filter(function() {
|
$dependsOn = $form.find('input, select').filter(function() {
|
||||||
return $(this).attr('name') === dependsOn;
|
return $(this).attr('name') === dependsOn;
|
||||||
});
|
});
|
||||||
@ -132,14 +135,14 @@
|
|||||||
// Checkbox
|
// Checkbox
|
||||||
$dependsOn.bind('click', function(event) {
|
$dependsOn.bind('click', function(event) {
|
||||||
var $target = $(this);
|
var $target = $(this);
|
||||||
var $dependent = $target.closest('form').find('[depends-on=\'' + dependsOn + '\']');
|
var $dependent = $target.closest('form').find('[depends-on-' + value + '=\'' + dependsOn + '\']');
|
||||||
|
|
||||||
if (($target.is(':checked') && !isReverse) ||
|
if (($target.is(':checked') && !isReverse) ||
|
||||||
($target.is(':unchecked') && isReverse)) {
|
($target.is(':unchecked') && isReverse)) {
|
||||||
$dependent.css('display', 'inline-block');
|
$dependent.css('display', 'inline-block');
|
||||||
$dependent.each(function() {
|
$dependent.each(function() {
|
||||||
if ($(this).data('dialog-select-fn')) {
|
if ($(this).find('select').data('dialog-select-fn')) {
|
||||||
$(this).data('dialog-select-fn')();
|
$(this).find('select').data('dialog-select-fn')();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (($target.is(':unchecked') && !isReverse) ||
|
} else if (($target.is(':unchecked') && !isReverse) ||
|
||||||
@ -162,7 +165,8 @@
|
|||||||
if (isReverse) {
|
if (isReverse) {
|
||||||
$dependsOn.click();
|
$dependsOn.click();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine field type of input
|
// Determine field type of input
|
||||||
@ -207,7 +211,10 @@
|
|||||||
// Pass form item to provider for additional manipulation
|
// Pass form item to provider for additional manipulation
|
||||||
$.extend(selectArgs, { $select: $input });
|
$.extend(selectArgs, { $select: $input });
|
||||||
|
|
||||||
if (dependsOn) {
|
if (dependsOn.length) {
|
||||||
|
$.each(dependsOn, function(key, value){
|
||||||
|
var dependsOn = value;
|
||||||
|
|
||||||
$dependsOn = $input.closest('form').find('input, select').filter(function() {
|
$dependsOn = $input.closest('form').find('input, select').filter(function() {
|
||||||
return $(this).attr('name') === dependsOn;
|
return $(this).attr('name') === dependsOn;
|
||||||
});
|
});
|
||||||
@ -232,6 +239,7 @@
|
|||||||
if (!$dependsOn.is('select')) {
|
if (!$dependsOn.is('select')) {
|
||||||
selectFn(selectArgs);
|
selectFn(selectArgs);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
selectFn(selectArgs);
|
selectFn(selectArgs);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user