-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 by returning apiPath from the model #10122
Conversation
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.
Just a couple minor things! Great work on this
@@ -23,6 +23,7 @@ export function sanitizePath(path) { | |||
|
|||
export default Service.extend({ | |||
attrs: null, | |||
dynamicApiPath: '', |
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.
We don't need this set here if it's just being passed into urlForItem
right?
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.
When writing a test, I noticed that it needs to be set as an empty string because it will hit getDynamicApiPath before result.apiPath is set. It then hits it again when it is set.
ui/app/services/path-help.js
Outdated
|
||
// the apiPath changes when you switch between routes but the apiPath variable does not unless the model is reloaded | ||
// check first for the dynamicApiPath which is passed through from the model->adapter | ||
// If no dynamicApiPath, then use apiPath set higher up in function |
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.
nit: I find the wording here a bit confusing. It's not exactly checking for dynamicApiPath "first", it's just overwriting apiPath
if the value exists
@@ -0,0 +1,59 @@ | |||
import { click, fillIn, settled, visit } from '@ember/test-helpers'; |
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.
👏
* fix by returning apiPath from the model * remove unused service * be more specific of when setting dynamicApiPath * new acceptance test for auth list * remove unused policy * udpate comment
* fix by returning apiPath from the model * remove unused service * be more specific of when setting dynamicApiPath * new acceptance test for auth list * remove unused policy * udpate comment
This PR fixes an issue where on route change the model is not refreshed and therefore the path to the auth method for listing roles was not being called properly. Originally this was reported in an Asana ticket for Kubernetes, but it's an issue with all auth methods.
The fix was to use the store to return the
generated-item-list
adapter that is then passed to thepath-help
service.Below you can see the change. Where before you'd see the same role list from the previous auth method selected. It would only change on refresh which would cause the model to refresh.
Additionally, when I was writing a test I noticed that in certain cases if you transitioned between auth methods and created a role or user you would create that user at the endpoint of the previous route you had visited. Here's a video of that happening. The test I wrote checks both for this and the original fix. This can still happen if you copy/paste to the create link, but that does not follow the regular flow of a UI user. However, I thought it was worthing pointing out. It has something to do with how the path is first created and not refreshed, but I was unable to get to the meat of the problem.