-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
UI: EventSource project implementation to enable blocking queries for service and node listings #5267
UI: EventSource project implementation to enable blocking queries for service and node listings #5267
Conversation
@@ -0,0 +1,61 @@ | |||
import config from '../config/environment'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Below here we dynamically create the new EventSource returning repositories. Right now we just need to do this with nodes and services - other models will be added in here to enable blocking queries support for those models.
} | ||
return this._super(...arguments); | ||
}, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above uses the controller-lifecycle PR (#5056) to automatically cleanup any 'closeable' things, in this case EventSources
} | ||
throw e; | ||
}); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above cb
here is essentially the content of our Callable/BlockingEventSource
, this is the code that it called every 'tick'. It uses the original ember-dataset resolving Repository that we already had to do the actual requests.
The code around it gives us the opportunity to centrally deal with a post-initialization on/off setting, plus any other settings or global EventSource related errors. Please note, we're planning on removing the throttle
here and using a rate limiter of some sort.
}, | ||
shouldProxy: function(content, method) { | ||
return method.indexOf('find') === 0; | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any find
methods will be dealt with by this class (which adds a 'layer' over the original Repository class), any other methods will be dealt with by the original itself without the extra 'layer'.
a78ca09
to
d4e3022
Compare
55747e2
to
2b78fde
Compare
4e25bce
to
2ac38c2
Compare
...also fix associated kv double
1. Add `[]` to relevant computed properties 2. Clean up `index` on the URL 3. Add WithEventSource mixin to auto cleanup EventSources when leaving a view
2b78fde
to
dcd21af
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work. This is coming along nicely.
ui-v2/app/services/lazy-proxy.js
Outdated
this._super(...arguments); | ||
const content = get(this, 'content'); | ||
for (let prop in content) { | ||
(prop => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why wrap this in an iife? Wouldn't removing the iife result in the same thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm yeah , can't remember exactly. I think it's left over from a different version of that that had some async stuff in there somewhere. I vaguely remember putting this in as I hit that for
async thing where the variable has already 'moved on', but I'm guessing that was in a previous version of this at some point. Will remove, thanks for spotting!
--- | ||
Then the url should be /dc-1/[Url] | ||
And pause until I see 3 [Model] models | ||
And an external edit results in 5 [Model] models |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is neat.
This PR enables blocking query support for service and node listing pages.
Please note, this is to be merged down onto #5070, and lastly down onto
ui-staging
so we can continue this work and integrate the XHR connection management and enable blocking queries for the rest of the UI.We plan on making enabling blocking queries a 'post-runtime initialisation' user setting. The work for this is here, yet the settings page for this will be re-enabled in another PR before finally merging to
master
.For the moment to view the changes please manually add a setting via localStorage: