Skip to content

Commit

Permalink
Merge branch 'feat(events_v2)-review-page' of https://github.com/open…
Browse files Browse the repository at this point in the history
…crvs/opencrvs-core into feat(events_v2)-review-page
  • Loading branch information
jamil314 committed Dec 10, 2024
2 parents d0f9efb + 8ba0adf commit 1944929
Show file tree
Hide file tree
Showing 16 changed files with 27 additions and 640 deletions.
1 change: 0 additions & 1 deletion packages/auth/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export const WEB_USER_JWT_AUDIENCES = [
export const NOTIFICATION_API_USER_AUDIENCE = 'opencrvs:notification-api-user'
export const VALIDATOR_API_USER_AUDIENCE = 'opencrvs:validator-api-user'
export const AGE_VERIFICATION_USER_AUDIENCE = 'opencrvs:age-verification-user'
export const NATIONAL_ID_USER_AUDIENCE = 'opencrvs:nationalId-api-user'
export const JWT_ISSUER = 'opencrvs:auth-service'
export const INVALID_TOKEN_NAMESPACE = 'invalidToken'
export const DEFAULT_TIMEOUT = 600000
6 changes: 1 addition & 5 deletions packages/auth/src/features/oauthToken/client-credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ import {
JWT_ISSUER,
NOTIFICATION_API_USER_AUDIENCE,
VALIDATOR_API_USER_AUDIENCE,
AGE_VERIFICATION_USER_AUDIENCE,
NATIONAL_ID_USER_AUDIENCE
AGE_VERIFICATION_USER_AUDIENCE
} from '@auth/constants'
import * as oauthResponse from './responses'

Expand Down Expand Up @@ -49,7 +48,6 @@ export async function clientCredentialsHandler(
const isNotificationAPIUser = result.scope.includes('notification-api')
const isValidatorAPIUser = result.scope.includes('validator-api')
const isAgeVerificationAPIUser = result.scope.includes('age-verification-api')
const isNationalIDAPIUser = result.scope.includes('nationalId')

const token = await createToken(
result.systemId,
Expand All @@ -60,8 +58,6 @@ export async function clientCredentialsHandler(
? WEB_USER_JWT_AUDIENCES.concat([VALIDATOR_API_USER_AUDIENCE])
: isAgeVerificationAPIUser
? WEB_USER_JWT_AUDIENCES.concat([AGE_VERIFICATION_USER_AUDIENCE])
: isNationalIDAPIUser
? WEB_USER_JWT_AUDIENCES.concat([NATIONAL_ID_USER_AUDIENCE])
: WEB_USER_JWT_AUDIENCES,
JWT_ISSUER,
true
Expand Down
6 changes: 0 additions & 6 deletions packages/client/graphql.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -7969,12 +7969,6 @@
"inputFields": null,
"interfaces": null,
"enumValues": [
{
"name": "MOSIP",
"description": null,
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "OTHER",
"description": null,
Expand Down
10 changes: 0 additions & 10 deletions packages/client/src/i18n/messages/views/integrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,6 @@ const messagesToDefine = {
description: 'Label for event notification'
},

nationalID: {
id: 'integrations.type.nationalID',
defaultMessage: 'National ID',
description: 'Label for national ID system client'
},

childDetails: {
id: 'integrations.childDetails',
defaultMessage: `Child's details`,
Expand Down Expand Up @@ -310,10 +304,6 @@ const messagesToDefine = {
defaultMessage: 'This will deactivate the client',
description: 'This will deactivate the client'
},
onlyOneNationalIdError: {
id: 'integrations.onlyOneNationalId',
defaultMessage: 'Only one National ID integration is allowed.'
},
updatePermissionsMsg: {
id: 'integrations.updatePermissionsMsg',
defaultMessage: 'Permissions updated successfully',
Expand Down
11 changes: 0 additions & 11 deletions packages/client/src/tests/mock-offline-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,6 @@ const systems: System[] = [
]
}
},
{
name: 'National Id',
status: SystemStatus.Active,
type: SystemType.NationalId,
_id: '613ddbbe4c0b86e9b9f114e8',
shaSecret: '22ea09c2-f964-4562-bdac-8e9ca9b9a81a',
clientId: '2f1047bb-af48-4f27-8ab8-993d7b960f92',
settings: {
openIdProviderClientId: '7b621732-6c1d-4808-81b2-fd67f05f3af3'
}
},
{
_id: '63a01ffe607915acacc2f553',
clientId: '5923118f-c633-40c6-ba97-c3e3cbb412aa',
Expand Down
1 change: 0 additions & 1 deletion packages/client/src/tests/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,6 @@ type IntegratedSystem {
}

enum IntegratingSystemType {
MOSIP
OSIA
OTHER
}
Expand Down
2 changes: 0 additions & 2 deletions packages/client/src/utils/gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,6 @@ export type IntegratedSystem = {
}

export enum IntegratingSystemType {
Mosip = 'MOSIP',
Other = 'OTHER'
}

Expand Down Expand Up @@ -2214,7 +2213,6 @@ export enum SystemStatus {

export enum SystemType {
Health = 'HEALTH',
NationalId = 'NATIONAL_ID',
RecordSearch = 'RECORD_SEARCH',
Webhook = 'WEBHOOK'
}
Expand Down
104 changes: 4 additions & 100 deletions packages/client/src/views/SysAdmin/Config/Systems/Systems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { integrationMessages } from '@client/i18n/messages/views/integrations'
import { EMPTY_STRING } from '@client/utils/constants'
import {
EventType,
IntegratingSystemType,
System,
SystemStatus,
SystemType,
Expand Down Expand Up @@ -141,10 +140,7 @@ export function SystemList() {
refreshTokenData,
refreshTokenLoading,
refreshTokenError,
resetData,
shouldWarnAboutNationalId,
newIntegratingSystemType,
setNewIntegratingSystemType
resetData
} = useSystems()

function changeActiveStatusIntl(status: SystemStatus) {
Expand Down Expand Up @@ -217,28 +213,12 @@ export function SystemList() {

const systemTypeLabels = {
HEALTH: intl.formatMessage(integrationMessages.eventNotification),
NATIONAL_ID: intl.formatMessage(integrationMessages.nationalID),
RECORD_SEARCH: intl.formatMessage(integrationMessages.recordSearch),
WEBHOOK: intl.formatMessage(integrationMessages.webhook)
}

const nationalIdLabels = {
[IntegratingSystemType.Mosip]: intl.formatMessage(
integrationMessages.integratingSystemTypeMosip
),
[IntegratingSystemType.Other]: intl.formatMessage(
integrationMessages.nationalID
)
}

const systemToLabel = (system: System) => {
if (system.type === SystemType.NationalId) {
return nationalIdLabels[
system.integratingSystemType ?? IntegratingSystemType.Mosip
]
} else {
return systemTypeLabels[system.type]
}
return systemTypeLabels[system.type]
}

return (
Expand Down Expand Up @@ -474,11 +454,7 @@ export function SystemList() {
<Button
key="submit-client-form"
id="submitClientForm"
disabled={
!newSystemType ||
newClientName === EMPTY_STRING ||
shouldWarnAboutNationalId
}
disabled={!newSystemType || newClientName === EMPTY_STRING}
onClick={() => {
registerSystem()
}}
Expand Down Expand Up @@ -516,11 +492,7 @@ export function SystemList() {
id="name_of_client"
touched={false}
required={true}
label={
newSystemType === SystemType.NationalId
? intl.formatMessage(integrationMessages.nationalIDName)
: intl.formatMessage(integrationMessages.name)
}
label={intl.formatMessage(integrationMessages.name)}
>
<TextInput
id="client_name"
Expand Down Expand Up @@ -550,10 +522,6 @@ export function SystemList() {
),
value: SystemType.Health
},
{
label: intl.formatMessage(integrationMessages.nationalID),
value: SystemType.NationalId
},
{
label: intl.formatMessage(
integrationMessages.recordSearch
Expand All @@ -570,49 +538,6 @@ export function SystemList() {
</InputField>
</Field>

{newSystemType === SystemType.NationalId && (
<Field>
<InputField
id="integrating-system-type"
touched={false}
label={intl.formatMessage(
integrationMessages.integratingSystemType
)}
>
<Select
onChange={(val) => {
setNewIntegratingSystemType(val as IntegratingSystemType)
}}
value={
newIntegratingSystemType ?? IntegratingSystemType.Mosip
}
options={[
{
label: intl.formatMessage(
integrationMessages.integratingSystemTypeMosip
),
value: IntegratingSystemType.Mosip
},
{
label: intl.formatMessage(
integrationMessages.integratingSystemTypeOther
),
value: IntegratingSystemType.Other,
disabled: true
}
]}
id={'integrating-system-select'}
/>
</InputField>
</Field>
)}

{shouldWarnAboutNationalId && (
<PaddedAlert type="error">
{intl.formatMessage(integrationMessages.onlyOneNationalIdError)}
</PaddedAlert>
)}

{newSystemType === SystemType.Health && (
<PaddedAlert type="info">
{intl.formatMessage(
Expand All @@ -629,27 +554,6 @@ export function SystemList() {
</PaddedAlert>
)}

{newSystemType === SystemType.NationalId && (
<PaddedAlert type="info">
{newIntegratingSystemType === IntegratingSystemType.Mosip &&
intl.formatMessage(
integrationMessages.integratingSystemTypeAlertMosip
)}
{newIntegratingSystemType === IntegratingSystemType.Other &&
intl.formatMessage(
integrationMessages.integratingSystemTypeAlertOther
)}
<Link
onClick={() => {
window.open('https://documentation.opencrvs.org/', '_blank')
}}
font="bold16"
>
documentation.opencrvs.org
</Link>
</PaddedAlert>
)}

{newSystemType === SystemType.RecordSearch && (
<PaddedAlert type="info">
{intl.formatMessage(
Expand Down
26 changes: 3 additions & 23 deletions packages/client/src/views/SysAdmin/Config/Systems/useSystems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ function useNewSystemDraft() {
const [newSystemType, setNewSystemType] = useState<SystemType>(
SystemType.Health
)
const [newIntegratingSystemType, setNewIntegratingSystemType] =
useState<IntegratingSystemType>(IntegratingSystemType.Mosip)

const onChangeClientName = (event: React.ChangeEvent<HTMLInputElement>) => {
const value = String(event.target.value)
Expand All @@ -60,8 +58,6 @@ function useNewSystemDraft() {
setNewClientName,
newSystemType,
setNewSystemType,
newIntegratingSystemType,
setNewIntegratingSystemType,
onChangeClientName,
clearNewSystemDraft
}
Expand All @@ -70,9 +66,6 @@ function useNewSystemDraft() {
/** Handles communication with global state management */
function useSystemsGlobalState() {
const { systems: existingSystems } = useSelector(getOfflineData)
const doesNationalIdAlreadyExist = existingSystems.some(
(system) => system.type === SystemType.NationalId
)
const dispatch = useDispatch()

const dispatchSystemUpdate = (updatedSystem: System) => {
Expand Down Expand Up @@ -101,8 +94,7 @@ function useSystemsGlobalState() {
dispatchSystemUpdate,
dispatchNewSystem,
existingSystems,
dispatchSystemRemove,
doesNationalIdAlreadyExist
dispatchSystemRemove
}
}

Expand All @@ -121,16 +113,13 @@ export function useSystems() {
setNewClientName,
newSystemType,
setNewSystemType,
newIntegratingSystemType,
setNewIntegratingSystemType,
onChangeClientName,
clearNewSystemDraft
} = useNewSystemDraft()
const {
dispatchNewSystem,
dispatchSystemUpdate,
existingSystems,
doesNationalIdAlreadyExist,
dispatchSystemRemove
} = useSystemsGlobalState()

Expand Down Expand Up @@ -301,10 +290,7 @@ export function useSystems() {
system: {
type: newSystemType,
name: newClientName,
integratingSystemType:
newSystemType === SystemType.NationalId
? newIntegratingSystemType
: undefined,
integratingSystemType: undefined,
...(newSystemType === SystemType.Webhook && {
settings: {
dailyQuota: 0,
Expand Down Expand Up @@ -342,9 +328,6 @@ export function useSystems() {
setBirthPermissions(initWebHook(EventType.Birth))
}

const shouldWarnAboutNationalId =
newSystemType === SystemType.NationalId && doesNationalIdAlreadyExist

return {
closePermissionModal,
systemToDeleteData,
Expand Down Expand Up @@ -390,9 +373,6 @@ export function useSystems() {
refreshTokenLoading,
refreshTokenError,
resetRefreshTokenData,
resetData,
shouldWarnAboutNationalId,
newIntegratingSystemType,
setNewIntegratingSystemType
resetData
}
}
1 change: 0 additions & 1 deletion packages/gateway/src/features/systems/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ enum SystemType {
}

enum IntegratingSystemType {
MOSIP
OTHER
}

Expand Down
1 change: 0 additions & 1 deletion packages/gateway/src/graphql/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,6 @@ export const enum GQLSystemType {
}

export const enum GQLIntegratingSystemType {
MOSIP = 'MOSIP',
OTHER = 'OTHER'
}

Expand Down
1 change: 0 additions & 1 deletion packages/gateway/src/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,6 @@ enum SystemType {
}

enum IntegratingSystemType {
MOSIP
OTHER
}

Expand Down
Loading

0 comments on commit 1944929

Please sign in to comment.