mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-4931: Instance wizard: use fn to hide/show template root size
This commit is contained in:
parent
69b131fa15
commit
1f0dd7cc36
@ -238,7 +238,9 @@
|
||||
templates: templatesObj,
|
||||
hypervisors: hypervisorObjs
|
||||
},
|
||||
customFlag: 'isdynamicallyscalable', // Field determines if custom slider is shown
|
||||
customHidden: function(args) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
@ -383,72 +383,20 @@
|
||||
|
||||
originalValues(formData);
|
||||
|
||||
$step.find('input[type=radio]').bind('change', function() {
|
||||
var $target = $(this);
|
||||
var val = $target.val();
|
||||
var item;
|
||||
|
||||
$.map(args.data.templates, function(v, k) {
|
||||
if (!v) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var target = $.grep(v, function(elem) {
|
||||
return elem.id == val;
|
||||
});
|
||||
|
||||
if (target.length) {
|
||||
item = target[0];
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
if (!item) return true;
|
||||
|
||||
var custom = item[args.customFlag];
|
||||
|
||||
$step.find('.custom-size-label').remove();
|
||||
|
||||
if (custom) {
|
||||
$target.parent().find('.name')
|
||||
.append(
|
||||
$('<span>').addClass('custom-size-label')
|
||||
.append(': ')
|
||||
.append(
|
||||
$('<span>').addClass('custom-disk-size').html(
|
||||
$step.find('.custom-size input[name=size]').val()
|
||||
)
|
||||
)
|
||||
.append(' GB')
|
||||
);
|
||||
$target.parent().find('.select-desc .desc')
|
||||
.append(
|
||||
$('<span>').addClass('custom-size-label')
|
||||
.append(', ')
|
||||
.append(
|
||||
$('<span>').addClass('custom-disk-size').html(
|
||||
$step.find('.custom-size input[name=size]').val()
|
||||
)
|
||||
)
|
||||
.append(' GB')
|
||||
);
|
||||
$step.find('.section.custom-size').show();
|
||||
$step.addClass('custom-disk-size');
|
||||
$target.closest('.select-container').scrollTop(
|
||||
$target.position().top
|
||||
);
|
||||
} else {
|
||||
$step.find('.section.custom-size').hide();
|
||||
$step.removeClass('custom-disk-size');
|
||||
}
|
||||
|
||||
return true;
|
||||
var custom = args.customHidden({
|
||||
context: context,
|
||||
data: args.data
|
||||
});
|
||||
|
||||
$step.find('input[type=radio]:first').trigger('change');
|
||||
$step.find('.custom-size-label').remove();
|
||||
|
||||
if (!custom) {
|
||||
$step.find('.section.custom-size').show();
|
||||
$step.addClass('custom-disk-size');
|
||||
} else {
|
||||
$step.find('.section.custom-size').hide();
|
||||
$step.removeClass('custom-disk-size');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user