-
Notifications
You must be signed in to change notification settings - Fork 355
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
PRfd - Merge PR and change PR status #8209
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.
Some extra UI stuff for the List page,
Got into this PR, in order not to create another one in the PRs chain.
@itaigilo Per discussion on the PRD - we do not support re-open ATM. This should be removed |
Yeah I saw that - I don't mind removing it, but it's small piece of code that's already implemented. |
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.
Thanks!!
Please see comments
let [error, setError] = useState(null); | ||
|
||
const mergePullRequest = async () => { | ||
// TODO: this is not ideal - this should be handled in an atomic way |
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.
Let's open an issue for this and remove the comment as this is probably not something we're going to handle in the near future
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.
await pullsAPI.update(repo.id, pull.id, {status: PullStatus.merged}); | ||
window.location.reload(); // TODO: replace with a more elegant solution | ||
} catch (error) { | ||
setError(`Failed to update pull-request status: ${error.message}`); |
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 should do something here - this is an inconsistent state which can lead to strange behavior
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.
Yeah you're right.
I think we should:
- Log this error somehow and monitor it, so we can see how often this occurs.
- Have two extra retries.
Does this make sense, or do you have other suggestions?
setLoading(true); | ||
try { | ||
await pullsAPI.update(repo.id, pull.id, {status}); | ||
window.location.reload(); // TODO: replace with a more elegant solution |
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.
Same as previous comment (also please use our TODO convention)
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.
Why this is an inconsistent state?
} | ||
</Button> | ||
} | ||
{isPullOpen() && |
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.
This condition is not enough - Merge should be also disabled if no changes (due to modifications of the branches, or if any of them no longer exists)
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.
True -
Will be handled in a separate PR (or deferred).
onClick={changePullStatus(isPullOpen() ? PullStatus.closed : PullStatus.open)}> | ||
{loading ? | ||
<span className="spinner-border spinner-border-sm text-light" role="status"/> : | ||
<>{isPullOpen() ? "Close" : "Re-open"} pull request</> |
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 support re-open
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.
And also we shouldn't have a re-open button for Merged PRs
Yes - it complicates the state machine of the PRs. We want to reduce the scope as much as possible. |
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.
Approved to unblock but please make sure to fix all comments before merging!
} catch (error) { | ||
setError(`Failed to update pull-request status: ${error.message}`); | ||
setLoading(false); | ||
for (let i = 0; i < RETRIES_COUNT; i++) { |
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 are already importing https://www.npmjs.com/package/exponential-backoff so lets use it
This reverts commit a5566fa.
# Conflicts: # webui/src/lib/api/index.js # webui/src/pages/repositories/repository/pulls/pullDetails.jsx
All handled, |
Closes #8176.
Change Description
Wire the "Merge PR" button to the API.
Wire the "Close PR" button to the API, and add a "Re-open PR" button.
Also, show PR details in Markdown.