-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add antd pro-design * Registering a checkmark * Add url to new user view details * silence table stripping for a more crisp clean look * Second iteration ideating data flow * Export fhirDataType components * Update user management constantts * Add second iteration of user detail views * Move userDeleteWith popup confirm button to own component * Add react import to user delete btn component file * Change leave text on group detail view to red * Test edit btn works * Fix roleDetail view and add tests * Temporarily remove location details view * Make description list responsive * Replace previous view details components * Wrap microcopy in translator function * Recognize practitionerDetail fhir resource in rbac * Integrate rbac into user detail view * Fix import * Fix permission string * Update tests * Fix practitionerDetails endpoint * Fix url collision to user details * Remove surplus pro-components library * Fix user details url route * Invalidate only query that refetches user queries * Code cleanup * Update tests * Update lock file * Revert "Remove surplus pro-components library" This reverts commit acd64b8. * Fix lint issues
- Loading branch information
1 parent
cd3facc
commit 405e57e
Showing
30 changed files
with
2,198 additions
and
722 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
48 changes: 48 additions & 0 deletions
48
packages/fhir-keycloak-user-management/src/components/UserDeleteBtn/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,48 @@ | ||
import { Popconfirm, Button } from 'antd'; | ||
import { KEYCLOAK_URL_USERS } from '@opensrp/user-management'; | ||
import { sendErrorNotification } from '@opensrp/notifications'; | ||
import { deleteUser } from '../UserList/ListView/utils'; | ||
import { useTranslation } from '../../mls'; | ||
import { useQueryClient } from 'react-query'; | ||
import React from 'react'; | ||
|
||
export interface UserDeleteBtnProp { | ||
afterActions?: () => void; | ||
keycloakBaseUrl: string; | ||
fhirBaseUrl: string; | ||
resourceId: string; | ||
} | ||
|
||
export const UserDeleteBtn = (props: UserDeleteBtnProp) => { | ||
const { afterActions, keycloakBaseUrl, fhirBaseUrl, resourceId } = props; | ||
const { t } = useTranslation(); | ||
const queryClient = useQueryClient(); | ||
|
||
return ( | ||
<Popconfirm | ||
key="delete-user" | ||
title={t('Are you sure you want to delete this user?')} | ||
okText={t('Yes')} | ||
cancelText={t('No')} | ||
onConfirm={async () => { | ||
await deleteUser(keycloakBaseUrl, fhirBaseUrl, resourceId, t); | ||
try { | ||
return await queryClient.invalidateQueries({ | ||
queryKey: [KEYCLOAK_URL_USERS], | ||
exact: true, | ||
}); | ||
} catch { | ||
return sendErrorNotification( | ||
t('Failed to update data, please refresh the page to see the most recent changes') | ||
); | ||
} finally { | ||
afterActions?.(); | ||
} | ||
}} | ||
> | ||
<Button data-testid="delete-user" danger type="link"> | ||
{t('Delete')} | ||
</Button> | ||
</Popconfirm> | ||
); | ||
}; |
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
Oops, something went wrong.