<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
Hi Ramon,<br>
<br>
You can check in code how we cache the capabilities values.<br>
We do exactly what you want to do for the PCI devices.<br>
<br>
In ui/js/src/kimchi.host.js you can see the code below:<br>
<br>
var setupUI = function()
{ <br>
if (kimchi.capabilities == undefined)
{ <br>
setTimeout(setupUI,
2000); <br>
return; <br>
} <br>
...<br>
}<br>
<br>
Hope it helps you.<br>
<br>
Regards,<br>
Aline Manera<br>
<br>
<div class="moz-cite-prefix">On 15/07/2015 09:10, Ramon Medeiros
wrote:<br>
</div>
<blockquote cite="mid:55A64DC5.8050600@linux.vnet.ibm.com"
type="cite">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
Hi Cristian,<br>
<br>
I was trying to do this:<br>
<br>
1) Cache all deviceCompanions in a object, that the key will be
the hostPCI<br>
<br>
2) Query this information when the user enter in guest edit,
instead of download everytime the user enter on this page<br>
<br>
<br>
So, why i am asking about setTimeout?<br>
<br>
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.<br>
<br>
<div class="moz-cite-prefix">On 07/14/2015 11:44 PM, Crístian
Viana wrote:<br>
</div>
<blockquote
cite="mid:CADqiwxzqCvOkX_RhqhhtvPkRdcRSK9DGHoSfXPWXuM65obQdnQ@mail.gmail.com"
type="cite">
<div dir="ltr">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.</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Tue, Jul 14, 2015 at 2:57 PM Ramon Medeiros
<<a moz-do-not-send="true"
href="mailto:ramonn@linux.vnet.ibm.com">ramonn@linux.vnet.ibm.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> Hi Cristian, nice to
see you here :)<br>
<br>
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.<br>
<br>
On systems that has too much pci devices, a popup from the
browser asks for quit the page by unresponsible script.</div>
<div bgcolor="#FFFFFF" text="#000000"><br>
<br>
<div>On 07/14/2015 09:14 AM, Crístian Viana wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">The function "<span
style="font-size:13.1999998092651px;line-height:19.7999992370605px">kimchi.</span><span
style="font-size:13.1999998092651px;line-height:19.7999992370605px">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.</span>
<div><span
style="font-size:13.1999998092651px;line-height:19.7999992370605px"><br>
</span></div>
<div>Also, why are you using setTimeout at all?</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Fri, Jul 10, 2015 at 5:57 PM Ramon
Medeiros <<a moz-do-not-send="true"
href="mailto:ramonn@linux.vnet.ibm.com"
target="_blank">ramonn@linux.vnet.ibm.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hi
team,<br>
<br>
i was trying to cache 2 objects, but they came from
a HTTP request, and<br>
took some time to download it. I was unable to use
the function<br>
setTimeout while calling this function:<br>
<br>
kimchi.getPCIDeviceCompanions(kimchi.hostPCIs[i].name,<br>
setTimeout(function(result) {<br>
kimchi.deviceCompanions[kimchi.hostPCIs[i].name] =
result;<br>
},5000));<br>
}<br>
<br>
<br>
The function kimchi.getPCIDeviceCompanions usually
takes 2s to finish.<br>
<br>
--<br>
<br>
Ramon Nunes Medeiros<br>
Kimchi Developer<br>
Linux Technology Center Brazil<br>
IBM Systems & Technology Group<br>
Phone : +55 19 2132 7878<br>
<a moz-do-not-send="true"
href="mailto:ramonn@br.ibm.com" target="_blank">ramonn@br.ibm.com</a><br>
<br>
_______________________________________________<br>
Kimchi-devel mailing list<br>
<a moz-do-not-send="true"
href="mailto:Kimchi-devel@ovirt.org"
target="_blank">Kimchi-devel@ovirt.org</a><br>
<a moz-do-not-send="true"
href="http://lists.ovirt.org/mailman/listinfo/kimchi-devel"
rel="noreferrer" target="_blank">http://lists.ovirt.org/mailman/listinfo/kimchi-devel</a><br>
</blockquote>
</div>
</blockquote>
<br>
<pre cols="72">--
Ramon Nunes Medeiros
Kimchi Developer
Linux Technology Center Brazil
IBM Systems & Technology Group
Phone : +55 19 2132 7878
<a moz-do-not-send="true" href="mailto:ramonn@br.ibm.com" target="_blank">ramonn@br.ibm.com</a> </pre>
</div>
</blockquote>
</div>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Ramon Nunes Medeiros
Kimchi Developer
Linux Technology Center Brazil
IBM Systems & Technology Group
Phone : +55 19 2132 7878
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:ramonn@br.ibm.com">ramonn@br.ibm.com</a> </pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Kimchi-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Kimchi-devel@ovirt.org">Kimchi-devel@ovirt.org</a>
<a class="moz-txt-link-freetext" href="http://lists.ovirt.org/mailman/listinfo/kimchi-devel">http://lists.ovirt.org/mailman/listinfo/kimchi-devel</a>
</pre>
</blockquote>
<br>
</body>
</html>