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,
|
templates: templatesObj,
|
||||||
hypervisors: hypervisorObjs
|
hypervisors: hypervisorObjs
|
||||||
},
|
},
|
||||||
customFlag: 'isdynamicallyscalable', // Field determines if custom slider is shown
|
customHidden: function(args) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -383,72 +383,20 @@
|
|||||||
|
|
||||||
originalValues(formData);
|
originalValues(formData);
|
||||||
|
|
||||||
$step.find('input[type=radio]').bind('change', function() {
|
var custom = args.customHidden({
|
||||||
var $target = $(this);
|
context: context,
|
||||||
var val = $target.val();
|
data: args.data
|
||||||
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();
|
$step.find('.custom-size-label').remove();
|
||||||
|
|
||||||
if (custom) {
|
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.find('.section.custom-size').show();
|
||||||
$step.addClass('custom-disk-size');
|
$step.addClass('custom-disk-size');
|
||||||
$target.closest('.select-container').scrollTop(
|
|
||||||
$target.position().top
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
$step.find('.section.custom-size').hide();
|
$step.find('.section.custom-size').hide();
|
||||||
$step.removeClass('custom-disk-size');
|
$step.removeClass('custom-disk-size');
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
$step.find('input[type=radio]:first').trigger('change');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user