[Kimchi-devel] [PATCH 2/3] UI: change the disks field of template when the pool changes.
Aline Manera
alinefm at linux.vnet.ibm.com
Fri Apr 11 01:13:54 UTC 2014
On 04/02/2014 11:19 AM, shaohef at linux.vnet.ibm.com wrote:
> From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
>
> when pool is scsi/iscsi, we should not let user input the size
> of disk.
>
> We should get the disk size from the volume information.
>
> Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
> ---
> ui/js/src/kimchi.template_edit_main.js | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/ui/js/src/kimchi.template_edit_main.js b/ui/js/src/kimchi.template_edit_main.js
> index 386095b..0aaf6e5 100644
> --- a/ui/js/src/kimchi.template_edit_main.js
> +++ b/ui/js/src/kimchi.template_edit_main.js
> @@ -101,6 +101,25 @@ kimchi.template_edit_main = function() {
> kimchi.window.close();
> });
>
> + $('#template-edit-storagePool').change(function() {
> + storagepool = $(this).val();
> + storageArray = storagepool.split("/");
> + if (storageArray.length > 3){
> + $('input[name="disks"]').prop( "disabled",true);
> + volumeName = storageArray.pop();
> + poolName = storageArray[2]
> + kimchi.listStorageVolume(poolName, volumeName, function(result) {
> + if (result) {
> + size = result.allocation/(1024*1024*1024);
> + $('input[name="disks"]').val(size.toFixed(1));
> + }
> + });
> + } else {
> + $('input[name="disks"]').prop( "disabled",false);
> + $('input[name="disks"]').val('');
> + }
That way we will empty the "Disk size" field when changing the storage pool
I'd expect to keep the same volume size there too (10G by default)
> + });
> +
> $('#tmpl-edit-button-save').on('click', function() {
> var editableFields = [ 'name', 'cpus', 'memory', 'storagepool', 'disks', 'graphics'];
> var data = {};
More information about the Kimchi-devel
mailing list