Skip to content

[GH-127] Improve RHS UI and content - #170

Merged
hanzei merged 36 commits into
mattermost:masterfrom
larkox:GH127
Feb 23, 2020
Merged

hanzei merged 36 commits into
mattermost:masterfrom
larkox:GH127

Conversation

@larkox

@larkox larkox commented Dec 22, 2019 •

Copy link
Copy Markdown
Contributor

Summary

Improve RHS UI and content

Ticket Link

Fixes #127

Screenshots

image
image
image
image

@larkox

larkox commented Dec 22, 2019

Copy link
Copy Markdown
Contributor Author

The functionality is practically complete, but there are a few concerns.

First of all, I would like to know if there are any standard styles you want to use for several parts of the code.

Also, to retrieve status and reviews imply making several more calls, which might become a problem due to the rates from the API. We are talking that retrieving the PRs now implies: 1 call for the list of PRs + 3 calls for each PR.

Finally, there are some details that I am not sure whether they have been done in the most desirable way. Due to how I was able to check the reviews, we get the "Changes requested" message whenever someone asked for changes, even if we have clicked the "Re-request review" button. Is this the expected behaviour?

@hanzei hanzei added the 2: Dev Review Requires review by a core committer label Dec 23, 2019
@mattermod

Copy link
Copy Markdown
Contributor

This issue has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

/cc @jasonblais @hanzei

@marianunez

Copy link
Copy Markdown
Member

/update-branch

@marianunez

Copy link
Copy Markdown
Member

The functionality is practically complete, but there are a few concerns.

Thanks @larkox! Sorry for the delay response as some of us where away for the holidays.

The functionality is practically complete, but there are a few concerns.

First of all, I would like to know if there are any standard styles you want to use for several parts of the code.

Could you provide some screenshots of your changes in the PR description that would help get an initial UX review? We will also take a look at the code and provide any styles suggestions there are necessary.

Also, to retrieve status and reviews imply making several more calls, which might become a problem due to the rates from the API. We are talking that retrieving the PRs now implies: 1 call for the list of PRs + 3 calls for each PR.

Agreed that it seems too many extra calls to do each time we get all PRs. Two possible suggestions:

  • Given that getYourPrs is called each time the plugin data is refreshed to update the numbers in the left hand sidebar, I suggest we decouple the extra information to a separate plugin call and only get that extra information when the RHS UI actually needs it. This way the extra calls will only occur when the UI requests it and not each time the plugin is updated.
  • Regarding the PR status specifically (x or check next to the PR), not sure if it provides enough value at to merit another API call. Thoughts @mickmister @asaadmahmood ?

Finally, there are some details that I am not sure whether they have been done in the most desirable way. Due to how I was able to check the reviews, we get the "Changes requested" message whenever someone asked for changes, even if we have clicked the "Re-request review" button. Is this the expected behaviour?

I believe this is the way Github handles the review state correct?

@marianunez marianunez added the 1: UX Review Requires review by a UX Designer label Jan 7, 2020

@marianunez marianunez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See comment regarding breaking out the extra PR information call

@larkox
larkox requested a review from marianunez January 9, 2020 14:45
@larkox

larkox commented Jan 9, 2020

Copy link
Copy Markdown
Contributor Author

Thanks @marianunez !

I uploaded a new version of this, with pr fetching and extra info fetching decoupled. Whenever you tell me what information is needed and what not, I will remove that part. As a small remainder:

  • Fetching reviewers: 1 more call per PR
  • Fetching status: 2 more calls per PR

I also have been taking a look into it, and using GraphQL (github API v4, right now we are using v3) might allow us to put all this in a single call. If you want, we can continue this PR as it is right now, and at some point consider migrating the api calls to GraphQL and use all the potential they have.

Regarding UX, I added one screenshot on how it looks right now. My point is that if we have already some CSS classes created that will work for this, let me know which ones, so I use them directly. If they are not created, let me know the definition (colors, sizes, theme parameters...) so I can implement them.

Thanks!

@asaadmahmood

Copy link
Copy Markdown
Contributor

@larkox What exactly does the x button does?
Does it clear that item? I don't have much context on this PR.

@larkox

larkox commented Jan 9, 2020

Copy link
Copy Markdown
Contributor Author

Hello @asaadmahmood !

The X should be red, and is the same X as in this screens (taken from github directly):
image

It states the status of the PR. Whether it failed any check, or passed all the checks or it is pending something. It can be also a green tick:
image
or an orange dot (I have no image of that one at the moment).

This image is used in several other places with similar meaning. For example:
image
image

Is it clear? Or do you need more context?

@asaadmahmood

asaadmahmood commented Jan 9, 2020 •

Copy link
Copy Markdown
Contributor

@larkox Got it, can you setup a test server with that a PR that has that x icon on it.
I can make the changes live, and tell you which css to apply.
I don't have Github configured locally so might not be able to set it up right now.

@mickmister

Copy link
Copy Markdown
Contributor

I also have been taking a look into it, and using GraphQL (github API v4, right now we are using v3) might allow us to put all this in a single call.

@larkox That sounds like an excellent improvement! Thank you for pointing out this option.

When we are talking about API requests per PR, are we referring to API to calls to the MM server, or API calls to the GitHub server? If it is the former, we can consolidate some of the API requests into endpoints that return several pieces of data. If it is the latter, GraphQL seems like a good way to get everything we need from GitHub in (ideally) one request.

@mickmister

Copy link
Copy Markdown
Contributor

@larkox Here's a test server you can use:

https://github-plugin-pull-170.test.mattermost.cloud

Username: sysadmin
Password: Sys@dmin123

@larkox

larkox commented Jan 9, 2020

Copy link
Copy Markdown
Contributor Author

@mickmister Yes, it is the second case. 3 different calls to github. I haven't explored enough the GraphQL api yet, but hopefully it can make things easier.

