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

Add Discard action to scheduled jobs #73

Merged
merged 2 commits into from
Feb 27, 2024

Conversation

JuanVqz
Copy link
Contributor

@JuanVqz JuanVqz commented Feb 18, 2024

This is adding the ability to discard a scheduled job. This is useful when a job is no longer needed and you want to remove it from the queue.

Closes https://github.com/basecamp/mission_control-jobs/issues/58

Screenshot 2024-02-18 at 0 56 34

@JuanVqz
Copy link
Contributor Author

JuanVqz commented Feb 18, 2024

I'll add tests if this covers what you expected.

Also, we can add a button to discard all, can it be part of the same PR?

@rosa
Copy link
Member

rosa commented Feb 18, 2024

@JuanVqz awesome! Thanks a lot! This is perfect.

Also, we can add a button to discard all, can it be part of the same PR?

Yes, good idea! 👍🏻

This is adding the ability to discard a scheduled job. This is useful
when a job is no longer needed and you want to remove it from the queue.

Closes https://github.com/basecamp/mission_control-jobs/issues/58
@JuanVqz JuanVqz force-pushed the add-discard-action-to-scheduled-jobs branch from b6d8a4b to 950b118 Compare February 19, 2024 04:40
@JuanVqz
Copy link
Contributor Author

JuanVqz commented Feb 19, 2024

@JuanVqz awesome! Thanks a lot! This is perfect.

Also, we can add a button to discard all, can it be part of the same PR?

Yes, good idea! 👍🏻

Hey @rosa thanks for the quick response, I'll do the discard all in a different PR, discovered the bulk discards controller is kind of tied to the failed status.

I already added an assertion for the discard button, making this ready to be reviewed 👍

@@ -20,7 +20,7 @@ def attribute_names_for_job_status(status)
when "failed" then [ "Error", "" ]
when "blocked" then [ "Queue", "Blocked by", "Block expiry" ]
when "finished" then [ "Queue", "Finished" ]
when "scheduled" then [ "Queue", "Scheduled" ]
when "scheduled" then [ "Queue", "Scheduled", ""]
Copy link
Member

Choose a reason for hiding this comment

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

There's a space missing here:

Suggested change
when "scheduled" then [ "Queue", "Scheduled", ""]
when "scheduled" then [ "Queue", "Scheduled", "" ]

I think Rubocop is complaining about that as well.

<div class="buttons is-right">
<%= button_to "Discard", application_job_discard_path(@application, job.job_id), class: "button is-danger is-light mr-0",
form: { data: { turbo_confirm: "This will delete the job and can't be undone. Are you sure?" } } %>
</div>
Copy link
Member

Choose a reason for hiding this comment

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

Missing newline at the end of this file.

Copy link
Member

@rosa rosa left a comment

Choose a reason for hiding this comment

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

Thanks a lot @JuanVqz, there are just two small style details around whitespace to fix before merging this one 🙏

@JuanVqz
Copy link
Contributor Author

JuanVqz commented Feb 22, 2024

Thanks a lot @JuanVqz, there are just two small style details around whitespace to fix before merging this one 🙏

Fixed, would you be interested in adding overcommit to ensure everybody runs Rubocop before pushing to the repo?

@JuanVqz JuanVqz requested a review from rosa February 22, 2024 16:31
@rosa
Copy link
Member

rosa commented Feb 23, 2024

Fixed, would you be interested in adding overcommit to ensure everybody runs Rubocop before pushing to the repo?

I think it's ok, we run it here via GitHub actions like this. In fact this one is still failing.

I think you might not have pushed your changes?

Copy link
Member

@rosa rosa left a comment

Choose a reason for hiding this comment

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

Looks like the last changes haven't been pushed 😕

Co-authored-by: Rosa Gutierrez <rosa@hey.com>
@JuanVqz
Copy link
Contributor Author

JuanVqz commented Feb 23, 2024

Looks like the last changes haven't been pushed 😕

I pushed but it never went out off my cable, now it should be good, thanks!

Copy link
Member

@rosa rosa left a comment

Choose a reason for hiding this comment

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

Thank you! Sorry for the delay. This is good to go 🙌

@rosa rosa merged commit d4eb8b0 into rails:main Feb 27, 2024
5 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.

Discard scheduled jobs
2 participants