Skip to content

Show tooltip with additional info about the build status - #3588

Merged
joshaber merged 31 commits into
masterfrom
show-pr-status
Jan 12, 2018
Merged

joshaber merged 31 commits into
masterfrom
show-pr-status

Conversation

@iAmWillShepherd

@iAmWillShepherd iAmWillShepherd commented Dec 12, 2017 •

Copy link
Copy Markdown
Contributor

Fixes #3134

Before

2018-01-09_01-27-05 701

After

GitHub Desktop
2018-01-09_11-59-36 981

VS Code
2018-01-09_12-00-30 325

@iAmWillShepherd

Copy link
Copy Markdown
Contributor Author

I think that it's redundant to show the text Commit status: [success/fail] and the icon that indicates the same thing. I think we should only show the status of each individual integrate and let the icon communicate the success or failure of a PR build.

cc, @desktop/core for opinions.

@joshaber

joshaber commented Jan 9, 2018

Copy link
Copy Markdown
Contributor

I'm not an accessibility expert by any means, but I'd guess that relying on the icon would be less than great for screen readers.

@shiftkey

shiftkey commented Jan 9, 2018

Copy link
Copy Markdown
Member

I'm not an accessibility expert by any means, but I'd guess that relying on the icon would be less than great for screen readers.

We should use aria-* labels in cases like this. Here's an example from elsewhere:

public render() {
const title = this.getTitle()
const ariaLabel = this.props.user
? `Avatar for ${this.props.user.name || this.props.user.email}`
: `Avatar for unknown user`
return (
<span title={title} className="avatar-container">
<img
className="avatar"
title={title}
src={this.state.dataUrl}
alt={title}
aria-label={ariaLabel}
/>
</span>
)
}

@niik

niik commented Jan 9, 2018

Copy link
Copy Markdown
Member

I think that it's redundant to show the text Commit status: [success/fail] and the icon that indicates the same thing. I think we should only show the status of each individual integrate and let the icon communicate the success or failure of a PR build.

I think we should follow .com conventions here and not talk about "Commit status" as that's not a term that (to my knowledge) is used on .com which talks about "checks".

So for a single check only we should use the status text prefixed with success, failure, pending etc.

screen shot 2017-11-21 at 15 13 26

For more than 1 check we should show x / y checks OK

screen shot 2017-11-21 at 15 11 56

That way it's also not redundant information when there's single check since it'll include the description from the provider.

I'm definitely not opposed to showing more information here but I thing a standard tooltip is the wrong bearer for it. If we want more we should show a customized tooltip with icons and everything for each provider.

We should use aria-* labels in cases like this. Here's an example from elsewhere

So in the example you posted we're using both because the title itself adds value when hovering if you're not using the app with a screen reader and have the context that you're looking at an image but it's even more verbose when you don't have any visual reference. I think a title is fine here since screen readers will pick that up in lieu of an aria label.

if (statusCount === 0) {
return prStatus.state.toUpperCase()
} else {
const successCount = prStatus.statuses.filter(x => x.state === 'success')

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@iAmWillShepherd iAmWillShepherd added the ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Jan 9, 2018
@joshaber joshaber self-assigned this Jan 10, 2018

@joshaber joshaber left a comment

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.

🎃

totalCount: 1,
state: 'pending',
pullRequestNumber: 0,
statuses: [] as ReadonlyArray<CombinedRefStatus>,

This comment was marked as spam.

Comment thread app/src/lib/api.ts Outdated
}

interface IAPIPullRequestRef {
export interface IAPIPullRequestRef {

This comment was marked as spam.

Comment thread app/src/models/pull-request.ts Outdated
}

/** The commit status and metadata for a given ref */
export class CombinedRefStatus {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

Comment thread app/src/lib/api.ts Outdated
* status for a given ref
*/
export interface IAPIRefStatusItem {
readonly created_at: string

This comment was marked as spam.

@iAmWillShepherd

Copy link
Copy Markdown
Contributor Author

🔢

Comment thread app/src/models/pull-request.ts Outdated
}

/** The commit status and metadata for a given ref */
export class CombinedRefStatus {

This comment was marked as spam.

@iAmWillShepherd

iAmWillShepherd commented Jan 10, 2018 •

Copy link
Copy Markdown
Contributor Author

Let's push the question further: is there a reason we need this class? It seems like we're just copying values to/from it.

@joshaber , I suppose that question can be asked about each class in pull-requests.ts since none of them provide any implementation for behaviour or have derived classes.

But, to answer your question, I had no real reason to use a class here. I just followed the established pattern: using a class as an interface.

Removed some properties that may be useful in the future, but for now are not needed, so blasted them.

@joshaber joshaber left a comment

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.

Just a question about naming left 👍

Comment thread app/src/models/pull-request.ts Outdated
}

/** The commit status and metadata for a given ref */
export interface ICombinedRefStatus {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@iAmWillShepherd

Copy link
Copy Markdown
Contributor Author

🔢

@joshaber

Copy link
Copy Markdown
Contributor

💃

@joshaber
joshaber merged commit d5c4b4a into master Jan 12, 2018
@joshaber
joshaber deleted the show-pr-status branch January 12, 2018 21:18
niik added a commit that referenced this pull request Jan 27, 2018
As I spun up desktop@master on my Windows machine today I got this error

```
Uncaught (in promise) TypeError: Cannot read property 'map' of undefined
    at PullRequestStore.getPRStatusById (pull-request-store.ts:237)
    at <anonymous>
```

It seems the `statuses` property was added in #3588 and typed as `ReadonlyArray<IAPIRefStatusItem>` but since no corresponding database upgrade function was added to ensure that the property exists on prior database objects we can't rely on it being there.

I could add an upgrade function but seeing as we're pretty close to a release I would rather just mark the property accurately and make sure we don't have any other places which rely on it always being present.

We can revisit and clean this up in a later version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants