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 by returning apiPath from the model #10122

Merged
merged 6 commits into from
Oct 19, 2020
Merged

Conversation

Monkeychip
Copy link
Contributor

@Monkeychip Monkeychip commented Oct 9, 2020

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 the path-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.

auth

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.

Screen Recording 2020-10-13 at 12 01 02 PM

@Monkeychip Monkeychip added this to the 1.6 milestone Oct 12, 2020
@Monkeychip Monkeychip marked this pull request as ready for review October 14, 2020 17:07
@Monkeychip Monkeychip added the ui label Oct 14, 2020
@mladlow mladlow modified the milestones: 1.6, 1.5.5 Oct 15, 2020
Copy link
Contributor

@chelshaw chelshaw left a 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: '',
Copy link
Contributor

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?

Copy link
Contributor Author

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.


// 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
Copy link
Contributor

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';
Copy link
Contributor

Choose a reason for hiding this comment

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

👏

@Monkeychip Monkeychip merged commit 620259d into master Oct 19, 2020
@Monkeychip Monkeychip deleted the ui/kub-auth-bug-fix branch October 19, 2020 16:42
Monkeychip added a commit that referenced this pull request Oct 19, 2020
* 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
Monkeychip added a commit that referenced this pull request Oct 19, 2020
* 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
Monkeychip added a commit that referenced this pull request Oct 19, 2020
* 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
Monkeychip added a commit that referenced this pull request Oct 19, 2020
* 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
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.

3 participants