From 23d4efed9db55ce2a3d12378bd2b09851e5d2a43 Mon Sep 17 00:00:00 2001 From: Peter Muriuki Date: Thu, 5 Dec 2024 15:26:44 +0300 Subject: [PATCH 1/7] Add helm envs checker and update i18n documentation --- scripts/helm-envs-checker/js-yaml | 0 scripts/helm-envs-checker/typescript | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 scripts/helm-envs-checker/js-yaml create mode 100644 scripts/helm-envs-checker/typescript diff --git a/scripts/helm-envs-checker/js-yaml b/scripts/helm-envs-checker/js-yaml new file mode 100644 index 000000000..e69de29bb diff --git a/scripts/helm-envs-checker/typescript b/scripts/helm-envs-checker/typescript new file mode 100644 index 000000000..e69de29bb From 80132ca0890937678dd542e01648d32f590554f2 Mon Sep 17 00:00:00 2001 From: Peter Muriuki Date: Tue, 17 Dec 2024 16:34:28 +0300 Subject: [PATCH 2/7] Update roledefinition and matching --- app/src/App/fhir-apps.tsx | 10 +- app/src/configs/dispatchConfig.ts | 3 + app/src/routes/index.tsx | 2 +- .../src/containers/ImportDetailView/index.tsx | 2 + .../src/containers/ImportListView/index.tsx | 4 +- .../tests/__snapshots__/index.test.tsx.snap | 9 +- packages/pkg-config/src/configStore/index.ts | 6 +- packages/pkg-config/src/constants.ts | 4 + packages/pkg-config/src/index.tsx | 1 + packages/rbac/src/adapters/keycloakAdapter.ts | 98 +++++++++++-------- packages/rbac/src/constants.ts | 31 +++--- packages/rbac/src/helpers/utils.ts | 27 +++-- packages/rbac/src/roleDefinition/index.ts | 6 +- .../react-utils/src/helpers/test-utils.tsx | 4 +- 14 files changed, 121 insertions(+), 86 deletions(-) diff --git a/app/src/App/fhir-apps.tsx b/app/src/App/fhir-apps.tsx index 2db3c804e..761fa9d20 100644 --- a/app/src/App/fhir-apps.tsx +++ b/app/src/App/fhir-apps.tsx @@ -216,7 +216,7 @@ const FHIRApps = () => { disableLoginProtection={DISABLE_LOGIN_PROTECTION} exact path={DATA_IMPORT_LIST_URL} - permissions={['WebDataImport.read']} + permissions={['DataImport.read']} component={DataImportList} /> { disableLoginProtection={DISABLE_LOGIN_PROTECTION} exact path={`${DATA_IMPORT_CREATE_URL}`} - permissions={['WebDataImport.create']} + permissions={['DataImport.create']} component={StartDataImport} /> { exact path={`${DATA_IMPORT_DETAIL_URL}/:${'workflowId'}`} {...patientProps} - permissions={['WebDataImport.read']} + permissions={['DataImport.read']} component={ImportDetailViewDetails} /> { exact path={`${DATA_IMPORT_LIST_URL}/:${'workflowId'}`} {...patientProps} - permissions={['WebDataImport.read']} + permissions={['DataImport.read']} component={DataImportList} /> { exact path={APP_LOGIN_URL} render={() => { - window.location.href = OpenSRP; + window.location.href = `${OpenSRP}&kc_locale=fr`; return <>; }} /> diff --git a/app/src/configs/dispatchConfig.ts b/app/src/configs/dispatchConfig.ts index d62aa52eb..1085b7494 100644 --- a/app/src/configs/dispatchConfig.ts +++ b/app/src/configs/dispatchConfig.ts @@ -4,6 +4,7 @@ import { ProjectCode, setAllConfigs, getAllConfigs, + clientIdConfig, } from '@opensrp/pkg-config'; import { BACKEND_ACTIVE, @@ -17,6 +18,7 @@ import { AUTHZ_STRATEGY, COMMODITIES_LIST_RESOURCE_ID, FHIR_INVENTORY_LIST_ID, + OPENSRP_CLIENT_ID, } from './env'; import { URL_BACKEND_LOGIN, URL_REACT_LOGIN } from '../constants'; @@ -26,6 +28,7 @@ const defaultvalues = getAllConfigs(); const configObject: ConfigState = { ...defaultvalues, + [clientIdConfig]: OPENSRP_CLIENT_ID, languageCode: LANGUAGE_CODE as LanguageCode, projectCode: PROJECT_CODE as ProjectCode, appLoginURL: APP_LOGIN_URL, diff --git a/app/src/routes/index.tsx b/app/src/routes/index.tsx index 2528754e7..44aec1136 100644 --- a/app/src/routes/index.tsx +++ b/app/src/routes/index.tsx @@ -199,7 +199,7 @@ export function getRoutes(roles: string[], t: TFunction, userRole: UserRole): Ro title: t('Data Imports'), key: 'data-import', enabled: true, - permissions: ['WebDataImport.read'], + permissions: ['DataImport.read'], url: DATA_IMPORT_LIST_URL, isHomePageLink: true, }, diff --git a/packages/fhir-import/src/containers/ImportDetailView/index.tsx b/packages/fhir-import/src/containers/ImportDetailView/index.tsx index 89692f968..de91d3db2 100644 --- a/packages/fhir-import/src/containers/ImportDetailView/index.tsx +++ b/packages/fhir-import/src/containers/ImportDetailView/index.tsx @@ -80,6 +80,8 @@ export const ImportDetailViewDetails = (_: RouteComponentProps) => { [t('Author')]: data.author, }; + console.log({pageTitle}) + return ( diff --git a/packages/fhir-import/src/containers/ImportListView/index.tsx b/packages/fhir-import/src/containers/ImportListView/index.tsx index ce6346c2c..728ea0831 100644 --- a/packages/fhir-import/src/containers/ImportListView/index.tsx +++ b/packages/fhir-import/src/containers/ImportListView/index.tsx @@ -81,7 +81,7 @@ export const DataImportList = () => { // eslint-disable-next-line react/display-name render: (_: unknown, record: WorkflowDescription) => ( - + <> {
- +
, null, @@ -389,5 +419,15 @@ Array [ , + } + > + + Data Imports + + , ] `; diff --git a/app/src/containers/pages/Home/tests/Home.test.tsx b/app/src/containers/pages/Home/tests/Home.test.tsx index a6898b014..1363d3c60 100644 --- a/app/src/containers/pages/Home/tests/Home.test.tsx +++ b/app/src/containers/pages/Home/tests/Home.test.tsx @@ -66,6 +66,7 @@ describe('containers/pages/Home', () => { 'Location Management', 'Organization Management', 'Questionnaire Management', + 'Data Imports', ]); links.forEach((link) => { expect(link).toMatchSnapshot(link.textContent ?? undefined); diff --git a/app/src/containers/pages/Home/tests/__snapshots__/Home.test.tsx.snap b/app/src/containers/pages/Home/tests/__snapshots__/Home.test.tsx.snap index d9c45804b..1c2f9da1a 100644 --- a/app/src/containers/pages/Home/tests/__snapshots__/Home.test.tsx.snap +++ b/app/src/containers/pages/Home/tests/__snapshots__/Home.test.tsx.snap @@ -1,5 +1,16 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`containers/pages/Home renders Home correctly & changes Title of page 2: Data Imports 1`] = ` + +`; + exports[`containers/pages/Home renders Home correctly & changes Title of page 2: Location Management 1`] = `