Skip to content

refactor: Load users from the API - #1218

Merged
BrunoQuaresma merged 2 commits into
mainfrom
bq/1216/load-users-from-the-api
Apr 29, 2022
Merged

BrunoQuaresma merged 2 commits into
mainfrom
bq/1216/load-users-from-the-api

Conversation

@BrunoQuaresma

Copy link
Copy Markdown
Contributor

Closes #1216

@BrunoQuaresma BrunoQuaresma self-assigned this Apr 29, 2022
@BrunoQuaresma
BrunoQuaresma requested review from a team and presleyp as code owners April 29, 2022 14:16
@codecov

codecov Bot commented Apr 29, 2022 •

Copy link
Copy Markdown

Codecov Report

Merging #1218 (b6db33a) into main (ba4c3ce) will increase coverage by 0.21%.
The diff coverage is 81.81%.

@@            Coverage Diff             @@
##             main    #1218      +/-   ##
==========================================
+ Coverage   65.45%   65.67%   +0.21%     
==========================================
  Files         268      269       +1     
  Lines       17029    17338     +309     
  Branches      162      164       +2     
==========================================
+ Hits        11147    11386     +239     
- Misses       4710     4764      +54     
- Partials     1172     1188      +16     
Flag Coverage Δ
unittest-go-macos-latest 52.82% <ø> (-0.06%) ⬇️
unittest-go-postgres- 64.75% <ø> (+0.15%) ⬆️
unittest-go-ubuntu-latest 55.39% <ø> (+0.15%) ⬆️
unittest-go-windows-2022 52.49% <ø> (+0.02%) ⬆️
unittest-js 68.87% <81.81%> (+0.02%) ⬆️
Impacted Files Coverage Δ
site/src/testHelpers/entities.ts 100.00% <ø> (ø)
site/src/pages/UsersPage/UsersPage.tsx 75.00% <50.00%> (-7.36%) ⬇️
site/src/api/index.ts 65.30% <100.00%> (ø)
site/src/pages/UsersPage/UsersPageView.tsx 100.00% <100.00%> (ø)
site/src/testHelpers/handlers.ts 37.14% <100.00%> (+5.71%) ⬆️
site/src/xServices/users/usersXService.ts 80.00% <100.00%> (-1.25%) ⬇️
coderd/rbac/authz.go 55.31% <0.00%> (-13.11%) ⬇️
coderd/httpapi/httpapi.go 66.25% <0.00%> (-6.25%) ⬇️
provisioner/echo/serve.go 54.40% <0.00%> (-2.40%) ⬇️
peer/channel.go 83.81% <0.00%> (-1.74%) ⬇️
... and 17 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba4c3ce...b6db33a. Read the comment docs.


if (!users) {
return <FullScreenLoader />
}

@presleyp presleyp Apr 29, 2022 •

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.

We avoid early return on the frontend (it's a newish decision)

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.

I'm not sure what early return means... but in case there are no users, during the initial load, what should we do instead?

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.

Sorry, your content is fine, I just mean please use else to connect the conditions.

@BrunoQuaresma BrunoQuaresma Apr 29, 2022 •

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.

Ahh, ok. I will do that but I'm curious about the reason.

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.

Sure - the idea is that using else makes it clear that the line of code you're reading is only executed conditionally. Without else, the fact that the line is conditional is only represented by an apparently unrelated if that happens to contain return. So it's easier to misunderstand when maintaining the code.

@presleyp

Copy link
Copy Markdown
Contributor

@Emyrk just confirming there's no pager

@BrunoQuaresma

Copy link
Copy Markdown
Contributor Author

@presleyp we removed the pagination on the backend for now. Here is the discussion: https://codercom.slack.com/archives/C01A9SEKFEE/p1651240046986249

@BrunoQuaresma
BrunoQuaresma requested a review from presleyp April 29, 2022 17:03
@BrunoQuaresma
BrunoQuaresma merged commit 021e4cd into main Apr 29, 2022
@BrunoQuaresma
BrunoQuaresma deleted the bq/1216/load-users-from-the-api branch April 29, 2022 18:59
@misskniss misskniss added this to the V2 Beta milestone May 15, 2022
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.

Load users from the API

3 participants