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

fix: edit group #3856

Merged
merged 3 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions frontend/common/services/useGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ export const groupService = service
.injectEndpoints({
endpoints: (builder) => ({
createGroup: builder.mutation<Res['group'], Req['createGroup']>({
invalidatesTags: [{ id: 'LIST', type: 'Group' }],
invalidatesTags: [
{ id: 'LIST', type: 'Group' },
{ type: 'GroupSummary' },
],
queryFn: async (query, { dispatch }, _, baseQuery) => {
//Create the group
const { data, error } = await baseQuery({
Expand Down Expand Up @@ -47,7 +50,10 @@ export const groupService = service
Res['groupAdmin'],
Req['createGroupAdmin']
>({
invalidatesTags: [{ id: 'LIST', type: 'Group' }],
invalidatesTags: [
{ id: 'LIST', type: 'Group' },
{ type: 'GroupSummary' },
],
query: (query: Req['createGroupAdmin']) => ({
body: {},
method: 'POST',
Expand All @@ -70,7 +76,10 @@ export const groupService = service
Res['groupAdmin'],
Req['deleteGroupAdmin']
>({
invalidatesTags: [{ id: 'LIST', type: 'Group' }],
invalidatesTags: [
{ id: 'LIST', type: 'Group' },
{ type: 'GroupSummary' },
],
query: (query: Req['deleteGroupAdmin']) => ({
body: {},
method: 'POST',
Expand All @@ -93,6 +102,7 @@ export const groupService = service
invalidatesTags: (res) => [
{ id: 'LIST', type: 'Group' },
{ id: res?.id, type: 'Group' },
{ type: 'GroupSummary' },
],
queryFn: async (query, { dispatch }, _, baseQuery) => {
//Create the group
Expand Down
5 changes: 4 additions & 1 deletion frontend/web/components/UserGroupList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ const UserGroupsRow: FC<UserGroupsRowType> = ({
<Button
id='remove-group'
type='button'
onClick={() => removeGroup(id, name)}
onClick={(e) => {
e.stopPropagation()
removeGroup(id, name)
}}
className='btn btn-with-icon'
>
<Icon name='trash-2' width={20} fill='#656D7B' />
Expand Down
5 changes: 1 addition & 4 deletions frontend/web/components/modals/CreateGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,6 @@ const CreateGroup: FC<CreateGroupType> = ({ group, orgId, roles }) => {
)}
</div>
)
if (error) {
return
}
return isEdit ? (
<Tabs uncontrolled tabClassName='px-0'>
<TabItem
Expand All @@ -466,7 +463,7 @@ const CreateGroup: FC<CreateGroupType> = ({ group, orgId, roles }) => {
<TabItem tabLabel={<div>Permissions</div>}>{editPermissionsEl}</TabItem>
</Tabs>
) : (
editGroup
editGroupEl
)
}

Expand Down
Loading