Skip to content

Commit

Permalink
Events v2: Connect country config event configuration so that it can …
Browse files Browse the repository at this point in the history
…be read in client (#8100)

Co-authored-by: Markus <[email protected]>
Co-authored-by: Markus Laurila <[email protected]>
  • Loading branch information
3 people authored Dec 2, 2024
1 parent 935abed commit c521da6
Show file tree
Hide file tree
Showing 50 changed files with 935 additions and 275 deletions.
13 changes: 3 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ services:
- base
environment:
- COUNTRY_CONFIG_URL_INTERNAL=http://countryconfig:3040
- GATEWAY_URL_INTERNAL=http://gateway:7070
dashboards:
image: opencrvs/ocrvs-dashboards:${VERSION}
#platform: linux/amd64
Expand All @@ -48,16 +49,6 @@ services:
environment:
- COUNTRY_CONFIG_URL_INTERNAL=http://countryconfig:3040

events:
image: opencrvs/ocrvs-events:${VERSION}
#platform: linux/amd64
build:
context: .
dockerfile: ./packages/events/Dockerfile
restart: unless-stopped
depends_on:
- base

gateway:
image: opencrvs/ocrvs-gateway:${VERSION}
#platform: linux/amd64
Expand Down Expand Up @@ -87,6 +78,7 @@ services:
- CHECK_INVALID_TOKEN=true
- MINIO_BUCKET=ocrvs
- DOCUMENTS_URL=http://documents:9050

events:
image: opencrvs/ocrvs-events:${VERSION}
#platform: linux/amd64
Expand All @@ -99,6 +91,7 @@ services:
environment:
- MONGO_URL=mongodb://mongo1/events
- ES_HOST=elasticsearch:9200
- COUNTRY_CONFIG_URL=http://countryconfig:3040/

# User facing services
workflow:
Expand Down
2 changes: 2 additions & 0 deletions infrastructure/nginx-deploy-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ set -e

sed -i s~{{COUNTRY_CONFIG_URL_INTERNAL}}~$COUNTRY_CONFIG_URL_INTERNAL~g /etc/nginx/conf.d/default.conf
sed -i s~{{COUNTRY_CONFIG_URL_INTERNAL}}~$COUNTRY_CONFIG_URL_INTERNAL~g /usr/share/nginx/html/index.html
sed -i s~{{GATEWAY_URL_INTERNAL}}~$GATEWAY_URL_INTERNAL~g /etc/nginx/conf.d/default.conf
sed -i s~{{GATEWAY_URL_INTERNAL}}~$GATEWAY_URL_INTERNAL~g /usr/share/nginx/html/index.html
sed -i s~{{CONTENT_SECURITY_POLICY_WILDCARD}}~$CONTENT_SECURITY_POLICY_WILDCARD~g /etc/nginx/conf.d/default.conf
nginx -g 'daemon off;'
1 change: 1 addition & 0 deletions packages/client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ COPY --chown=node:node packages/components /app/packages/components
RUN yarn install --frozen-lockfile && yarn build
ENV CONTENT_SECURITY_POLICY_WILDCARD "{{CONTENT_SECURITY_POLICY_WILDCARD}}"
ENV COUNTRY_CONFIG_URL_INTERNAL "{{COUNTRY_CONFIG_URL_INTERNAL}}"
ENV GATEWAY_URL_INTERNAL "{{GATEWAY_URL_INTERNAL}}"
WORKDIR /app/packages/client
COPY --chown=node:node packages/client /app/packages/client
RUN yarn install --frozen-lockfile && yarn build
Expand Down
30 changes: 15 additions & 15 deletions packages/client/graphql.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2101,7 +2101,7 @@
"fields": null,
"inputFields": [
{
"name": "fields",
"name": "data",
"description": null,
"type": {
"kind": "NON_NULL",
Expand Down Expand Up @@ -3806,7 +3806,7 @@
"fields": null,
"inputFields": [
{
"name": "fields",
"name": "data",
"description": null,
"type": {
"kind": "NON_NULL",
Expand Down Expand Up @@ -4709,7 +4709,7 @@
"deprecationReason": null
},
{
"name": "fields",
"name": "data",
"description": null,
"args": [],
"type": {
Expand Down Expand Up @@ -5625,7 +5625,7 @@
"deprecationReason": null
},
{
"name": "fields",
"name": "data",
"description": null,
"args": [],
"type": {
Expand Down Expand Up @@ -5693,7 +5693,7 @@
"fields": null,
"inputFields": [
{
"name": "fields",
"name": "data",
"description": null,
"type": {
"kind": "NON_NULL",
Expand Down Expand Up @@ -7991,7 +7991,7 @@
"fields": null,
"inputFields": [
{
"name": "fields",
"name": "data",
"description": null,
"type": {
"kind": "NON_NULL",
Expand Down Expand Up @@ -12507,7 +12507,7 @@
"deprecationReason": null
},
{
"name": "fields",
"name": "data",
"description": null,
"args": [],
"type": {
Expand Down Expand Up @@ -12559,7 +12559,7 @@
"fields": null,
"inputFields": [
{
"name": "fields",
"name": "data",
"description": null,
"type": {
"kind": "NON_NULL",
Expand Down Expand Up @@ -16477,7 +16477,7 @@
"deprecationReason": null
},
{
"name": "fields",
"name": "data",
"description": null,
"args": [],
"type": {
Expand Down Expand Up @@ -16545,7 +16545,7 @@
"fields": null,
"inputFields": [
{
"name": "fields",
"name": "data",
"description": null,
"type": {
"kind": "NON_NULL",
Expand Down Expand Up @@ -17513,7 +17513,7 @@
"fields": null,
"inputFields": [
{
"name": "fields",
"name": "data",
"description": null,
"type": {
"kind": "NON_NULL",
Expand Down Expand Up @@ -17587,7 +17587,7 @@
"fields": null,
"inputFields": [
{
"name": "fields",
"name": "data",
"description": null,
"type": {
"kind": "NON_NULL",
Expand Down Expand Up @@ -18390,7 +18390,7 @@
"fields": null,
"inputFields": [
{
"name": "fields",
"name": "data",
"description": null,
"type": {
"kind": "NON_NULL",
Expand Down Expand Up @@ -18452,7 +18452,7 @@
"fields": null,
"inputFields": [
{
"name": "fields",
"name": "data",
"description": null,
"type": {
"kind": "NON_NULL",
Expand Down Expand Up @@ -18487,7 +18487,7 @@
"fields": null,
"inputFields": [
{
"name": "fields",
"name": "data",
"description": null,
"type": {
"kind": "NON_NULL",
Expand Down
8 changes: 8 additions & 0 deletions packages/client/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /api/ {
rewrite ^/api/(.*)$ /$1 break;
proxy_pass {{GATEWAY_URL_INTERNAL}};
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}

location / {
root /usr/share/nginx/html;
Expand Down
9 changes: 8 additions & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"open:cov": "yarn test && opener coverage/index.html",
"lint": "yarn lint:css && yarn lint:ts",
"lint:css": "stylelint 'src/**/*.{ts,tsx}'",
"lint:ts": "eslint --fix './src/**/*.{ts,tsx}' --max-warnings=349",
"lint:ts": "eslint --fix './src/**/*.{ts,tsx}' --max-warnings=353",
"test:compilation": "tsc --noEmit",
"extract:translations": "bash extract-translations.sh",
"generate-gateway-types": "NODE_OPTIONS=--dns-result-order=ipv4first graphql-codegen --config codegen.ts && prettier --write src/utils/gateway.ts",
Expand All @@ -36,9 +36,14 @@
"@craco/craco": "^6.4.3",
"@opencrvs/commons": "^1.5.0",
"@opencrvs/components": "^1.3.0",
"@opencrvs/gateway": "1.5.0",
"@reduxjs/toolkit": "^1.8.3",
"@sentry/react": "^7.12.1",
"@sentry/tracing": "^7.12.1",
"@tanstack/react-query": "^5.61.5",
"@trpc/client": "^11.0.0-rc.648",
"@trpc/react-query": "^11.0.0-rc.648",
"@trpc/server": "^11.0.0-rc.648",
"@types/bcryptjs": "^2.4.2",
"@types/history": "^4.6.2",
"@types/html-to-pdfmake": "^2.4.4",
Expand All @@ -65,6 +70,7 @@
"formik": "^2.2.9",
"google-libphonenumber": "^3.2.32",
"graphql": "^15.0.0",
"graphql-tag": "^2.12.6",
"graphql-tools": "^4.0.7",
"handlebars": "^4.7.6",
"history": "^4.7.2",
Expand Down Expand Up @@ -95,6 +101,7 @@
"redux-sentry-middleware": "^0.2.0",
"sanitize-html": "^2.4.0",
"styled-components": "^5.2.0",
"superjson": "1.9.0-0",
"tsconfig-paths": "^3.13.0",
"vite": "^5.4.8",
"vite-plugin-svgr": "^0.6.0",
Expand Down
38 changes: 26 additions & 12 deletions packages/client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,15 @@ import { ReviewCorrection } from './views/ReviewCorrection/ReviewCorrection'
import { ReviewCertificate } from './views/PrintCertificate/ReviewCertificateAction'
import AllUserEmail from './views/SysAdmin/Communications/AllUserEmail/AllUserEmail'
import { ReloadModal } from './views/Modals/ReloadModal'
import { V2_EVENT_ROUTE, V2_ROOT_ROUTE } from './v2-events/routes/routes'
import {
V2_EVENT_ROUTE,
V2_EVENTS_ROUTE,
V2_ROOT_ROUTE
} from './v2-events/routes'
import { Workqueues } from './v2-events/features/workqueues'
import { PublishEvent } from './v2-events/features/events/PublishEvent'
import { EventFormWizardIndex } from './v2-events/features/events/EventFormWizard'
import { TRPCProvider } from './v2-events/trcp'
import { Events } from './v2-events/features/events/EventSelection'

interface IAppProps {
client?: ApolloClient<NormalizedCacheObject>
Expand All @@ -96,6 +102,7 @@ const GlobalStyle = createGlobalStyle`

export function App(props: IAppProps) {
const { client } = useApolloClient(props.store)

return (
<ErrorBoundary>
<GlobalStyle />
Expand Down Expand Up @@ -522,16 +529,23 @@ export function App(props: IAppProps) {
path={routes.PRINT_RECORD}
component={PrintRecord}
/>
<ProtectedRoute
exact
path={V2_ROOT_ROUTE}
component={Workqueues}
/>
<ProtectedRoute
exact
path={V2_EVENT_ROUTE}
component={PublishEvent}
/>
<TRPCProvider>
<ProtectedRoute
exact
path={V2_ROOT_ROUTE}
component={Workqueues}
/>
<ProtectedRoute
exact
path={V2_EVENTS_ROUTE}
component={Events}
/>
<ProtectedRoute
exact
path={V2_EVENT_ROUTE}
component={EventFormWizardIndex}
/>
</TRPCProvider>
</Switch>
</>
)
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/forms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export interface IDynamicOptions {
options?: { [key: string]: ISelectOption[] }
}

export interface IDispatchOptions {
interface IDispatchOptions {
action: string
payloadKey: string
}
Expand Down
Loading

0 comments on commit c521da6

Please sign in to comment.