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

feat: Pizza show #24

Merged
merged 8 commits into from
Sep 27, 2023
Merged

feat: Pizza show #24

merged 8 commits into from
Sep 27, 2023

Conversation

k1nho
Copy link
Contributor

@k1nho k1nho commented Aug 16, 2023

Description

This PR implements the pizza show command. This is the first step in developing a TUI that can be used for a centralized monitor to display metrics for an specific repository.

Current metrics:

  • Repository model
    • name, issues, forks, stars, size
    • New contributors table
    • Churned contributors table
  • Contributor model (interactive through repository model tables)
    • pr velocity, pr count, issues opened, is maintainer
    • The last 5 PRs made

wip

pizzashow2.mov

What type of PR is this? (check all applicable)

  • 🍕 Feature
  • 🐛 Bug Fix
  • 📝 Documentation Update
  • 🎨 Style
  • 🧑‍💻 Code Refactor
  • 🔥 Performance Improvements
  • ✅ Test
  • 🤖 Build
  • 🔁 CI
  • 📦 Chore (Release)
  • ⏩ Revert

Related Tickets & Documents

#9

Mobile & Desktop Screenshots/Recordings

Added tests?

  • 👍 yes
  • 🙅 no, because they aren't needed
  • 🙋 no, because I need help

Added to documentation?

  • 📜 README.md
  • 📓 docs.opensauced.pizza
  • 🍕 dev.to/opensauced
  • 📕 storybook
  • 🙅 no documentation needed

[optional] Are there any post-deployment tasks we need to perform?

[optional] What gif best describes this PR or how it makes you feel?

@jpmcb
Copy link
Member

jpmcb commented Aug 16, 2023

👏🏼 👏🏼 👏🏼 👏🏼 👏🏼 👏🏼 👏🏼

cmd/show/show.go Outdated Show resolved Hide resolved
cmd/show/show.go Outdated Show resolved Hide resolved
Copy link
Member

@jpmcb jpmcb left a comment

Choose a reason for hiding this comment

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

FYI: this will be blocked on getting this done #28

which should drastically reduce the boilerplate in the CLI here we'd have to maintain 👍🏼

@k1nho
Copy link
Contributor Author

k1nho commented Aug 18, 2023

That would be awesome! if it wasn't for GoTags I would still be typing the structs 😂. Btw, any preference on the color palette? I picked #FF4500 which seems to be what is used in the UI, but Lipgloss has adaptive colors which can be leveraged depending on the terminal background color. Also, since I grab the repo info I can also render the size, issues and so on, anything from there that may be useful to display? Lastly, is there an endpoint to get the commits from the repo_id ? I see there is one from pizza to get it from the bake repo id.

@jpmcb
Copy link
Member

jpmcb commented Aug 18, 2023

Btw, any preference on the color palette? I picked #FF4500 which seems to be what is used in the UI, but Lipgloss has adaptive colors which can be leveraged depending on the terminal background color.

Yes, we should 100% use adaptive colors: a hard coded color value will be really rough for people on random weird color schemes.

Also, since I grab the repo info I can also render the size, issues and so on, anything from there that may be useful to display?

Good question: it's pretty open ended right now, so if something makes sense to add, go for it!

Lastly, is there an endpoint to get the commits from the repo_id ? I see there is one from pizza to get it from the bake repo id.

Yeah, good question, I was just chatting with @brandonroberts about this: there isn't currently a way to get the commits from the API based on a repo_id. Right now, baked_repos and repos are sort of siloed and we don't have a great way in the bakend to connect them.

The first thing to do here is get our ETL service to connect repo ids in the baked_repos table that are null. And if it can't find them, then go and fetch that data from github.

So, for now, commits are abit blocked, but it's ok to leave that out for now.

@jpmcb
Copy link
Member

jpmcb commented Aug 22, 2023

Can you change this PR's target branch to be beta? 👀 We recently changed the default branch to beta in support of using the releaser action

For further reading:

@k1nho k1nho changed the base branch from main to beta August 23, 2023 01:17
@jpmcb
Copy link
Member

jpmcb commented Aug 28, 2023

@k1nho - let me know when you'd like me to look at this 😄 happy to help if you need anything along the way

@k1nho
Copy link
Contributor Author

