Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Service Catalogs: Dialogs are hanging and keeps buffering #1197

Merged
merged 3 commits into from May 1, 2017

Conversation

eclarizio
Copy link
Member

This problem arose from having multiple dialogs with auto-refreshable fields, and then when cancelling an order of one, attempting to order a different one. Since it is not a full page refresh when cancelling, the javascript that is listening for the messages stays intact and attempts to auto-refresh a field that does not exist.

This fix will replace the old postMessage way of triggering auto refreshes for dialog fields with jQuery bindings and toggles. This then allows us to unbind all the previous listeners. As a plus, it is now easier to test the listenForAutoRefreshMessages function and I've included that as well.

https://bugzilla.redhat.com/show_bug.cgi?id=1442811

@miq-bot add_label euwe/yes, fine/yes, bug

/cc @gmcculloug

@himdel Please review or tag someone else that can review. Thanks!

@@ -1,16 +1,20 @@
/* global miqInitSelectPicker miqSelectPickerEvent miqSparkle miqSparkleOn */

var dialogFieldRefresh = {
unbindAllPreviousListeners: function() {
$(document).off('autoRefresh');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eclarizio is 'autoRefresh' our trigger event name - like the old 'message' that was pulled out? Or is it specific to JS?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@syncrou Correct, instead of just a generic 'message' (which is how the postMessage call was working), I just made it so the trigger event name is 'autoRefresh'. We could even be more specific if you wanted and make it something like 'dialog::autoRefresh' or whatever if you have a better idea or a clearer name, but this is just how jQuery does it and allows us to use the .off method to unbind all the current listeners.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like dialog::autoRefresh - or dialogAutoRefresh - just something to make it obvious it's our message. Thanks a lot for explanation!

Copy link
Contributor

@syncrou syncrou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eclarizio - Only request is to rename autoRefresh to make it a little more obvious we own that message.

@miq-bot
Copy link
Member

miq-bot commented Apr 28, 2017

Checked commits eclarizio/manageiq-ui-classic@071e3cd~...21f5220 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
0 files checked, 0 offenses detected
Everything looks fine. 🏆

@gmcculloug
Copy link
Member

@dclarizio Holiday in Brno today. Is there someone that can review/merge this? Looks like @eclarizio addressed comments already.

@miq-bot add_label blocker

@miq-bot miq-bot added the blocker label May 1, 2017
@dclarizio dclarizio self-assigned this May 1, 2017
@dclarizio dclarizio requested a review from h-kataria May 1, 2017 14:33
@dclarizio dclarizio merged commit 27a33c9 into ManageIQ:master May 1, 2017
@dclarizio dclarizio added this to the Sprint 60 Ending May 8, 2017 milestone May 1, 2017
simaishi pushed a commit that referenced this pull request May 1, 2017
Fix for Service Catalogs: Dialogs are hanging and keeps buffering
(cherry picked from commit 27a33c9)

https://bugzilla.redhat.com/show_bug.cgi?id=1447088
@simaishi
Copy link
Contributor

simaishi commented May 1, 2017

Fine backport details:

$ git log -1
commit dde21c33f555462c557f32a6b74f234af102b716
Author: Dan Clarizio <dclarizi@redhat.com>
Date:   Mon May 1 09:09:10 2017 -0700

    Merge pull request #1197 from eclarizio/BZ1442811
    
    Fix for Service Catalogs: Dialogs are hanging and keeps buffering
    (cherry picked from commit 27a33c9070c1dbb1ef54a8e8c204c3159fe0dde6)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1447088

@simaishi
Copy link
Contributor

Euwe backport (to manageiq repo) details:

$ git log -1
commit 6e0628e3afad63bb9e095ef980dae0516492dcbe
Author: Dan Clarizio <dclarizi@redhat.com>
Date:   Mon May 1 09:09:10 2017 -0700

    Merge pull request #1197 from eclarizio/BZ1442811
    
    Fix for Service Catalogs: Dialogs are hanging and keeps buffering
    (cherry picked from commit 27a33c9070c1dbb1ef54a8e8c204c3159fe0dde6)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1447091

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants