[Kimchi-devel] [PATCH v2 1/4] Storage Pool Add Volume UI: Add APIs to kimchi.api.js
Hongliang Wang
hlwang at linux.vnet.ibm.com
Mon Sep 15 06:59:32 UTC 2014
On 09/12/2014 09:20 PM, Aline Manera wrote:
>
> On 09/12/2014 06:42 AM, Hongliang Wang wrote:
>> Added APIs.
>>
>> Signed-off-by: Hongliang Wang <hlwang at linux.vnet.ibm.com>
>> ---
>> ui/js/src/kimchi.api.js | 37 +++++++++++++++++++++++++++++++++++++
>> 1 file changed, 37 insertions(+)
>>
>> diff --git a/ui/js/src/kimchi.api.js b/ui/js/src/kimchi.api.js
>> index 681f573..0e27987 100644
>> --- a/ui/js/src/kimchi.api.js
>> +++ b/ui/js/src/kimchi.api.js
>> @@ -1142,5 +1142,42 @@ 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,
>
>> + headers : {
>> + Accept : 'application/json; charset=utf-8'
>> + },
>
> Instead of headers, you can only set "dataType: json"
ACK.
>
>> + 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