ceph / calamari-clients

Ceph Manager API Client Code
Other
101 stars 59 forks source link

Poll every 500ms to activate login button #64

Closed tserong closed 9 years ago

tserong commented 9 years ago

There's another variant of issue #8352, where the form is initially blank, but the user later types in a username which causes Firefox to autofill the password field at this point in time, rather than on initial pageload. This does not trigger an input event, so the submit button is never enabled. To workaround this, I've changed setTimeout to setInterval, so the page continually polls every 500ms. This also means we can remove the input event handlers, because the poll will pick up the changed fields quickly anyway.

Signed-off-by: Tim Serong tserong@suse.com

ChristinaMeno commented 9 years ago

@tserong Have you considered the effect this will have on the client CPU? Seems to me that polling like that would waste resources. Am I missing something?

tserong commented 9 years ago

I expect it to have at least some impact (after all, it does poll continuously), but IMO it's probably negligible:

tserong commented 9 years ago

@kmkanagaraj it was Firefox on openSUSE, some version slightly less than 34 (it definitely occurs in v24, which I've still got on an old Debian box but that's comparitively ancient). Since updating my main desktop to Firefox 34, I can't reproduce anymore, which suggests FF is triggering the right event now when the password autofills after manually entering the username.

So, this bizarre edge case seems to only be a problem if you don't have the latest & greatest browser. IMO there should be no real harm in taking this patch to support slightly older Firefoxes (a 500ms poll checking the value of a field is surely vastly less load than a random average web page left open with ads, share buttons and all that other junk), but OTOH, you could just say "please upgrade your browser"...

ChristinaMeno commented 9 years ago

@tserong @kmkanagaraj I am going to close this since the form works as expected in new versions of firefox