Skip to content

Add ability to comment on a build - #7147

Merged
aoldershaw merged 15 commits into
concourse:masterfrom
multimac:build-comment
Jun 30, 2021
Merged

aoldershaw merged 15 commits into
concourse:masterfrom
multimac:build-comment

Conversation

@multimac

@multimac multimac commented Jun 9, 2021 •

Copy link
Copy Markdown
Contributor

Changes proposed by this PR

closes #476

This PR adds an editable comment field to builds of a job. A new "info" button is added to the header bar for a build and upon clicking it a text box will be show allowing for the build comment to be edited and saved.

Along with the UI work, there is a new API endpoint, /api/v1/builds/:build_id/comment, for updating the comment. This was written using the pin-comment endpoint for a resource as a guide.

I wasn't sure if there were any guidelines around sourcing icons, but found these two icons which are both licensed under Apache 2.0, the same as Concourse.

https://iconify.design/icon-sets/uil/info-circle.html
https://iconify.design/icon-sets/ic/round-save.html

Screenshot 2021-06-09 215141

I have no eye for design, so feedback is more than welcome. Some design decisions:

  • Builds with a comment get a small triangle in the upper-right corner. Not sure how I feel about this, on one hand it's nice to know which builds have been commented on but also it could clutter the history bar.
  • Edit / Save / Cancel buttons are placed in the header bar, separated from the new build / re-run build / abort build buttons by a small spacer element
  • Cancel button for the build comment uses the same icon as the abort button. May be confusing, though it doesn't share the red background of the abort button.

Still to do...

  • Initial work
  • Fix weird unfocus bug
  • Move comments into separate build_comments table
  • Finalize design
  • Add tests

Release Note

  • You can now leave comments on builds. For instance, this can be used to give context to your coworkers about why a particular build failed:
    Screen Shot 2021-06-30 at 5 40 45 PM

  • If a build has a comment, it is displayed with a small marker to help you quickly find builds of interest. Hovering over the build displays a portion of the comment:
    Screen Shot 2021-06-30 at 5 41 52 PM

@multimac
multimac requested a review from a team June 9, 2021 12:15

@aoldershaw aoldershaw 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.

Great first pass at what I think will be a really useful feature! Just glanced at the code briefly, but left a comment on the database schema and have some thoughts on the UI design:

I like the idea of some sort of indication of which builds have a comment in the build list (currently a small triangle as you currently have) 👍 . Maybe we could even make it so that hovering over the build in the list displays the comment as a tooltip for even faster access? Not sure if that's necessarily a good idea, but just spit-balling.

I think it'd be best if the design for build comments was more similar to the design (but not necessarily the exact styles) for pinned resource comments. Here's a short video of what that looks like in case you aren't familiar:

Screen.Recording.2021-06-10.at.1.47.14.PM.mov

We could apply a similar idea to what you have now - having a "comment" button in the header. For icons, we usually pull from https://materialdesignicons.com. Maybe the ones called comment (or comment-*) would be most intuitive.

The way I'm picturing this button working is similar to how it works currently, with some small differences. It'd act more like a toggle button to view/hide comments, and could behave something like the following:

  • If the build does not currently have a comment...
    • On page load, the button appears as dim
    • On hover, the button appears as bright with the tooltip "add a comment"
    • On click, the button becomes bright, the comment section becomes visible, and you're directly editing the comment
    • For now, maybe the comment is pre-populated with the timestamp and author as text (though we may want to store this in a more structured way in the future)
  • If the build already has a comment...
    • On page load, the button appears as bright. The comment section is visible
    • On hover, the button appears as dim with the tooltip "hide comment"
    • On click, the button becomes dim (perhaps with some additional indication that there is a comment, like a notification badge or something), and the comment section is hidden

The comment block could function in a similar way to the resource pin. When you aren't editing the comment, but the comment is visible, we display a pencil icon in the top-right corner. When we click that button, we are able to edit the text, and the pencil icon is replaced with a "save" button.

Curious to hear what you think about this! Feel free to push back on any of the ideas posed here that you don't agree with

@aoldershaw aoldershaw 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.

Have a few suggestions, but looking great so far! Really like the new CommentBar module.

Thoughts on adding tooltips to the build tabs as well for a preview of the comment? Could be useful for scanning the history, e.g. so you can skip over short comments like "flake" If you're looking for something in particular. Doesn't need to be anything fancy, and we can just cut the comment off:

Screen Shot 2021-06-14 at 12 03 21 PM

Also, I noticed that when you're not authorized to see the build plan, you're still able to see the comment. I wonder if that's desirable, or if we should hide the comment from the API response if they aren't authorized.

Screen Shot 2021-06-14 at 12 07 23 PM

