Skip to content

Commit

Permalink
Merge pull request KelvinTegelaar#2626 from BNWEIN/EditGroupChanges
Browse files Browse the repository at this point in the history
Edit group changes
  • Loading branch information
KelvinTegelaar authored Jul 5, 2024
2 parents 5b0b3ea + 17432bf commit bf93698
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/store/api/groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ export const groupsApi = baseApi.injectEndpoints({
params: { tenantFilter: tenantDomain, userId },
}),
}),
listGroupSenderAuth: builder.query({
query: ({ tenantDomain, groupId }) => ({
path: '/api/ListGroupSenderAuthentication',
params: {
TenantFilter: tenantDomain,
GroupId: groupId,
},
}),
}),
}),
})
export const {
Expand All @@ -69,4 +78,5 @@ export const {
useListGroupMembersQuery,
useListGroupOwnersQuery,
useListUserGroupsQuery,
useListGroupSenderAuthQuery,
} = groupsApi
29 changes: 27 additions & 2 deletions src/views/identity/administration/EditGroup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
useListGroupMembersQuery,
useListGroupOwnersQuery,
useListGroupQuery,
useListGroupSenderAuthQuery,
} from 'src/store/api/groups'
import { useDispatch } from 'react-redux'
import { ModalService } from 'src/components/utilities'
Expand All @@ -41,6 +42,13 @@ const EditGroup = () => {
isSuccess,
} = useListGroupQuery({ tenantDomain, groupId })

const {
data: SenderAuth = {},
isFetching: SenderAuthisFetching,
error: SenderAuthError,
isSuccess: SenderAuthIsSuccess,
} = useListGroupSenderAuthQuery({ tenantDomain, groupId })

const {
data: members = [],
isFetching: membersisFetching,
Expand Down Expand Up @@ -97,6 +105,7 @@ const EditGroup = () => {
setQueryError(true)
}
}, [groupId, tenantDomain, dispatch])

const onSubmit = (values) => {
const shippedValues = {
tenantID: tenantDomain,
Expand Down Expand Up @@ -154,6 +163,12 @@ const EditGroup = () => {
{isSuccess && (
<Form
onSubmit={onSubmit}
initialValues={{
...(group[0].calculatedGroupType === 'Microsoft 365' ||
group[0].calculatedGroupType === 'Distribution List'
? { allowExternal: !SenderAuth.enabled }
: {}),
}}
render={({ handleSubmit, submitting, values }) => {
return (
<CForm onSubmit={handleSubmit}>
Expand Down Expand Up @@ -304,8 +319,18 @@ const EditGroup = () => {
{isFetching && <CSpinner />}
{isSuccess && (
<>
This is the (raw) information for this group.
<pre>{JSON.stringify(group, null, 2)}</pre>
<div>
This is the (raw) information for this group.
<pre>{JSON.stringify(group, null, 2)}</pre>
</div>
<div>
This is the (raw) information for SenderAuth.
{SenderAuthisFetching && <CSpinner />}
{SenderAuthIsSuccess && <pre>{JSON.stringify(SenderAuth, null, 2)}</pre>}
{SenderAuthError && (
<div>Error fetching SenderAuth data: {SenderAuthError.message}</div>
)}
</div>
</>
)}
</CCardBody>
Expand Down

0 comments on commit bf93698

Please sign in to comment.