[PATCH] Fix Bug: Template Tab Broken in Chrome due to Code Error

String.prototype.startsWith is a Firefox-specified API and Chrome doesn't support it. Replace it with a generic method. Signed-off-by: Hongliang Wang <hlwang@linux.vnet.ibm.com> --- ui/js/src/kimchi.template_main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/js/src/kimchi.template_main.js b/ui/js/src/kimchi.template_main.js index eaa5247..48354c9 100644 --- a/ui/js/src/kimchi.template_main.js +++ b/ui/js/src/kimchi.template_main.js @@ -22,7 +22,7 @@ kimchi.doListTemplates = function() { var listHtml = ''; var templateHtml = $('#templateTmpl').html(); $.each(result, function(index, value) { - var isLocal = value.cdrom.startsWith("/"); + var isLocal = /^\//.test(value['cdrom']); if(isLocal){ value.location = "images/theme-default/icon-local.png"; }else{ -- 1.8.1.4

Reviewed-by: Daniel Barboza <danielhb@linux.vnet.ibm.com> On 06/09/2014 04:43 AM, Hongliang Wang wrote:
String.prototype.startsWith is a Firefox-specified API and Chrome doesn't support it. Replace it with a generic method.
Signed-off-by: Hongliang Wang <hlwang@linux.vnet.ibm.com> --- ui/js/src/kimchi.template_main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui/js/src/kimchi.template_main.js b/ui/js/src/kimchi.template_main.js index eaa5247..48354c9 100644 --- a/ui/js/src/kimchi.template_main.js +++ b/ui/js/src/kimchi.template_main.js @@ -22,7 +22,7 @@ kimchi.doListTemplates = function() { var listHtml = ''; var templateHtml = $('#templateTmpl').html(); $.each(result, function(index, value) { - var isLocal = value.cdrom.startsWith("/"); + var isLocal = /^\//.test(value['cdrom']); if(isLocal){ value.location = "images/theme-default/icon-local.png"; }else{

Applied. Thanks. Regards, Aline Manera

I just recently started using Chrome more, and hadn't had any issues with the template page. However, I just pulled in this change and now I can't see my templates. I can still see them in Firefox. I've got Chrome v 35.0.1916.114. This isn't that useful, but here's the error message from the console: Uncaught TypeError: undefined is not a function kimchi.min.js?cacheBust=1402085693.96:6156 (anonymous function) kimchi.min.js?cacheBust=1402085693.96:6156 x.extend.each jquery-1.10.0.min.js?cacheBust=1392854554.84:4 (anonymous function) kimchi.min.js?cacheBust=1402085693.96:6155 c jquery-1.10.0.min.js?cacheBust=1392854554.84:4 p.fireWith jquery-1.10.0.min.js?cacheBust=1392854554.84:4 k jquery-1.10.0.min.js?cacheBust=1392854554.84:6 r jquery-1.10.0.min.js?cacheBust=1392854554.84:6 On Mon, 2014-06-09 at 15:52 -0300, Aline Manera wrote:
Applied. Thanks.
Regards,
Aline Manera
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel

I just recently started using Chrome more, and hadn't had any issues with the template page. However, I just pulled in this change and now I can't see my templates. I can still see them in Firefox. I've got Chrome v 35.0.1916.114. That's weird... I was having the original bug recently (i.e. the template page was empty) but after this patch it works OK now. I'm using
On 10-06-2014 17:40, Christy Perez wrote: the exact same version of Chrome as you, on Fedora 20. And it works fine for me. Did you clean the browser's cache after that patch? I always test Kimchi using the Incognito Mode so I'm always on a clean cache state.

On Tue, 2014-06-10 at 17:54 -0300, Crístian Viana wrote:
I just recently started using Chrome more, and hadn't had any issues with the template page. However, I just pulled in this change and now I can't see my templates. I can still see them in Firefox. I've got Chrome v 35.0.1916.114. That's weird... I was having the original bug recently (i.e. the template page was empty) but after this patch it works OK now. I'm using
On 10-06-2014 17:40, Christy Perez wrote: the exact same version of Chrome as you, on Fedora 20. And it works fine for me.
Did you clean the browser's cache after that patch? I always test Kimchi using the Incognito Mode so I'm always on a clean cache state.
I think that was it. I just went back in and see that my templates are now showing up. I had cleared my cache for another problem I was having. So, nevermind! And thanks Crístian! - Christy

On 06/11/2014 12:35 PM, Christy Perez wrote:
On Tue, 2014-06-10 at 17:54 -0300, Crístian Viana wrote:
I just recently started using Chrome more, and hadn't had any issues with the template page. However, I just pulled in this change and now I can't see my templates. I can still see them in Firefox. I've got Chrome v 35.0.1916.114. That's weird... I was having the original bug recently (i.e. the template page was empty) but after this patch it works OK now. I'm using
On 10-06-2014 17:40, Christy Perez wrote: the exact same version of Chrome as you, on Fedora 20. And it works fine for me.
Did you clean the browser's cache after that patch? I always test Kimchi using the Incognito Mode so I'm always on a clean cache state. I think that was it. I just went back in and see that my templates are now showing up. I had cleared my cache for another problem I was having.
So, nevermind! And thanks Crístian! Thanks for the testing and updating!
- Christy
participants (5)
-
Aline Manera
-
Christy Perez
-
Crístian Viana
-
Daniel H Barboza
-
Hongliang Wang