Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: Add suspend user action#1275

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
BrunoQuaresma merged 7 commits intomainfrombq/738/suspend-user
May 4, 2022
Merged

Conversation

BrunoQuaresma
Copy link
Collaborator

Closes#738

@BrunoQuaresmaBrunoQuaresma self-assigned thisMay 3, 2022
@BrunoQuaresmaBrunoQuaresma requested review frompresleyp anda team ascode ownersMay 3, 2022 15:58
@@ -19,20 +25,42 @@ export const UsersPage: React.FC = () => {
usersSend("GET_USERS")
}, [usersSend])

if (usersState.matches("error")) {
return <ErrorSummary error={getUsersError} />
Copy link
CollaboratorAuthor

@BrunoQuaresmaBrunoQuaresmaMay 3, 2022
edited
Loading

Choose a reason for hiding this comment

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

I moved this to be inside of UsersPage, so the getUsersError does not block the UI(not showing the table) for the other non-blocking errors like the suspendUserError.

Copy link
Contributor

Choose a reason for hiding this comment

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

My idea for that was to not go to theerror state for non-blocking errors. This may work fine too.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Sorry, I didn't understand. Without removing this statement, any error will remove the user table from the screen and show the error summary.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm suggesting that every error gets assigned to context so that we can display error messages, but that only blocking errors put the page in theerror finite state. I see that state as meaning "the page is unusable."

BrunoQuaresma reacted with thumbs up emoji
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Ahh I see it, good to know!

// Passing API.getUsers directly does not invoke the function properly
// when it is mocked. This happen in the UsersPage tests inside of the
// "shows a success message and refresh the page" test case.
getUsers: () => API.getUsers(),
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Idk why this is happening, but I guess jest lost the reference when it is passed directly. 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

What happened? I've seen some weird behavior in tests so this might be a clue :)

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

No idea, but I would guess when you pass it directly, Jest lost the reference. Maybe I should open an issue in the jest repo, but I'm not sure if it is a problem on their side on something in the XState engine... 🤔

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Ahh, I saw some of the errors that you were having last week, but they were related to some components trying to access some theme variables without being rendered inside of a ThemeProvider component.

@@ -58,6 +58,7 @@
"@storybook/addon-essentials": "6.4.22",
"@storybook/addon-links": "6.4.22",
"@storybook/react": "6.4.22",
"@testing-library/jest-dom": "5.16.4",
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

This adds some helpful test matchers!

presleyp reacted with thumbs up emoji
@codecov
Copy link

codecovbot commentedMay 3, 2022
edited
Loading

Codecov Report

Merging#1275 (5a43eac) intomain (34b91fd) willincrease coverage by0.01%.
The diff coverage is73.52%.

@@            Coverage Diff             @@##             main    #1275      +/-   ##==========================================+ Coverage   66.10%   66.11%   +0.01%==========================================  Files         281      277       -4       Lines       18400    18224     -176       Branches      216      220       +4     ==========================================- Hits        12163    12049     -114+ Misses       4974     4931      -43+ Partials     1263     1244      -19
FlagCoverage Δ
unittest-go-macos-latest53.62% <ø> (+0.10%)⬆️
unittest-go-postgres-65.03% <ø> (-0.01%)⬇️
unittest-go-ubuntu-latest56.01% <ø> (+0.10%)⬆️
unittest-go-windows-2022?
unittest-js71.61% <73.52%> (+0.61%)⬆️
Impacted FilesCoverage Δ
site/src/testHelpers/index.tsx94.44% <ø> (ø)
site/src/api/index.ts67.74% <50.00%> (-1.75%)⬇️
site/src/components/GlobalSnackbar/utils.ts73.68% <50.00%> (-2.79%)⬇️
site/src/pages/UsersPage/UsersPage.tsx79.16% <66.66%> (+4.16%)⬆️
site/src/xServices/users/usersXService.ts79.16% <80.00%> (-0.84%)⬇️
site/src/pages/UsersPage/UsersPageView.tsx92.85% <85.71%> (-7.15%)⬇️
site/src/components/UsersTable/UsersTable.tsx100.00% <100.00%> (ø)
cli/configssh.go62.04% <0.00%> (-6.57%)⬇️
pty/ptytest/ptytest.go86.95% <0.00%> (-4.35%)⬇️
cli/templateinit.go58.62% <0.00%> (-3.45%)⬇️
... and19 more

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last update34b91fd...5a43eac. Read thecomment docs.

@@ -108,6 +156,9 @@ export const usersMachine = createMachine(
assignGetUsersError: assign({
getUsersError: (_, event) => event.data,
}),
assignUserIdToSuspend: assign({
userIdToSuspend: (_, event) => event.userId,
}),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also clear this user afterwards?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

An issue with clearing this right after is the text will blink/disappear before the modal gets completely closed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, the next thing I would try is clearing the user on exiting or entering a state to see if that avoids the flash, but if it doesn't work we can just leave it.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

What potential problems do you see with keeping it? On exiting, the flash happens. On entering there is no need because a new user will be assigned.

Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking on enteringidle. It's not creating a problem now, but I thought there was potential to create a bug down the line because when you're not mid-suspend, you wouldn't expect to have a user to suspend in state. Sounds like it's more trouble than it's worth right now though.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Yeah, the issue with making that on entering the idle state is because it "breaks" the modal during the close transition. The text disappears before it gets fully closed.

error={getUsersError}
/>

<ConfirmDialog
Copy link
Contributor

Choose a reason for hiding this comment

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

This is so clean, love it

Copy link
Contributor

@presleyppresleyp left a comment

Choose a reason for hiding this comment

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

I don't think there's a need to move the error check from the page to the view now that the suspend error goes toidle, but I'm fine with it either way. Looks great!

BrunoQuaresma reacted with heart emoji
@BrunoQuaresmaBrunoQuaresmaenabled auto-merge (squash)May 4, 2022 15:58
auto-merge was automatically disabledMay 4, 2022 16:02

Pull request was closed

@BrunoQuaresmaBrunoQuaresmaenabled auto-merge (squash)May 4, 2022 16:03
@BrunoQuaresmaBrunoQuaresma merged commitf911c8a intomainMay 4, 2022
@BrunoQuaresmaBrunoQuaresma deleted the bq/738/suspend-user branchMay 4, 2022 16:10
@missknissmisskniss added this to theV2 Beta milestoneMay 15, 2022
kylecarbs pushed a commit that referenced this pull requestJun 10, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@presleyppresleyppresleyp approved these changes

Assignees

@BrunoQuaresmaBrunoQuaresma

Labels
None yet
Projects
None yet
Milestone
V2 Beta
Development

Successfully merging this pull request may close these issues.

Frontend User Delete
3 participants
@BrunoQuaresma@presleyp@misskniss

[8]ページ先頭

©2009-2025 Movatter.jp