switch (item.status) {
case 'success':
status = (
<svg

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@larkox Can we move these svg's to a separate file with named exports?

@marianunez Does this make sense or do you think they should each have their own file? I think it clutters this file having them laid out like they are currently.

@marianunez marianunez Jan 9, 2020 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1 on their own file. We could follow the model of webapp for the icons here too


let reviewers = '';
if (item.reviewers && item.reviewers > 0) {
reviewers = (<span>{item.reviewers} pending reviews.</span>);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I believe these are the amount of reviewers requested regardless if pending or not. Not sure if there is any value on providing the total reviewers.

Thoughts @mickmister ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we have a 3 out of 4 reviews complete display or something of the sort?

@larkox larkox Jan 9, 2020 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is a mistake on my part. The reviewers value comes from "requested_reviewers". As far as I have seen, a requested reviewer is marked as that since the it is requested for review until it makes its first review. After that, even if you request a rereview, it will not appear on "requested_reviewers" anymore.

That being said... reviewers is indeed the pending reviews. Also, because of that, my first question about how to deal with the reviews. I can "do the maths" and leave it as 3 out of 4 reviews approved, or I could go even overkill with something as:

- 1 approved review.
- 2 changes requested reviews.
- 1 pending review.
- 1 out of 4 reviews complete.

What I cannot do (as far as I have seen at least) is distinguish between a Changes Requested review and a rerequested review.

All that being said, what do you expect to be the most useful way to give this information?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@larkox I think saying 1 out of 4 reviews complete and a small indicator to express that at least one reviewer currently has requested changes (just like the red icon that shows up in GitHub) would be sufficient. I think this solution is both compact and informative.

@larkox

larkox commented Jan 9, 2020

Copy link
Copy Markdown
Contributor Author

@asaadmahmood The test server that @mickmister provided already has one version of my changes. You have several cases. If you want to try any other case, please let me know. Here is the info for the server again:

https://github-plugin-pull-170.test.mattermost.cloud

Username: sysadmin
Password: Sys@dmin123

@mickmister In order to let Asaad try this, I created a mockClient for the webapp part. I am not sure whether this will be useful on the future, but I can clean it up and have upload it also if you find it useful.

@larkox
larkox requested a review from lieut-data February 11, 2020 11:37

@lieut-data lieut-data left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Very concise, thanks @larkox! Two questions below.

Comment thread server/api.go Outdated
@@ -556,11 +556,13 @@ func (p *Plugin) getPrsDetails(w http.ResponseWriter, r *http.Request) {
func fetchPRDetails(ctx context.Context, client *github.Client, prURL string, prNumber int) (*PRDetails, error) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It looks like we never return a non-nil error -- should we omit that return value altogether for now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You are completely right. We suppose the result always comes the best it can. There is nothing to handle if there is any error either way (the call was just logging the error).

Comment thread server/api.go
status := ""
requestedReviewers := []*string{}
var reviewsList []*github.PullRequestReview = nil
var reviewsList []*github.PullRequestReview = []*github.PullRequestReview{}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would I be correct in assuming you're initializing this so that the resulting JSON serialization returns an empty array [] vs the null it would otherwise encode when there are no reviews? If that's the case, I'd recommend the more idiomatic:

        // Initialize to a non-nil slice to simplify JSON handling semantics.
	reviewsList := []*github.PullRequestReview{}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It was more a hunch than anything else. I did not like that sometimes reviewsList was a nil, sometimes was a list. I preferred it to be something more stable.

@larkox
larkox requested a review from lieut-data February 11, 2020 14:26

@lieut-data lieut-data left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, @larkox!!

@mickmister

Copy link
Copy Markdown
Contributor

/update-branch

@mickmister mickmister removed the 2: Dev Review Requires review by a core committer label Feb 12, 2020
@DHaussermann

Copy link
Copy Markdown

Hi @larkox well done! This UX improvement looks great!

I found 1 very small issue. On the PR Needing Review Section, when the last record at bottom has changes requested from the reviewer(s), the help text for the "+/-" still opens downward so the text "Changes Requested" is not visible.
Changes

Is it possible to fix it such the it opens upward when there is not enough vertical space for it below?

@DHaussermann

Copy link
Copy Markdown

Hi @larkox as mentioned above, I see only one minor issue (possibly CSS related) is this is something easy enough to resolve?

@larkox

larkox commented Feb 19, 2020

Copy link
Copy Markdown
Contributor Author

I have been checking, and there seems that there will not be an "easy" solution.
I tried using the "auto" placement, but it seems it is not supported. Any other solution I can think about requires calculating the position of the objects in relation to the window, which may be troublesome specially because it would have to react to the scroll.

The only easy solution will be always showing it on top. There is always space on top, but may be annoying since will cover part of the text of the issue you are looking at.

@DHaussermann

Copy link
Copy Markdown

@asaadmahmood Is this issue something you be able to provide some guidance on?

Alternatively, this PR has been waiting a while and this minor CSS issue is an edge case. @aaronrothschild would it makes sense to merge this and create a follow-up issue for the remain CSS problem?

@asaadmahmood

Copy link
Copy Markdown
Contributor

@DHaussermann I may have a to look at it. We can take it in, so I can see it live in action.

@marianunez

Copy link
Copy Markdown
Member

Alternatively, this PR has been waiting a while and this minor CSS issue is an edge case. @aaronrothschild would it makes sense to merge this and create a follow-up issue for the remain CSS problem?

I agree that we should open a JIRA ticket to fix this border case and merge this PR. It's a great improvement and would love to see it in community soon. 🎉

@marianunez

Copy link
Copy Markdown
Member

/update-branch

@DHaussermann DHaussermann left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Tested and passed
Reviewed new data for accuracy
Reviewed detail in this task and related ticket to ensure everything was implemneted
The following has been successfully added:

  • PR number
  • Checks Passes (Review required section only)
  • Milestone version - if applicable
  • Time the PR has been open - in the case of PR lists
  • Reviews complete (Review required section only)
    LGTM! Thanks @larkox for the effort on this!

@aaronrothschild note that a follow up issue was created for the minor CSS issue found.
#194

@DHaussermann DHaussermann added 4: Reviews Complete All reviewers have approved the pull request QA Review Done PR has been approved by QA and removed 3: QA Review Requires review by a QA tester labels Feb 22, 2020
@hanzei hanzei added this to the v0.13.0 milestone Feb 23, 2020
@hanzei
hanzei merged commit 55d0f11 into mattermost:master Feb 23, 2020
@hanzei hanzei modified the milestones: v0.13.0, v0.14.0 Feb 23, 2020
@hanzei hanzei mentioned this pull request Feb 23, 2020
@hanzei

hanzei commented Feb 23, 2020

Copy link
Copy Markdown
Contributor

Thanks @larkox. This is such an awesome improvement. I can't wait to use it myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4: Reviews Complete All reviewers have approved the pull request QA Review Done PR has been approved by QA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve RHS UI and content

9 participants