* fix: Accept Invitation Button duplicates Signed-off-by: JanhaviAlekar <janhavialekar@gmail.com> * fix: Delete project Invite Dialog not closing on delete invite Signed-off-by: JanhaviAlekar <janhavialekar@gmail.com> * fix: Leave project Dialog not closing on leaving project Signed-off-by: JanhaviAlekar <janhavialekar@gmail.com> * fix: handling create user error with toast Signed-off-by: JanhaviAlekar <janhavialekar@gmail.com> --------- Signed-off-by: JanhaviAlekar <janhavialekar@gmail.com> Signed-off-by: Janhavi Alekar <97527096+JanhaviAlekar@users.noreply.github.com> Co-authored-by: Saranya Jena <saranya.jena@harness.io>
This commit is contained in:
parent
ff21351864
commit
50c2ef5a6d
|
|
@ -17,7 +17,12 @@ export default function DeleteProjectInvitationController(
|
||||||
const { handleClose, listInvitationsRefetch, projectID } = props;
|
const { handleClose, listInvitationsRefetch, projectID } = props;
|
||||||
const { mutate: declineInvitationMutation } = useDeclineInvitationMutation(
|
const { mutate: declineInvitationMutation } = useDeclineInvitationMutation(
|
||||||
{},
|
{},
|
||||||
{ onSuccess: () => listInvitationsRefetch() }
|
{
|
||||||
|
onSuccess: () => {
|
||||||
|
listInvitationsRefetch();
|
||||||
|
handleClose();
|
||||||
|
}
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ export default function LeaveProjectController(props: LeaveProjectControllerProp
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
projectsJoinedRefetch();
|
projectsJoinedRefetch();
|
||||||
getUserWithProjectsRefetch();
|
getUserWithProjectsRefetch();
|
||||||
|
handleClose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import type { UseMutateFunction } from '@tanstack/react-query';
|
import type { UseMutateFunction } from '@tanstack/react-query';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { FontVariation } from '@harnessio/design-system';
|
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 { Formik, Form } from 'formik';
|
||||||
import { Icon } from '@harnessio/icons';
|
import { Icon } from '@harnessio/icons';
|
||||||
import * as Yup from 'yup';
|
import * as Yup from 'yup';
|
||||||
|
|
@ -28,17 +28,28 @@ interface CreateNewUserFormProps {
|
||||||
export default function CreateNewUserView(props: CreateNewUserViewProps): React.ReactElement {
|
export default function CreateNewUserView(props: CreateNewUserViewProps): React.ReactElement {
|
||||||
const { createNewUserMutation, createNewUserMutationLoading, handleClose } = props;
|
const { createNewUserMutation, createNewUserMutationLoading, handleClose } = props;
|
||||||
const { getString } = useStrings();
|
const { getString } = useStrings();
|
||||||
|
const { showError } = useToaster();
|
||||||
|
|
||||||
function handleSubmit(values: CreateNewUserFormProps): void {
|
function handleSubmit(values: CreateNewUserFormProps): void {
|
||||||
createNewUserMutation({
|
createNewUserMutation(
|
||||||
body: {
|
{
|
||||||
name: values.name,
|
body: {
|
||||||
email: values.email,
|
name: values.name,
|
||||||
username: values.username,
|
email: values.email,
|
||||||
password: values.password,
|
username: values.username,
|
||||||
role: 'user'
|
password: values.password,
|
||||||
|
role: 'user'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
onSuccess: () => {
|
||||||
|
handleClose();
|
||||||
|
},
|
||||||
|
onError: (err: any) => {
|
||||||
|
showError(err.errorDescription);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ function MemoizedInvitationsTable(props: InvitationsTableProps): React.ReactElem
|
||||||
return (
|
return (
|
||||||
<Layout.Horizontal flex={{ alignItems: 'center', justifyContent: 'flex-start' }} style={{ gap: '0.25rem' }}>
|
<Layout.Horizontal flex={{ alignItems: 'center', justifyContent: 'flex-start' }} style={{ gap: '0.25rem' }}>
|
||||||
<Button
|
<Button
|
||||||
key={data.projectID}
|
key={`${data.projectID}-accept`}
|
||||||
variation={ButtonVariation.PRIMARY}
|
variation={ButtonVariation.PRIMARY}
|
||||||
text={getString('acceptInvitation')}
|
text={getString('acceptInvitation')}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
|
|
@ -122,7 +122,7 @@ function MemoizedInvitationsTable(props: InvitationsTableProps): React.ReactElem
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
key={data.projectID}
|
key={`${data.projectID}-decline`}
|
||||||
icon="main-trash"
|
icon="main-trash"
|
||||||
iconProps={{ size: 18, color: Color.RED_300 }}
|
iconProps={{ size: 18, color: Color.RED_300 }}
|
||||||
variation={ButtonVariation.ICON}
|
variation={ButtonVariation.ICON}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue