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

UI: EventSource project implementation to enable blocking queries for service and node listings #5267

Merged
merged 7 commits into from
Feb 15, 2019

Conversation

johncowen
Copy link
Contributor

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:

screenshot 2019-01-24 at 18 27 02

@johncowen johncowen added the theme/ui Anything related to the UI label Jan 24, 2019
@johncowen johncowen requested a review from a team January 24, 2019 18:45
@@ -0,0 +1,61 @@
import config from '../config/environment';
Copy link
Contributor Author

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);
},
});
Copy link
Contributor Author

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;
});
};
Copy link
Contributor Author

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;
},
Copy link
Contributor Author

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'.

@johncowen johncowen force-pushed the feature/ui-event-source-impl branch 2 times, most recently from 55747e2 to 2b78fde Compare January 28, 2019 13:29
Copy link

@DingoEatingFuzz DingoEatingFuzz left a 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.

this._super(...arguments);
const content = get(this, 'content');
for (let prop in content) {
(prop => {

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?

Copy link
Contributor Author

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

Choose a reason for hiding this comment

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

This is neat.

@johncowen johncowen merged commit f81d2a8 into feature/ui-event-source Feb 15, 2019
@johncowen johncowen deleted the feature/ui-event-source-impl branch February 15, 2019 10:30
johncowen added a commit that referenced this pull request Feb 21, 2019
- Maintain http headers as JSON-API meta for all API requests (#4946)
- Add EventSource ready for implementing blocking queries
- EventSource project implementation to enable blocking queries for service and node listings (#5267)
- Add setting to enable/disable blocking queries (#5352)
johncowen added a commit that referenced this pull request Feb 21, 2019
- Maintain http headers as JSON-API meta for all API requests (#4946)
- Add EventSource ready for implementing blocking queries
- EventSource project implementation to enable blocking queries for service and node listings (#5267)
- Add setting to enable/disable blocking queries (#5352)
johncowen added a commit that referenced this pull request Apr 29, 2019
- Maintain http headers as JSON-API meta for all API requests (#4946)
- Add EventSource ready for implementing blocking queries
- EventSource project implementation to enable blocking queries for service and node listings (#5267)
- Add setting to enable/disable blocking queries (#5352)
johncowen added a commit that referenced this pull request May 1, 2019
- Maintain http headers as JSON-API meta for all API requests (#4946)
- Add EventSource ready for implementing blocking queries
- EventSource project implementation to enable blocking queries for service and node listings (#5267)
- Add setting to enable/disable blocking queries (#5352)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/ui Anything related to the UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants