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(Redirection on deleting monitor): fixed redirection on deleting monitor #59962

Conversation

Shubhdeep12
Copy link
Contributor

Fixes: #59723

When the filter is applied on crons page (monitor listing page) - then prevUrl gets added to URL. which helps in redirection to the correct URL when the monitor is deleted by user.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@Shubhdeep12 Shubhdeep12 requested a review from a team as a code owner November 15, 2023 05:32
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 15, 2023
@Shubhdeep12 Shubhdeep12 changed the title Fix(Redirection on deleting monitor) fixed redirection on deleting monitor Fix(Redirection on deleting monitor): fixed redirection on deleting monitor Nov 15, 2023
Copy link
Contributor

@davidenwang davidenwang left a comment

Choose a reason for hiding this comment

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

Thanks for this contribution, left a comment

browserHistory.push(
normalizeUrl(
`/organizations/${orgId}/crons/${
router.location.query.prevUrl ? `?project=${router.location.query.prevUrl}` : ''
Copy link
Contributor

Choose a reason for hiding this comment

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

This method works, but adds unnecessary query parameters to the URL

It also only functions when coming from the monitor overview page, if you were to add a monitor and then delete it immediately you would be redirected back to a page without a project selection

What I think we could do here is leverage the selection from usePageFilters which holds global state around which project(s) were selected and feed those into the query params. Let me know if that makes sense and if it works out, I haven't tried it.

Copy link
Contributor Author

@Shubhdeep12 Shubhdeep12 Nov 17, 2023

Choose a reason for hiding this comment

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

Yes @davidenwang correct. Using prevUrl is not needed as we need selected filters - projects and environments which will be present in usePageFilters.

And, yes i only covered just one flow but the creation, edition redirection should also be handled and also the breadcrumbs.

I am pushing a commit in sometime for this.

Thanks

@Shubhdeep12
Copy link
Contributor Author

Thanks for this contribution, left a comment

Hi @davidenwang updated the changes. Please check.

  • used selection from usePageFilters to get the applied filters.
  • Fixed redirection in Breadcrumbs
  • Fixed redirection when detail page opened from create/edit flow.

Copy link
Contributor

@davidenwang davidenwang left a comment

Choose a reason for hiding this comment

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

apologies on the late review, but this is looking good. Thanks for working on this!

@davidenwang davidenwang added the Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests label Dec 5, 2023
@davidenwang davidenwang merged commit e28af2f into getsentry:master Dec 5, 2023
39 of 41 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Frontend Automatically applied to PRs that change frontend components Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crons: Deleting a monitor removes the project selection
2 participants