[Kimchi-devel] Q
Aline Manera
alinefm at linux.vnet.ibm.com
Wed Aug 5 18:10:58 UTC 2015
Hi Ramon,
You can check in code how we cache the capabilities values.
We do exactly what you want to do for the PCI devices.
In ui/js/src/kimchi.host.js you can see the code below:
var setupUI = function() {
if (kimchi.capabilities == undefined) {
setTimeout(setupUI, 2000);
return;
}
...
}
Hope it helps you.
Regards,
Aline Manera
On 15/07/2015 09:10, Ramon Medeiros wrote:
> Hi Cristian,
>
> I was trying to do this:
>
> 1) Cache all deviceCompanions in a object, that the key will be the
> hostPCI
>
> 2) Query this information when the user enter in guest edit, instead
> of download everytime the user enter on this page
>
>
> So, why i am asking about setTimeout?
>
> I tried to do the operations above and hit an error: The guest_edit
> page was unable to get the deviceCompanions because they were not
> downloaded, so, i would like to put an timeout (or other function) to
> make the function waits for this download, and then, continue to load
> kimchi.
>
> On 07/14/2015 11:44 PM, Crístian Viana wrote:
>> But I still don't understand how the function setTimeout can help you
>> with that. Adding a timeout probably won't solve your problem, it
>> won't cache anything, it will just delay the page unresponsiveness.
>>
>> On Tue, Jul 14, 2015 at 2:57 PM Ramon Medeiros
>> <ramonn at linux.vnet.ibm.com <mailto:ramonn at linux.vnet.ibm.com>> wrote:
>>
>> Hi Cristian, nice to see you here :)
>>
>> The function getPCIDeviceCompanions tooks almost two second for
>> each interation. As this function being called each time that the
>> Edit button is accessed, i want to cache the values on
>> kimchi.main() to save time.
>>
>> On systems that has too much pci devices, a popup from the
>> browser asks for quit the page by unresponsible script.
>>
>>
>> On 07/14/2015 09:14 AM, Crístian Viana wrote:
>>> The function "kimchi.getPCIDeviceCompanions" (and most other
>>> Kimchi JavaScript functions, actually) receives a callback
>>> function which receives a result parameter. That function should
>>> be executed when the result is ready. In your case, your
>>> parameter function doesn't match this requirement (i.e. you're
>>> passing a function which receives a function which receives a
>>> parameter). You need to pass parameters exactly as they're
>>> expected by the main function.
>>>
>>> Also, why are you using setTimeout at all?
>>>
>>> On Fri, Jul 10, 2015 at 5:57 PM Ramon Medeiros
>>> <ramonn at linux.vnet.ibm.com <mailto:ramonn at linux.vnet.ibm.com>>
>>> wrote:
>>>
>>> Hi team,
>>>
>>> i was trying to cache 2 objects, but they came from a HTTP
>>> request, and
>>> took some time to download it. I was unable to use the function
>>> setTimeout while calling this function:
>>>
>>> kimchi.getPCIDeviceCompanions(kimchi.hostPCIs[i].name,
>>> setTimeout(function(result) {
>>> kimchi.deviceCompanions[kimchi.hostPCIs[i].name] = result;
>>> },5000));
>>> }
>>>
>>>
>>> The function kimchi.getPCIDeviceCompanions usually takes 2s
>>> to finish.
>>>
>>> --
>>>
>>> Ramon Nunes Medeiros
>>> Kimchi Developer
>>> Linux Technology Center Brazil
>>> IBM Systems & Technology Group
>>> Phone : +55 19 2132 7878
>>> ramonn at br.ibm.com <mailto:ramonn at br.ibm.com>
>>>
>>> _______________________________________________
>>> Kimchi-devel mailing list
>>> Kimchi-devel at ovirt.org <mailto:Kimchi-devel at ovirt.org>
>>> http://lists.ovirt.org/mailman/listinfo/kimchi-devel
>>>
>>
>> --
>>
>> Ramon Nunes Medeiros
>> Kimchi Developer
>> Linux Technology Center Brazil
>> IBM Systems & Technology Group
>> Phone : +55 19 2132 7878
>> ramonn at br.ibm.com <mailto:ramonn at br.ibm.com>
>>
>
> --
>
> Ramon Nunes Medeiros
> Kimchi Developer
> Linux Technology Center Brazil
> IBM Systems & Technology Group
> Phone : +55 19 2132 7878
> ramonn at br.ibm.com
>
>
> _______________________________________________
> Kimchi-devel mailing list
> Kimchi-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/kimchi-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/kimchi-devel/attachments/20150805/fed4cc4b/attachment.html>
More information about the Kimchi-devel
mailing list