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

Fixes #4673 Improvements in user management screen #4674

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ export default function DeleteProjectInvitationController(
const { handleClose, listInvitationsRefetch, projectID } = props;
const { mutate: declineInvitationMutation } = useDeclineInvitationMutation(
{},
{ onSuccess: () => listInvitationsRefetch() }
{
onSuccess: () => {
listInvitationsRefetch();
handleClose();
}
}
);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default function LeaveProjectController(props: LeaveProjectControllerProp
onSuccess: () => {
projectsJoinedRefetch();
getUserWithProjectsRefetch();
handleClose();
}
}
);
Expand Down
6 changes: 5 additions & 1 deletion chaoscenter/web/src/views/CreateNewUser/CreateNewUser.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { UseMutateFunction } from '@tanstack/react-query';
import React from 'react';
import { FontVariation } from '@harnessio/design-system';
import { Layout, Container, FormInput, ButtonVariation, Text, Button } from '@harnessio/uicore';
import { Layout, Container, FormInput, ButtonVariation, Text, Button, useToaster } from '@harnessio/uicore';
import { Formik, Form } from 'formik';
import { Icon } from '@harnessio/icons';
import * as Yup from 'yup';
Expand All @@ -26,6 +26,7 @@ interface CreateNewUserFormProps {
export default function CreateNewUserView(props: CreateNewUserViewProps): React.ReactElement {
const { createNewUserMutation, createNewUserMutationLoading, handleClose } = props;
const { getString } = useStrings();
const { showError } = useToaster();

function handleSubmit(values: CreateNewUserFormProps): void {
createNewUserMutation(
Expand All @@ -41,6 +42,9 @@ export default function CreateNewUserView(props: CreateNewUserViewProps): React.
{
onSuccess: () => {
handleClose();
},
onError: (err: any) => {
showError(err.errorDescription);
amityt marked this conversation as resolved.
Show resolved Hide resolved
}
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function MemoizedInvitationsTable(props: InvitationsTableProps): React.ReactElem
return (
<Layout.Horizontal flex={{ alignItems: 'center', justifyContent: 'flex-start' }} style={{ gap: '0.25rem' }}>
<Button
key={data.projectID}
key={`${data.projectID}-accept`}
variation={ButtonVariation.PRIMARY}
text={getString('acceptInvitation')}
onClick={() =>
Expand All @@ -122,7 +122,7 @@ function MemoizedInvitationsTable(props: InvitationsTableProps): React.ReactElem
}
/>
<Button
key={data.projectID}
key={`${data.projectID}-decline`}
icon="main-trash"
iconProps={{ size: 18, color: Color.RED_300 }}
variation={ButtonVariation.ICON}
Expand Down
Loading