[Kimchi-devel] [PATCH 1/5] Storage Pool Add Volume UI: Add APIs to kimchi.api.js
Hongliang Wang
hlwang at linux.vnet.ibm.com
Tue Sep 16 09:52:01 UTC 2014
On 09/16/2014 05:28 AM, Aline Manera wrote:
> From: Hongliang Wang <hlwang at linux.vnet.ibm.com>
>
> Add API to handle downloand and upload features.
>
> Signed-off-by: Hongliang Wang <hlwang at linux.vnet.ibm.com>
> Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
Reviewed-by: Hongliang Wang <hlwang at linux.vnet.ibm.com>
> ---
> ui/js/src/kimchi.api.js | 35 +++++++++++++++++++++++++++++++++++
> 1 file changed, 35 insertions(+)
>
> diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
> index 681f573..3398bd4 100644
> --- a/ui/js/src/kimchi.api.js
> +++ b/ui/js/src/kimchi.api.js
> @@ -1142,5 +1142,40 @@ var kimchi = {
> kimchi.message.error(data.responseJSON.reason);
> }
> });
> + },
> +
> + /**
> + * Add a volume to a given storage pool.
> + */
> + uploadVolumeToSP: function(settings, suc, err) {
> + var fd = settings['formData'];
> + var sp = encodeURIComponent(settings['sp']);
> + kimchi.requestJSON({
> + url : kimchi.url + 'storagepools/' + sp + '/storagevolumes',
> + type : 'POST',
> + data : fd,
> + processData : false,
> + contentType : false,
> + dataType: 'json',
> + success : suc,
> + error : err
> + });
> + },
> +
> + /**
> + * Add a volume to a given storage pool by URL.
> + */
> + downloadVolumeToSP: function(settings, suc, err) {
> + var sp = encodeURIComponent(settings['sp']);
> + delete settings['sp'];
> + kimchi.requestJSON({
> + url : kimchi.url + 'storagepools/' + sp + '/storagevolumes',
> + type : 'POST',
> + data : JSON.stringify(settings),
> + contentType : 'application/json',
> + dataType : 'json',
> + success : suc,
> + error : err
> + });
> }
> };
More information about the Kimchi-devel
mailing list