-
Notifications
You must be signed in to change notification settings - Fork 356
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
Retrieve manager resource from backend and inject in Ansible Credentials form #855
Retrieve manager resource from backend and inject in Ansible Credentials form #855
Conversation
@mzazrivec @himdel Please review/test and merge if you're convinced. |
Checked commit AparnaKarve@535ff23 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
Soo... I don't know :). On the one hand, this definitely sounds good for performance, the code is clean and clear.. 👍 On the other, this changes code that went through the API to go via the ui-classic code instead, which is not really the direction we're trying to go. Also, it sounds like that 511ms is a bit misleading, since 224ms out of that is spent waiting for authentications anyway. Furthermore, the data is not really needed until you try to save, so I'd argue the timing is simply irrelevant, except for automated tests. @mzazrivec WDYT? Also, @jntullo, IIRC having to send |
If you recall the discussion in #641 (comment), I've been trying to get the
Whichever way you slice it, this approach does have a better performance
True, probably not in this case. But in general this is a good practice to use fewer HTTP requests. |
hmm @himdel, I am not sure what issue you are referring to. AFAIK, you will need to specify the however for creating authentications on the configuration_script_payloads subcollection, (ie I did notice the specs here still include the |
I don't like this change. This change would move us from using rest api back to rails. Saving one http request doesn't |
Agreed, also, it looks like we can just remove the (The same should be true shortly for Repositories ( |
True, but I see it as a better option than the current solution.
No, tbh, performance wasn't the only thing on my mind, there was something else too... I remember cringing, when I first saw this -- API.get('/api/providers?collection_class=ManageIQ::Providers::EmbeddedAutomationManager')
.then(setManagerResource)
.catch(miqService.handleFailure); That's what I was mainly trying to target and address.
Could not agree more, and that was not my primary goal either. I was hoping that you would see the larger picture that I was trying to portray. Anyway, this was a great discussion and I sure do appreciate everyone's comments here. So thank you for that. |
This pull request is not mergeable. Please rebase and repush. |
The branch for the PR got deleted inadvertently while trying to do some remote github cleanup - |
The main idea here is to minimize using GETs in the angular form if possible, for a potentially better performance and a faster loading form.
Also, more importantly, I'm trying to implement a good practice of minimizing HTTP requests in the forms, given the fact that we are now getting so REST API-heavy.
In the Credentials form we have one area where we can remove the API GET call that retrieves the
manager resource
...since all that we really need is the
manager resource id
which can very well be retrieved on the Rails side and then can be injected in the angular form.I have some data here that gives us an idea of how much time we could potentially save by removing that extra GET call.
Note that machine speeds vary, network speeds vary, so this is really a rough ballpark.
Production mode (113 ms) -
Development mode (511 ms) -
Now 113 ms in Production mode may not sound too impressive, but I think that every little bit counts and matters in the long run, and it's a step in the right direction since it's also about the good practice of minimizing HTTP requests.
(Currently I do not have the data of how much time Rails takes to retrieve the
manager resource
but I'm inclined to think that it would be a less expensive operation compared to an API call.)Hopefully, this practice of minimizing HTTP requests will be implemented across all our present/future REST API forms in simple creative ways (like in this example) either by leveraging Rails itself (applicable to Classic-UI only) or by refactoring the API.