Comment thread web/elm/src/Views/CommentBar.elm Resolved
Comment thread web/elm/src/Build/Header/Header.elm Resolved
Comment thread web/elm/src/Build/Header/Header.elm Resolved
Comment thread web/elm/src/Build/Header/Header.elm Resolved
Comment thread web/elm/src/Build/Styles.elm Resolved
Comment thread web/elm/src/Views/CommentBar.elm Resolved
Comment thread web/elm/src/Views/Styles.elm Resolved
Comment thread web/elm/src/Views/CommentBar.elm Resolved
Comment thread web/elm/src/Views/Styles.elm Resolved
@multimac
multimac force-pushed the build-comment branch 2 times, most recently from 84ba661 to 3c6bba4 Compare June 15, 2021 12:47
@multimac

Copy link
Copy Markdown
Contributor Author

Thoughts on adding tooltips to the build tabs as well for a preview of the comment? Could be useful for scanning the history, e.g. so you can skip over short comments like "flake" If you're looking for something in particular. Doesn't need to be anything fancy, and we can just cut the comment off:

👍 I've added tooltips which show the first 50 characters of the first line, and append … if either the first line is longer than 50 characters, or there are multiple lines.

Also, I noticed that when you're not authorized to see the build plan, you're still able to see the comment. I wonder if that's desirable, or if we should hide the comment from the API response if they aren't authorized.

I've updated header to not show the build comment when the user isn't authorized, but it will still return the comment in the API response. Is this okay?

@multimac

Copy link
Copy Markdown
Contributor Author

Something for a future PR, but it would be neat if we could show the first line / 50-characters of the comment for the latest build of a job on the pipeline screen. I had a quick poke around the code but I'm not familiar with SVGs or D3 so I'll need to spend some time to understand it first.

@aoldershaw aoldershaw 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.

Looking great! Think we're pretty close. Just a few things, particularly around not being authorized to view build comments. I feel like we should handle this at the API level, since if build comments are public, that may limit what you can write

Comment thread atc/build.go Resolved
Comment thread web/elm/src/Assets.elm Resolved
Comment thread web/elm/src/Build/Header/Header.elm Resolved
Comment thread web/elm/src/Views/CommentBar.elm Resolved
Comment thread web/elm/src/Views/CommentBar.elm Resolved
Comment thread atc/api/present/build.go Resolved
Comment thread web/elm/src/Build/Header/Header.elm Resolved
@multimac

multimac commented Jun 21, 2021 •

Copy link
Copy Markdown
Contributor Author

Added one last little bit of functionality in the latest commit, d662199, showing a small triangle in the upper-right corner of a job when there is a comment on the latest build of that job. Unsure if I think it's a good idea or not, what do you think?

image

@aoldershaw aoldershaw 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.

Nearly there! I like what you did with present.Build. Just have one more concern about fetching comments being an N+1 query. Then, think it's just tests and fixing up merge conflicts

Comment thread atc/db/build.go Resolved
Comment thread web/public/graph.mjs Resolved
@multimac
multimac force-pushed the build-comment branch 2 times, most recently from 2a3556f to b2aaa23 Compare June 22, 2021 11:52
multimac and others added 13 commits June 29, 2021 22:17
Sometimes it is nice to leave a comment for future you, explaining why something worked or, more likely, didn't. This change allows you to do just that, by providing an editable comment field on builds for a job.

concourse#476

Signed-off-by: David Symons <[email protected]>
Updates the design of the build comment to be more functionally similar to the "pin resource" comment. This commit includes a generic "Comment Bar" view which replicates the existing pin resource comment functionality and can, hopefully, in the future replace it.

Signed-off-by: David Symons <[email protected]>
Signed-off-by: David Symons <[email protected]>

Co-authored-by: Aidan Oldershaw <[email protected]>
@multimac
multimac force-pushed the build-comment branch 2 times, most recently from b3e292d to 8d63d78 Compare June 29, 2021 12:42

@aoldershaw aoldershaw 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.

Almost there! Appreciate your patience and your hard work! Just a few comments and some tests for the API would be nice

Comment thread atc/db/build.go Resolved
}


button_tooltip : String -> Tooltip.Tooltip

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.

Not a huge deal, but snake_case feels a bit out of place in Elm (or at least in Concourse's Elm codebase)

Comment thread web/elm/src/Views/Styles.elm Resolved
Comment thread web/elm/tests/Build/HeaderTests.elm Resolved
"github.com/concourse/concourse/atc/db"
)

func (s *Server) SetBuildComment(build db.Build) http.Handler {

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 add a few small tests for this?

Comment thread atc/api/present/build.go Resolved

@aoldershaw aoldershaw 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.

Thanks for all your hard work on another awesome feature!

@aoldershaw
aoldershaw merged commit 6dfa575 into concourse:master Jun 30, 2021
@multimac

multimac commented Jul 1, 2021

Copy link
Copy Markdown
Contributor Author

No worries, thanks for the help getting it ready, tested, and merged in 🥳

Thinking I might keep trawling through the old issues to see what to work on next.

@multimac
multimac deleted the build-comment branch July 1, 2021 12:18
@taylorsilva taylorsilva added the release/undocumented This didn't warrant being documented or put in release notes. label Jul 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement release/undocumented This didn't warrant being documented or put in release notes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: I would like the ability to leave a comment on a (failed) build

3 participants