-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #337 from akhilmhdh/feat/new-org-settings
Revamped the org settings page
- Loading branch information
Showing
32 changed files
with
1,263 additions
and
469 deletions.
There are no files selected for viewing
234 changes: 158 additions & 76 deletions
234
frontend/src/components/basic/table/ProjectUsersTable.tsx
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,24 @@ | ||
import { ReactNode } from 'react'; | ||
import { cva, VariantProps } from 'cva'; | ||
import { twMerge } from 'tailwind-merge'; | ||
|
||
type Props = { | ||
children: ReactNode; | ||
className?: string; | ||
} & VariantProps<typeof tagVariants>; | ||
|
||
const tagVariants = cva('inline-flex whitespace-nowrap text-sm rounded-md mx-1 text-bunker-200 ', { | ||
variants: { | ||
colorSchema: { | ||
gray: 'bg-mineshaft-500', | ||
red: 'bg-red/80 text-bunker-100' | ||
}, | ||
size: { | ||
sm: 'px-2 py-1' | ||
} | ||
} | ||
}); | ||
|
||
export const Tag = ({ children, className, colorSchema = 'gray', size = 'sm' }: Props) => ( | ||
<div className={twMerge(tagVariants({ colorSchema, className, size }))}>{children}</div> | ||
); |
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 @@ | ||
export { Tag } from './Tag'; |
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,5 @@ | ||
export { | ||
useAddIncidentContact, | ||
useDeleteIncidentContact, | ||
useGetOrgIncidentContact | ||
} from './queries'; |
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,57 @@ | ||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; | ||
|
||
import { apiRequest } from '@app/config/request'; | ||
|
||
import { AddIncidentContactDTO, DeleteIncidentContactDTO, IncidentContact } from './types'; | ||
|
||
const incidentContactKeys = { | ||
getAllContact: (orgId: string) => ['org-incident-contacts', { orgId }] as const | ||
}; | ||
|
||
const fetchOrgIncidentContacts = async (orgId: string) => { | ||
const { data } = await apiRequest.get<{ incidentContactsOrg: IncidentContact[] }>( | ||
`/api/v1/organization/${orgId}/incidentContactOrg` | ||
); | ||
|
||
return data.incidentContactsOrg; | ||
}; | ||
|
||
export const useGetOrgIncidentContact = (orgId: string) => | ||
useQuery({ | ||
queryKey: incidentContactKeys.getAllContact(orgId), | ||
queryFn: () => fetchOrgIncidentContacts(orgId), | ||
enabled: Boolean(orgId) | ||
}); | ||
|
||
// mutation | ||
export const useAddIncidentContact = () => { | ||
const queryClient = useQueryClient(); | ||
|
||
return useMutation<{}, {}, AddIncidentContactDTO>({ | ||
mutationFn: async ({ orgId, email }) => { | ||
const { data } = await apiRequest.post(`/api/v1/organization/${orgId}/incidentContactOrg`, { | ||
}); | ||
return data; | ||
}, | ||
onSuccess: (_, { orgId }) => { | ||
queryClient.invalidateQueries(incidentContactKeys.getAllContact(orgId)); | ||
} | ||
}); | ||
}; | ||
|
||
export const useDeleteIncidentContact = () => { | ||
const queryClient = useQueryClient(); | ||
|
||
return useMutation<{}, {}, DeleteIncidentContactDTO>({ | ||
mutationFn: async ({ orgId, email }) => { | ||
const { data } = await apiRequest.delete(`/api/v1/organization/${orgId}/incidentContactOrg`, { | ||
data: { email } | ||
}); | ||
return data; | ||
}, | ||
onSuccess: (_, { orgId }) => { | ||
queryClient.invalidateQueries(incidentContactKeys.getAllContact(orgId)); | ||
} | ||
}); | ||
}; |
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,18 @@ | ||
export type IncidentContact = { | ||
_id: string; | ||
email: string; | ||
organization: string; | ||
__v: number; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
}; | ||
|
||
export type DeleteIncidentContactDTO = { | ||
orgId: string; | ||
email: string; | ||
}; | ||
|
||
export type AddIncidentContactDTO = { | ||
orgId: string; | ||
email: 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
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 |
---|---|---|
@@ -1 +1 @@ | ||
export { useGetOrganization } from './queries'; | ||
export { useGetOrganization, useRenameOrg } from './queries'; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
export { | ||
fetchOrgUsers, | ||
useAddUserToOrg, | ||
useAddUserToWs, | ||
useDeleteOrgMembership, | ||
useGetOrgUsers, | ||
useGetUser, | ||
useLogoutUser | ||
useLogoutUser, | ||
useUpdateOrgUserRole | ||
} from './queries'; |
Oops, something went wrong.