[Kimchi-devel] [PATCH] UI enhancement: Request /config/capabilities as soon as possible

Aline Manera alinefm at linux.vnet.ibm.com
Fri Aug 8 20:15:02 UTC 2014


On 08/08/2014 05:00 PM, Aline Manera wrote:
>
> On 08/08/2014 03:29 PM, Crístian Viana wrote:
>> I like the idea to run "kimchi.getCapabilities" only once and use its 
>> results later. Those values are very unlikely to change unless there 
>> is some server upgrade.
>>
>> But as far as I understand, there is no syncing strategy to make sure 
>> the new variable "kimchi.capabilities" will only be read when the 
>> function "kimchi.getCapabilities" has been executed successfully. 
>> This may lead to an execution error (i.e. "kimchi.capabilities" may 
>> still be undefined) or inconsistent values (e.g the host may have 
>> QEMU stream capability but if the function "kimchi.getCapabilities" 
>> hasn't finished executing yet, "kimchi.capabilities.qemu_stream" 
>> might still have its default value - not the actual one).
>>
>
> According to the code, the /config/capabilities request will be the 
> first request made while entering the templates tab.
> So if it takes time to complete the templates will not be listed and 
> kimchi.capabilities not used.

Ops... it is not true! =$

I need to move doListTemplates() in the .done() block for 
kimchi.getCapabilities()

+    kimchi.getCapabilities(function(result) {
+        kimchi.capabilities = result;
+    }, function() {
+        kimchi.capabilities = {};
+    }, function() {
+       doListTemplates();
+    });
+

I will send a v2 with that

>
>
>
>> Also, if the approach is to run "kimchi.getCapabilities" once and 
>> then cache its results, we might as well use those cached values 
>> elsewhere in Kimchi. The tab "Host" will still execute that function.
>>
>
> The host tab uses values that can be changed any time without 
> requiring to restart Kimchi.
> Because that we can not do the same there.
> For example, host tab checks for sosreport tool and if user installs 
> it later it does not trigger a kimchi restart so we always need to 
> care this info,
>
>> On 08-08-2014 14:15, Aline Manera wrote:
>>> /config/capabilities was requested twice for the templates tab: one
>>> request to identify if qemu has spice support and other one to identify
>>> if the qemu has ISO streaming support.
>>>
>>> Those requests were made right before using the information, causing a
>>> delay on UI until get the server response.
>>>
>>> For example, for distant servers, while creating a new template the
>>> "Remote ISO" option was disabled at the first time and after some 
>>> time it was
>>> enabled.
>>> The same behavior was identified while editing a template, as the 
>>> graphics
>>> options blinked to add the spice on it.
>>>
>>> To fix it, request /config/capabilities when loading the templates 
>>> tab to have
>>> this information prior to edit or create a new template.
>>>
>>> Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
>
> _______________________________________________
> Kimchi-devel mailing list
> Kimchi-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/kimchi-devel
>




More information about the Kimchi-devel mailing list