Skip to content

feat: Add update user roles action - #1361

Merged
BrunoQuaresma merged 18 commits into
mainfrom
bq/fe/update-user-roles-action
May 10, 2022
Merged

BrunoQuaresma merged 18 commits into
mainfrom
bq/fe/update-user-roles-action

Conversation

@BrunoQuaresma

@BrunoQuaresma BrunoQuaresma commented May 10, 2022 •

Copy link
Copy Markdown
Contributor

Closes #739

@BrunoQuaresma
BrunoQuaresma requested a review from presleyp as a code owner May 10, 2022 14:27
@BrunoQuaresma BrunoQuaresma self-assigned this May 10, 2022
@BrunoQuaresma
BrunoQuaresma requested a review from a team as a code owner May 10, 2022 14:27
@codecov

codecov Bot commented May 10, 2022 •

Copy link
Copy Markdown

Codecov Report

Merging #1361 (9bd6ca5) into main (e54324d) will increase coverage by 0.46%.
The diff coverage is 88.63%.

@@            Coverage Diff             @@
##             main    #1361      +/-   ##
==========================================
+ Coverage   66.49%   66.95%   +0.46%     
==========================================
  Files         284      286       +2     
  Lines       18593    18752     +159     
  Branches      235      241       +6     
==========================================
+ Hits        12363    12555     +192     
+ Misses       4964     4913      -51     
- Partials     1266     1284      +18     
Flag Coverage Δ
unittest-go-macos-latest ?
unittest-go-postgres- 65.47% <ø> (+0.33%) ⬆️
unittest-go-ubuntu-latest 56.44% <ø> (+0.32%) ⬆️
unittest-go-windows-2022 52.40% <ø> (+0.33%) ⬆️
unittest-js 74.24% <88.63%> (+0.56%) ⬆️
Impacted Files Coverage Δ
site/src/api/index.ts 70.00% <57.14%> (-1.24%) ⬇️
site/src/xServices/users/usersXService.ts 72.91% <66.66%> (-2.09%) ⬇️
site/src/xServices/roles/siteRolesXService.ts 80.00% <80.00%> (ø)
site/src/components/UsersTable/UsersTable.tsx 96.00% <94.73%> (-4.00%) ⬇️
site/src/components/RoleSelect/RoleSelect.tsx 100.00% <100.00%> (ø)
site/src/components/TableHeaders/TableHeaders.tsx 91.66% <100.00%> (-8.34%) ⬇️
site/src/pages/UsersPage/UsersPage.tsx 86.84% <100.00%> (+10.98%) ⬆️
site/src/pages/UsersPage/UsersPageView.tsx 94.44% <100.00%> (+1.11%) ⬆️
site/src/testHelpers/entities.ts 100.00% <100.00%> (ø)
site/src/testHelpers/handlers.ts 60.00% <100.00%> (+2.10%) ⬆️
... and 50 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 e54324d...9bd6ca5. Read the comment docs.

Bruno Quaresma and others added 2 commits May 10, 2022 13:32
Co-authored-by: Presley Pizzo <1290996+presleyp@users.noreply.github.com>
Co-authored-by: Presley Pizzo <1290996+presleyp@users.noreply.github.com>
@BrunoQuaresma
BrunoQuaresma requested a review from presleyp May 10, 2022 16:33
Comment thread site/src/pages/UsersPage/UsersPage.tsx Resolved

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

My brain is a little fried so I'm not looking as deeply at the XService as normal but this all looks good to me. I just have a question about your useRoles hook - if it's taking effect at the same time as the other useEffect seems like we could put them together. If not then maybe the other one (that I wrote) has a bug.

Co-authored-by: Presley Pizzo <1290996+presleyp@users.noreply.github.com>
@BrunoQuaresma

Copy link
Copy Markdown
Contributor Author

@presleyp thanks for the review.

About the useRoles hook. When I have to use an effect + state I like to encapsulate these into a hook, so I can make more explicit what I want to do with them and how they are connected. This article explains some pros of this "pattern" if you are interested https://kyleshevlin.com/use-encapsulation

@presleyp

Copy link
Copy Markdown
Contributor

@BrunoQuaresma yeah, I think that's a strategy for addressing the thing that bothers me about useEffect, which is that it's hard to tell over time what it's meant to do and when it's expected to run. Even with the custom hook, I think it would be helpful to add a comment that send never changes so this should only run on mount.

@BrunoQuaresma
BrunoQuaresma enabled auto-merge (squash) May 10, 2022 19:05
@BrunoQuaresma
BrunoQuaresma merged commit 2df92e6 into main May 10, 2022
@BrunoQuaresma
BrunoQuaresma deleted the bq/fe/update-user-roles-action branch May 10, 2022 19:13
@@ -0,0 +1,24 @@
import { ComponentMeta, Story } from "@storybook/react"
import React from "react"

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.

@BrunoQuaresma Just looking at merged PRs to learn - no action necessary here. Curious if there's a reason we're importing React given we're on version 17 instead of silencing the 'React must be in scope' warnings.

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.

Good question, I think it is automatically added by an eslint role, but I'm not 100% sure.

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.

Frontend User Update - Role

4 participants