k1nho commented Aug 29, 2023

I think is looking good for the 1st iteration of pizza show, updated the demo at the top to reflect what I have now. Still need to do some clean up some of the error handling between cobra<-TUI and TUI<-models when doing async operations. Also, for now I just have the static data from first fetch on dashboard model, so 'reatime' is not there yet, but the contributor model is dynamic so that one is 'realtime'. @jpmcb would appreciate a review of what I have so far.

Copy link
Member

@jpmcb jpmcb left a comment

Choose a reason for hiding this comment

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

Any way to make this abit more dynamic? I don't know "tea" very well but it'd be awesome if this was abit more responsive to the height/width of the given terminal.

Screenshot 2023-08-30 at 7 55 07 PM


Overall looks like you're on the right track and you already have alot!!! Like you said, just some rough edges to iron out.

If you're looking for a pattern to implement some more "real" live views of the data, time.Timer is a really good pattern I've seen for this kind of thing: https://blogtitle.github.io/go-advanced-concurrency-patterns-part-2-timers/

go.mod Outdated Show resolved Hide resolved
cmd/show/tui.go Outdated Show resolved Hide resolved
cmd/show/show.go Outdated Show resolved Hide resolved
cmd/show/tui.go Outdated Show resolved Hide resolved
cmd/show/dashboard.go Outdated Show resolved Hide resolved
cmd/show/dashboard.go Outdated Show resolved Hide resolved
cmd/show/contributors.go Outdated Show resolved Hide resolved
cmd/show/dashboard.go Show resolved Hide resolved
@k1nho k1nho force-pushed the feature/pizza-show branch 2 times, most recently from 5357875 to 3eaf9fc Compare September 3, 2023 21:22
Copy link
Member

@jpmcb jpmcb left a comment

Choose a reason for hiding this comment

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

Wow, this is great! 👏🏼 nice work on the dynamic side by side view

One thing I noticed is it does something weird when I resize my tmux window: the contributors disappear from the rendering. But then will re-appear if I keep resizing the window.

Screenshot 2023-09-05 at 3 24 53 PM


One sharp UI/UX edge I noticed is there's not much feedback as far as waiting for the next thing to happen. When I get into a contributor's view and hit , it feels like it freezes since there's no spinning wheel or something (and I'm assuming it's blocking on the API call to return).

One thing to possibly do is explore caching some of the API results so you don't have to always fetch them. That could be a future enhancement too.

cmd/show/dashboard.go Outdated Show resolved Hide resolved
cmd/show/contributors.go Outdated Show resolved Hide resolved
testing go-client

Adding general repository info to TUI (issues, forks, size, stars)

centralized state manager structure with nested models, and start of contributors model

Added contributor model stats and interactivity through table selection in dashboard model

tidy

improving error handling flow, and adding basic dashboard responsiveness for horizontal layouts

tidy
@k1nho k1nho force-pushed the feature/pizza-show branch from 3eaf9fc to 4cb0293 Compare September 9, 2023 16:54
@k1nho
Copy link
Contributor Author

k1nho commented Sep 9, 2023

One thing I noticed is it does something weird when I resize my tmux window: the contributors disappear from the rendering. But then will re-appear if I keep resizing the window.

Nice catch 🧤! just found out why this happened. Basically the window resizing message tea.WindowSizeMsg gets triggered on every window resize which is useful for responsiveness. However, if acted upon on Update rather than View by setting a particular width to the tables on that loop it creates the glitch effect. This should now be fixed on the latest commit.

One sharp UI/UX edge I noticed is there's not much feedback as far as waiting for the next thing to happen. When I get into a contributor's view and hit , it feels like it freezes since there's no spinning wheel or something (and I'm assuming it's blocking on the API call to return).

Investigating this, need to review some elm architecture stuff with commands make sure is not the message flow. If anything, could probably throw a spinner on this one, but the cache would certainly be useful.

@k1nho k1nho marked this pull request as ready for review September 9, 2023 18:08
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

PR Compliance Checks

Thank you for your Pull Request! We have run several checks on this pull request in order to make sure it's suitable for merging into this project. The results are listed in the following section.

Issue Reference

In order to be considered for merging, the pull request description must refer to a specific issue number. This is described in our Contributing Guide.
This check is looking for a phrase similar to: "Fixes #XYZ" or "Resolves #XYZ" where XYZ is the issue number that this PR is meant to address.

@jpmcb jpmcb self-requested a review September 11, 2023 14:43
@jpmcb
Copy link
Member

jpmcb commented Sep 11, 2023

👀

@bdougie
Copy link
Member

bdougie commented Sep 21, 2023

When testing this, noticing @dev-phantom's PRs are cut off and I am not sure if scrolling is built in. Repo is open-sauced/app

Screen Shot 2023-09-21 at 10 02 32 AM

@k1nho
Copy link
Contributor Author

k1nho commented Sep 22, 2023

Added responsiveness for contributor view in this last commit. This should now display horizontally if it does not fit in the vertical space. Also, introduced the list Model from bubbles instead of just the strings, I can see this format being more useful in the future. Now, PR can be directly accessed with O with the browser dependency we are using for auth cmd as well.

prlist.mov

Copy link
Member

@jpmcb jpmcb left a comment

Choose a reason for hiding this comment

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

Wow awesome work @k1nho - huge effort! 👏🏼 a few small nits if you want to fix otherwise we can get this in a roll forward fixes for those nits

cmd/show/constants.go Show resolved Hide resolved
pkg/utils/github.go Show resolved Hide resolved
pkg/utils/github.go Outdated Show resolved Hide resolved
pkg/utils/github.go Outdated Show resolved Hide resolved
pkg/api/constants.go Outdated Show resolved Hide resolved
@bdougie
Copy link
Member

bdougie commented Sep 27, 2023

Wow awesome work @k1nho - huge effort! 👏🏼 a few small nits if you want to fix otherwise we can get this in a roll forward fixes for those nits

Agreed. This was a huge lift and getting this on beta would unblock a lot of future contributions and polish.

I am also featuring this briefly in my Redwoodjs conf lightning talk. It would be cool to get folks to use it after, but no rush.

Copy link
Member

@bdougie bdougie left a comment

Choose a reason for hiding this comment

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

🚀

@jpmcb
Copy link
Member

jpmcb commented Sep 27, 2023

Closes #9

@jpmcb jpmcb merged commit 72f21ce into open-sauced:beta Sep 27, 2023
6 checks passed
github-actions bot pushed a commit that referenced this pull request Sep 27, 2023
## [1.0.0-beta.5](v1.0.0-beta.4...v1.0.0-beta.5) (2023-09-27)

### 🍕 Features

* Pizza show ([#24](#24)) ([72f21ce](72f21ce))
open-sauced bot pushed a commit that referenced this pull request Oct 11, 2023
## 1.0.0 (2023-10-11)

### 🤖 Build System

* sematic bin release, npm ([7b4607e](7b4607e))

### 🔁 Continuous Integration

* Update @open-sauced/[email protected] and compliance.yaml ([#33](#33)) ([146b6b7](146b6b7))

### 🐛 Bug Fixes

* Uses correct generated token when checking out cli repo in release ([#44](#44)) ([1e0c9f1](1e0c9f1))

### 🍕 Features

* Add install instructions and script for pizza CLI ([#26](#26)) ([421a429](421a429))
* Add posthog telemetry integration ([#37](#37)) ([9829f49](9829f49))
* cli auth ([#21](#21)) ([34728fb](34728fb))
* GitHub action to build and upload Go artifacts after release created ([#22](#22)) ([ad187a9](ad187a9))
* Http Client for accessing OpenSauced API client ([#23](#23)) ([ec2b357](ec2b357))
* Leverage the GITHUB_APP_TOKEN for releases ([#32](#32)) ([e0a25e0](e0a25e0))
* npm i -g pizza ([73291d1](73291d1))
* Pizza show ([#24](#24)) ([72f21ce](72f21ce))
* provide repository contributors insights ([#30](#30)) ([d16091f](d16091f))
* provide repository insights ([#38](#38)) ([dc148d6](dc148d6))
* repo-query support ([199cfd7](199cfd7))
* update bin name release.yaml ([6b21cb8](6b21cb8))
* Version command for CLI based on release builds ([#36](#36)) ([9f3eedc](9f3eedc))
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.

4 participants