-
Notifications
You must be signed in to change notification settings - Fork 698
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat/teaming: Added revamped UI of teaming for litmus 3.0.0 (#4134)
* Added UI screens for active project members Signed-off-by: Saranya-jena <[email protected]> * Added auth endpoints to fetch active and pending members Signed-off-by: Saranya-jena <[email protected]> * Added api integration for active and pending members Signed-off-by: Saranya-jena <[email protected]> * Added api integration for invite users Signed-off-by: Saranya-jena <[email protected]> * Api refactor for invite users Signed-off-by: Saranya-jena <[email protected]> * Integrated table v2 with invite users api Signed-off-by: Saranya-jena <[email protected]> * Adding pending mebers screen Signed-off-by: Saranya-jena <[email protected]> * Added pending members table Signed-off-by: Saranya-jena <[email protected]> * Added json schema for all the fields Signed-off-by: Saranya-jena <[email protected]> * updated schema in frontend Signed-off-by: Saranya-jena <[email protected]> * Added epi integration for teaming Signed-off-by: Saranya-jena <[email protected]> * Added refetch functions in the modals and tables Signed-off-by: Saranya-jena <[email protected]> * Added ui fixes Signed-off-by: Saranya-jena <[email protected]> * Added loader and default text for empty array Signed-off-by: Saranya-jena <[email protected]> * Added user details fields while sending invitations Signed-off-by: Saranya-jena <[email protected]> * Added user details fields while project initialization Signed-off-by: Saranya-jena <[email protected]> * removed unused comments Signed-off-by: Saranya-jena <[email protected]> * resolved review comments Signed-off-by: Saranya-jena <[email protected]> * uncommented the logs Signed-off-by: Saranya-jena <[email protected]> --------- Signed-off-by: Saranya-jena <[email protected]>
- Loading branch information
1 parent
92d2dbe
commit 4b778f5
Showing
37 changed files
with
1,058 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
chaoscenter/web/src/controllers/ActiveProjectMemberList/ActiveProjectMembers.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { useParams } from 'react-router-dom'; | ||
import React from 'react'; | ||
import ActiveMembersTableView from '@views/ProjectMembers/ActiveMembersTable'; | ||
import { useGetProjectMembersQuery } from '@api/auth'; | ||
|
||
export default function ActiveProjectMembersController(): React.ReactElement { | ||
const { projectID } = useParams<{ projectID: string }>(); | ||
const { | ||
data, | ||
isLoading, | ||
refetch: getMembersRefetch | ||
} = useGetProjectMembersQuery({ project_id: projectID, state: 'accepted' }); | ||
|
||
return ( | ||
<ActiveMembersTableView activeMembers={data?.data} isLoading={isLoading} getMembersRefetch={getMembersRefetch} /> | ||
); | ||
} |
3 changes: 3 additions & 0 deletions
3
chaoscenter/web/src/controllers/ActiveProjectMemberList/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import ActiveProjectMembersController from './ActiveProjectMembers'; | ||
|
||
export default ActiveProjectMembersController; |
49 changes: 49 additions & 0 deletions
49
chaoscenter/web/src/controllers/InviteNewMembers/InviteNewMembers.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from 'react'; | ||
import { useParams } from 'react-router-dom'; | ||
import { ExpandingSearchInput } from '@harnessio/uicore'; | ||
import { useStrings } from '@strings'; | ||
import { useGetUsersForInvitationQuery, User } from '@api/auth'; | ||
import InviteNewMembersView from '@views/InviteNewMembers/InviteNewMembers'; | ||
import type { ProjectPathParams } from '@routes/RouteInterfaces'; | ||
|
||
interface InviteUsersControllerProps { | ||
handleClose: () => void; | ||
} | ||
|
||
export default function InviteUsersController({ handleClose }: InviteUsersControllerProps): React.ReactElement { | ||
const { projectID } = useParams<ProjectPathParams>(); | ||
const { data, isLoading, refetch: getUsers } = useGetUsersForInvitationQuery({ project_id: projectID }); | ||
const { getString } = useStrings(); | ||
|
||
const [searchQuery, setSearchQuery] = React.useState(''); | ||
const searchInput = ( | ||
<ExpandingSearchInput placeholder={getString('search')} alwaysExpanded onChange={value => setSearchQuery(value)} /> | ||
); | ||
|
||
function doesFilterCriteriaMatch(user: User): boolean { | ||
const updatedSearchQuery = searchQuery.trim(); | ||
if ( | ||
user.name?.toLowerCase().includes(updatedSearchQuery.toLowerCase()) || | ||
user.username?.toLowerCase().includes(updatedSearchQuery.toLowerCase()) || | ||
user.email?.toLowerCase().includes(updatedSearchQuery.toLowerCase()) | ||
) | ||
return true; | ||
return false; | ||
} | ||
|
||
const filteredData = React.useMemo(() => { | ||
if (!data?.data) return []; | ||
return data.data.filter(user => doesFilterCriteriaMatch(user)); | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, [data, searchQuery]); | ||
|
||
return ( | ||
<InviteNewMembersView | ||
data={filteredData} | ||
getUsers={getUsers} | ||
handleClose={handleClose} | ||
isLoading={isLoading} | ||
searchInput={searchInput} | ||
/> | ||
); | ||
} |
17 changes: 17 additions & 0 deletions
17
chaoscenter/web/src/controllers/InviteNewMembers/helper.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { User } from '@api/auth'; | ||
import type { InviteUserDetails } from './types'; | ||
|
||
export function generateInviteUsersTableContent(userData: Array<User> | undefined): Array<InviteUserDetails> { | ||
const content: Array<InviteUserDetails> = | ||
userData && userData.length > 0 | ||
? userData.map(user => { | ||
return { | ||
id: user.userID, | ||
username: user.username, | ||
email: user.email ?? '', | ||
name: user.name ?? '' | ||
}; | ||
}) | ||
: []; | ||
return content; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import InviteUsersController from './InviteNewMembers'; | ||
|
||
export default InviteUsersController; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export interface InviteUserDetails { | ||
username: string; | ||
id: string; | ||
email: string; | ||
name: string; | ||
} |
21 changes: 21 additions & 0 deletions
21
chaoscenter/web/src/controllers/PendingProjectMemberList/PendingProjectMembers.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { useParams } from 'react-router-dom'; | ||
import React from 'react'; | ||
import PendingMembersTableView from '@views/ProjectMembers/PendingMembersTable'; | ||
import { useGetProjectMembersQuery } from '@api/auth'; | ||
|
||
export default function PendingProjectMembersController(): React.ReactElement { | ||
const { projectID } = useParams<{ projectID: string }>(); | ||
const { | ||
data, | ||
isLoading, | ||
refetch: getPendingMembersRefetch | ||
} = useGetProjectMembersQuery({ project_id: projectID, state: 'not_accepted' }); | ||
|
||
return ( | ||
<PendingMembersTableView | ||
pendingMembers={data?.data} | ||
isLoading={isLoading} | ||
getPendingMembersRefetch={getPendingMembersRefetch} | ||
/> | ||
); | ||
} |
3 changes: 3 additions & 0 deletions
3
chaoscenter/web/src/controllers/PendingProjectMemberList/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import type PendingProjectMembersController from './PendingProjectMembers'; | ||
|
||
export default PendingProjectMembersController; |
38 changes: 38 additions & 0 deletions
38
chaoscenter/web/src/controllers/RemoveMember/RemoveMember.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React from 'react'; | ||
import { useToaster } from '@harnessio/uicore'; | ||
import type { QueryObserverResult, RefetchOptions, RefetchQueryFilters } from '@tanstack/react-query'; | ||
import { GetProjectMembersOkResponse, useRemoveInvitationMutation } from '@api/auth'; | ||
import RemoveMemberView from '@views/RemoveMember'; | ||
|
||
interface RemoveMemberControllerProps { | ||
userID: string; | ||
username: string; | ||
hideDeleteModal: () => void; | ||
getMembersRefetch: <TPageData>( | ||
options?: (RefetchOptions & RefetchQueryFilters<TPageData>) | undefined | ||
) => Promise<QueryObserverResult<GetProjectMembersOkResponse, unknown>>; | ||
} | ||
export default function RemoveMemberController(props: RemoveMemberControllerProps): React.ReactElement { | ||
const { userID, username, hideDeleteModal, getMembersRefetch } = props; | ||
const { showSuccess } = useToaster(); | ||
|
||
const { mutate: removeMemberMutation } = useRemoveInvitationMutation( | ||
{}, | ||
{ | ||
onSuccess: data => { | ||
getMembersRefetch(); | ||
showSuccess(data.message); | ||
} | ||
} | ||
); | ||
|
||
return ( | ||
<RemoveMemberView | ||
{...props} | ||
removeMemberMutation={removeMemberMutation} | ||
userID={userID} | ||
username={username} | ||
handleClose={hideDeleteModal} | ||
/> | ||
); | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export enum MembersTabs { | ||
ACTIVE = 'active-members', | ||
PENDING = 'pending-members' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export interface ProjectPathParams { | ||
projectID: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.