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

[backport-2.9]: Fix a problem with deleting role templates from their detail pages #12419

Merged
merged 2 commits into from
Oct 31, 2024

Conversation

codyrancher
Copy link
Contributor

@codyrancher codyrancher commented Oct 29, 2024

backport of #12270

fixes: #12218

Checklist

  • The PR is linked to an issue and the linked issue has a Milestone, or no issue is needed
  • The PR has a Milestone
  • The PR template has been filled out
  • The PR has been self reviewed
  • The PR has a reviewer assigned
  • The PR has automated tests or clear instructions for manual tests and the linked issue has appropriate QA labels, or tests are not needed
  • The PR has reviewed with UX and tested in light and dark mode, or there are no UX changes

@codyrancher codyrancher added this to the v2.9.4 milestone Oct 29, 2024
@codyrancher codyrancher force-pushed the role-template-bp branch 2 times, most recently from 9dd54a7 to f0c9047 Compare October 30, 2024 00:30
… detail pages

We were attempting to navigate back to a non-existent page when deleting role templates from their corresponding detail pages. This caused the Prompt Remove dialog to show an error button and not close.

rancher#12217
The fix would "change" routes to the same route which vue3 doesn't complain about. However in vue2 you can't change to the same route without emitting an exception. This change ensures the route is different before pushing.
Comment on lines +303 to +308
// Only push if the route will change otherwise we'll get a `NavigationDuplicated` exception
const resolvedRoute = this.currentRouter.resolve(this.cachedDoneLocation);

if (resolvedRoute.resolved.fullPath !== this.$route.fullPath) {
this.currentRouter.push(this.cachedDoneLocation);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was not a part of the original PR. This was needed as a part of the backport because vue2 treats pushing to the same location as an error where as vue3 doesn't. Without this change one of our e2e tests would fail.

@@ -131,6 +132,8 @@ describe('Roles Templates', { tags: ['@usersAndAuths', '@adminUser'] }, () => {
createClusterRole.saveAndWaitForRequests('POST', '/v3/roletemplates').then((res) => {
const clusterRoleId = res.response?.body.id;

roleTemplatesToDelete.push(clusterRoleId);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was also not a part of the PR but was supporting code that was added by a separate pr in 2.10.

@codyrancher codyrancher marked this pull request as ready for review October 31, 2024 03:40
Copy link
Member

@rak-phillip rak-phillip left a comment

Choose a reason for hiding this comment

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

LGTM - I just noticed a typo that we missed in the original PR. I don't think this blocks merging in any way.

@@ -516,6 +516,7 @@ export default {
<button
v-if="isView"
ref="actions"
data-testid="mathead-action-menu"
Copy link
Member

Choose a reason for hiding this comment

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

hmm.. I'm just noticing a typo in the id for this backport

Suggested change
data-testid="mathead-action-menu"
data-testid="masthead-action-menu"

This is also present in the master branch, so we can keep it as-is if that's more straightforward for the backport.

@nwmac
Copy link
Member

nwmac commented Oct 31, 2024

@codyrancher Good to merge

@codyrancher codyrancher merged commit defc1f4 into rancher:release-2.9 Oct 31, 2024
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants