From 63b4746e55bd7966373f62ba4033de1ec8f36935 Mon Sep 17 00:00:00 2001 From: Peter Muriuki Date: Fri, 1 Dec 2023 16:59:03 +0300 Subject: [PATCH] Env clean up (#1306) * Fix package version in a few packages * Cleanup lenvs * Fix test regression --- .github/workflows/automation-ci.yml | 3 -- app/package.json | 2 +- app/src/App/fhir-apps.tsx | 2 - app/src/App/utils.tsx | 54 ++----------------- app/src/configs/__mocks__/env.ts | 6 +-- app/src/configs/env.ts | 8 --- app/src/configs/settings.ts | 10 ++-- docker/config.js.tmpl | 25 ++------- .../fhir-location-management/package.json | 2 +- packages/location-management/package.json | 2 +- yarn.lock | 6 +-- 11 files changed, 18 insertions(+), 102 deletions(-) diff --git a/.github/workflows/automation-ci.yml b/.github/workflows/automation-ci.yml index 6b288a255..99406cb73 100644 --- a/.github/workflows/automation-ci.yml +++ b/.github/workflows/automation-ci.yml @@ -85,7 +85,6 @@ jobs: REACT_APP_ENABLE_LOCATIONS=true REACT_APP_ENABLE_FHIR_LOCATIONS=true REACT_APP_ENABLE_CARD_SUPPORT=true - REACT_APP_ENABLE_TEAMS=true REACT_APP_ENABLE_FHIR_PATIENTS=true REACT_APP_ENABLE_TEAMS_ASSIGNMENT_MODULE=true REACT_APP_ENABLE_FORM_CONFIGURATION=true @@ -96,7 +95,6 @@ jobs: REACT_APP_ENABLE_FHIR_GROUP=false REACT_APP_ENABLE_FHIR_PRACTITIONER_ROLE=true REACT_APP_PAGINATION_SIZE=1000 - REACT_APP_ENABLE_SERVER_SETTINGS=false REACT_APP_OPENSRP_WEB_VERSION=$npm_package_version REACT_APP_DEPLOYMENT_ENVIRONMENT=production REACT_APP_ENABLE_FHIR_ORGANIZATION=true @@ -105,7 +103,6 @@ jobs: REACT_APP_FHIR_PATIENT_SORT_FIELDS=-_lastUpdated REACT_APP_FHIR_PATIENT_BUNDLE_SIZE=5000 REACT_APP_ENABLE_FHIR_HEALTHCARE_SERVICES=false - REACT_APP_ENABLE_USER_MANAGEMENT=true REACT_APP_ENABLE_FHIR_COMMODITY=true REACT_APP_ENABLE_QUEST=true EOF diff --git a/app/package.json b/app/package.json index ef839aadb..5163622b0 100644 --- a/app/package.json +++ b/app/package.json @@ -29,7 +29,7 @@ "@opensrp/react-utils": "^0.0.12", "@opensrp/reducer-factory": "^0.0.13", "@opensrp/server-logout": "^0.0.2", - "@opensrp/server-service": "^0.0.16", + "@opensrp/server-service": "^0.0.17", "@opensrp/store": "^0.0.10", "@sentry/react": "^5.27.4", "antd": "^5.5.2", diff --git a/app/src/App/fhir-apps.tsx b/app/src/App/fhir-apps.tsx index 60831e100..7e05e1926 100644 --- a/app/src/App/fhir-apps.tsx +++ b/app/src/App/fhir-apps.tsx @@ -81,7 +81,6 @@ import { NewEditLocationUnit as FHIRNewEditLocationUnit, } from '@opensrp/fhir-location-management'; import { - teamAssignmentProps, teamAffiliationProps, editLocationProps, newLocationUnitProps, @@ -305,7 +304,6 @@ const FHIRApps = () => { disableLoginProtection={DISABLE_LOGIN_PROTECTION} exact path={URL_TEAMS} - {...teamAssignmentProps} permissions={['Organization.read']} component={FhirTeamsList} /> diff --git a/app/src/App/utils.tsx b/app/src/App/utils.tsx index 681576e75..44df3df86 100644 --- a/app/src/App/utils.tsx +++ b/app/src/App/utils.tsx @@ -7,29 +7,16 @@ import { URL_LOCATION_UNIT, } from '../constants'; import { - ACTION_UUID_NAMESPACE, - DATE_FORMAT, - DEFAULT_ACTIVITY_DURATION_DAYS, - DEFAULT_PLAN_DURATION_DAYS, - DEFAULT_PLAN_VERSION, - DEFAULT_TIME, OPENSRP_API_BASE_URL, OPENSRP_API_V2_BASE_URL, - PLAN_ASSIGNMENT_AT_GEO_LEVEL, - PLAN_UUID_NAMESPACE, - TASK_GENERATION_STATUS, - DEFAULT_PLAN_ID, - FHIR_API_BASE_URL, - FILTER_BY_PARENT_ID, - KEYCLOAK_USERS_PAGE_SIZE, - DISABLE_TEAM_MEMBER_REASSIGNMENT, - USER_FORM_HIDDEN_FIELDS, - USER_FORM_RENDER_FIELDS, PAGINATION_SIZE, FHIR_PATIENT_SORT_FIELDS, FHIR_PATIENT_BUNDLE_SIZE, FHIR_ROOT_LOCATION_ID, COMMODITIES_LIST_RESOURCE_ID, + DISABLE_TEAM_MEMBER_REASSIGNMENT, + FHIR_API_BASE_URL, + KEYCLOAK_USERS_PAGE_SIZE, } from '../configs/env'; export const BaseProps = { @@ -37,10 +24,6 @@ export const BaseProps = { fhirBaseURL: FHIR_API_BASE_URL, }; -export const teamAssignmentProps = { - defaultPlanId: DEFAULT_PLAN_ID, -}; - export const teamAffiliationProps = { fhirRootLocationId: FHIR_ROOT_LOCATION_ID, }; @@ -52,7 +35,6 @@ export const teamManagementProps = { }; export const locationUnitProps = { - filterByParentId: FILTER_BY_PARENT_ID, fhirRootLocationId: FHIR_ROOT_LOCATION_ID, }; @@ -111,41 +93,11 @@ export const releaseViewProps = { isJsonValidator: false, }; -export const plansListProps = { - baseURL: OPENSRP_API_BASE_URL, -}; - -export const planCreateEditProps = { - baseURL: OPENSRP_API_BASE_URL, - envConfigs: { - dateFormat: DATE_FORMAT, - defaultPlanDurationDays: DEFAULT_PLAN_DURATION_DAYS, - defaultPlanVersion: DEFAULT_PLAN_VERSION, - actionUuidNamespace: PLAN_UUID_NAMESPACE, - planUuidNamespace: ACTION_UUID_NAMESPACE, - defaultTime: DEFAULT_TIME, - defaultActivityDurationDays: DEFAULT_ACTIVITY_DURATION_DAYS, - taskGenerationStatus: TASK_GENERATION_STATUS, - }, -}; - -export const missionAssignmentProps = { - showActivateMission: true, - showAssignmentTable: true, - showMissionData: true, - assignGeoLevel: PLAN_ASSIGNMENT_AT_GEO_LEVEL, -}; - export const inventoryItemAddEditProps = { openSRPBaseURL: OPENSRP_API_BASE_URL, }; export const createEditUserProps = { - // TODO: this will not scale well, need a better configuration-first solution that enables us to - // simulate a diverse set of behaviors from the same code base for a module. preferable a solution - // that is closer to the code. - userFormHiddenFields: USER_FORM_HIDDEN_FIELDS, - userFormRenderFields: USER_FORM_RENDER_FIELDS, baseUrl: OPENSRP_API_BASE_URL, }; diff --git a/app/src/configs/__mocks__/env.ts b/app/src/configs/__mocks__/env.ts index 3b1be1abf..3b60b3d89 100644 --- a/app/src/configs/__mocks__/env.ts +++ b/app/src/configs/__mocks__/env.ts @@ -1,8 +1,6 @@ export const OPENSRP_API_BASE_URL = 'https://test.smartregister.org/opensrp/rest/'; export const KEYCLOAK_API_BASE_URL = 'https://keycloak-stage.smartregister.org/auth/admin/realms/opensrp-web-stage'; -export const ENABLE_PRODUCT_CATALOGUE = true; -export const ENABLE_INVENTORY = true; export const LANGUAGE_CODE = 'en'; export const PROJECT_LANGUAGE_CODE = 'eusm'; export const SUPPORTED_LANGUAGES = ['en', 'fr']; @@ -43,6 +41,6 @@ export const OPENSRP_WEB_VERSION = ''; export const ENABLE_QUEST = true; -export const ENABLE_USER_MANAGEMENT = true; - export const BACKEND_ACTIVE = false; + +export const ENABLE_FHIR_USER_MANAGEMENT = true; diff --git a/app/src/configs/env.ts b/app/src/configs/env.ts index 2d8059a65..89dc5f175 100644 --- a/app/src/configs/env.ts +++ b/app/src/configs/env.ts @@ -10,14 +10,6 @@ export const OPENSRP_OAUTH_SCOPES = setEnv('REACT_APP_OPENSRP_OAUTH_SCOPES', 'pr export const ENABLE_FHIR_GROUP = setEnv('REACT_APP_ENABLE_FHIR_GROUP', 'false') === 'true'; -export const DEFAULT_ACTIVITY_DURATION_DAYS = Number( - setEnv('REACT_APP_DEFAULT_ACTIVITY_DURATION_DAYS', 7) -); - -export const PLAN_ASSIGNMENT_AT_GEO_LEVEL = Number( - setEnv('REACT_APP_PLAN_ASSIGNMENT_AT_GEO_LEVEL', 0) -); - export const MAIN_LOGO_SRC = setEnv( 'REACT_APP_MAIN_LOGO_SRC', 'https://github.com/OpenSRP/web/raw/main/app/src/assets/images/opensrp-logo-color.png' diff --git a/app/src/configs/settings.ts b/app/src/configs/settings.ts index e17b0b8eb..b34f4ba1c 100644 --- a/app/src/configs/settings.ts +++ b/app/src/configs/settings.ts @@ -8,12 +8,9 @@ import { OPENSRP_OAUTH_STATE, OPENSRP_USER_URL, OPENSRP_OAUTH_SCOPES, - ENABLE_USER_MANAGEMENT, ENABLE_FHIR_USER_MANAGEMENT, - ENABLE_TEAMS, ENABLE_FHIR_TEAMS, ENABLE_FHIR_LOCATIONS, - ENABLE_LOCATIONS, } from './env'; /** Authentication Configs */ @@ -32,7 +29,6 @@ if (ENABLE_OPENSRP_OAUTH) { export { providers }; -export const COMPOSITE_ENABLE_USER_MANAGEMENT = - ENABLE_USER_MANAGEMENT || ENABLE_FHIR_USER_MANAGEMENT; -export const COMPOSITE_ENABLE_TEAM_MANAGEMENT = ENABLE_TEAMS || ENABLE_FHIR_TEAMS; -export const COMPOSITE_ENABLE_LOCATIONS_MANAGEMENT = ENABLE_LOCATIONS || ENABLE_FHIR_LOCATIONS; +export const COMPOSITE_ENABLE_USER_MANAGEMENT = ENABLE_FHIR_USER_MANAGEMENT; +export const COMPOSITE_ENABLE_TEAM_MANAGEMENT = ENABLE_FHIR_TEAMS; +export const COMPOSITE_ENABLE_LOCATIONS_MANAGEMENT = ENABLE_FHIR_LOCATIONS; diff --git a/docker/config.js.tmpl b/docker/config.js.tmpl index 83c5ac52c..25b8d9fa3 100644 --- a/docker/config.js.tmpl +++ b/docker/config.js.tmpl @@ -16,52 +16,31 @@ window._env_ = { REACT_APP_OPENSRP_USER_URL: "{{ getv "/react/app/opensrp/user/url" "https://opensrp-stage.smartregister.org/opensrp/user-details/" }}", REACT_APP_FHIR_API_BASE_URL: "{{ getv "/react/app/fhir/api/base/url" "https://fhir.labs.smartregister.org/fhir" }}", REACT_APP_WEBSITE_NAME: "{{ getv "/react/app/website/name" "opensrp-web" }}", - REACT_APP_ACTION_UUID_NAMESPACE: "{{ getv "/react/app/action/uuid/namespace" ""}}", - REACT_APP_PLAN_UUID_NAMESPACE: "{{ getv "/react/app/plan/uuid/namespace" ""}}", REACT_APP_ENABLE_TEAMS_ASSIGNMENT_MODULE: "{{ getv "/react/app/enable/teams/assignment/module" "false" }}", - REACT_APP_DEFAULT_HOME_MODE: "{{ getv "/react/app/default/home/mode" "default" }}", REACT_APP_ENABLE_LANGUAGE_SWITCHER: "{{ getv "/react/app/enable/language/switcher" "false" }}", REACT_APP_SUPPORTED_LANGUAGES: "{{ getv "/react/app/supported/languages" "en" }}", - REACT_APP_ENABLE_INVENTORY: "{{ getv "/react/app/enable/inventory" "false" }}", REACT_APP_PROJECT_CODE: "{{ getv "/react/app/project/code" "core" }}", REACT_APP_LANGUAGE_CODE: "{{ getv "/react/app/language/code" "en" }}", - REACT_APP_ENABLE_FORM_CONFIGURATION: "{{ getv "/react/app/enable/form/configuration" "false" }}", - REACT_APP_ENABLE_PRODUCT_CATALOGUE: "{{ getv "/react/app/enable/product/catalogue" "false" }}", - REACT_APP_DEFAULT_PLAN_ID: "{{ getv "/react/app/default/plan/id" "" }}", - REACT_APP_DEFAULT_PLAN_DURATION_DAYS: "{{ getv "/react/app/default/plan/duration/days" "30" }}", REACT_APP_DATE_FORMAT: "{{ getv "/react/app/date/format" "yyyy-MM-DD" }}", REACT_APP_MAIN_LOGO_SRC: "{{ getv "/react/app/main/logo/src" "" }}", - REACT_APP_PLAN_ASSIGNMENT_AT_GEO_LEVEL: "{{ getv "/react/app/plan/assignment/at/geo/level" "0" }}", - REACT_APP_TASK_GENERATION_STATUS: "{{ getv "/react/app/task/generation/status" "False" }}", - REACT_APP_DEFAULT_PLAN_VERSION: "{{ getv "/react/app/default/plan/version" "1" }}", - REACT_APP_DEFAULT_ACTIVITY_DURATION_DAYS: "{{ getv "/react/app/default/activity/duration/days" "30" }}", REACT_APP_OPENSRP_OAUTH_SCOPES: "{{ getv "/react/app/opensrp/oauth/scopes" "profile" }}", REACT_APP_ENABLE_LOCATIONS: "{{ getv "/react/app/enable/locations" "false" }}", REACT_APP_ENABLE_TEAMS: "{{ getv "/react/app/enable/teams" "false" }}", REACT_APP_ENABLE_PLANS: "{{ getv "/react/app/enable/plans" "false" }}", - REACT_APP_ENABLE_CARD_SUPPORT: "{{ getv "/react/app/enable/card/support" "false" }}", - REACT_APP_USER_FORM_HIDDEN_FIELDS: "{{ getv "/react/app/user/form/hidden/fields" "" }}", - REACT_APP_USER_FORM_RENDERED_FIELDS: "{{ getv "/react/app/user/form/render/fields" "" }}", REACT_APP_ENABLE_FHIR_CARE_TEAM: "{{ getv "/react/app/enable/fhir/care/team" "false" }}", REACT_APP_ENABLE_FHIR_HEALTHCARE: "{{ getv "/react/app/enable/fhir/healthcare" "false" }}", REACT_APP_ENABLE_FHIR_TEAMS: "{{ getv "/react/app/enable/fhir/teams" "false" }}", REACT_APP_ENABLE_FHIR_PATIENTS: "{{ getv "/react/app/enable/fhir/patients" "false" }}", - REACT_APP_ENABLE_USER_MANAGEMENT: "{{ getv "/react/app/enable/user/management" "false" }}", REACT_APP_ENABLE_FHIR_USER_MANAGEMENT: "{{ getv "/react/app/enable/fhir/user/management" "false" }}", - REACT_APP_PAGINATION_SIZE: "{{ getv "/react/app/pagination/size" "1000" }}", REACT_APP_FHIR_PATIENT_SORT_FIELDS: "{{ getv "/react/app/fhir/patient/sort/fields" "-_lastUpdated" }}", REACT_APP_FHIR_PATIENT_BUNDLE_SIZE: "{{ getv "/react/app/fhir/patient/bundle/size" "5000" }}", REACT_APP_FHIR_RESOURCES_PAGE_SIZE: "{{ getv "/react/app/resources/page/size" "500" }}", REACT_APP_OPENSRP_OAUTH_STATE: "{{ getv "/react/app/opensrp/oauth/state" "opensrp" }}", - REACT_APP_FILTER_BY_PARENT_ID: "{{ getv "/react/app/filter/by/parent/id" "true" }}", REACT_APP_DEFAULTS_TABLE_PAGE_SIZE: "{{ getv "/react/app/defaults/table/page/size" "5" }}", REACT_APP_KEYCLOAK_USERS_PAGE_SIZE: "{{ getv "/react/app/keycloak/users/page/size" "20" }}", REACT_APP_OPENSRP_ROLES: "{{ getv "/react/app/opensrp/roles" "" }}", REACT_APP_DISABLE_TEAM_MEMBER_REASSIGNMENT: "{{ getv "/react/app/disable/team/member/reassignment" "true" }}", - REACT_APP_USER_FORM_RENDER_FIELDS: "{{ getv "/react/app/user/form/render/fields" "" }}", REACT_APP_PAGINATION_SIZE: "{{ getv "/react/app/pagination/size" "1000" }}", - REACT_APP_ENABLE_SERVER_SETTINGS: "{{ getv "/react/app/enable/server/settings" "false" }}", - REACT_APP_OPENSRP_API_V2_BASE_URL: "{{ getv "/react/app/opensrp/api/v2/base/url" "https://opensrp-stage.smartregister.org/opensrp/rest/v2/" }}", REACT_APP_OPENSRP_WEB_VERSION: "{{ getv "/react/app/opensrp/web/version" "" }}", REACT_APP_SENTRY_CONFIG_JSON: "{{ getv "/react/app/opensrp/sentry/config/json" "" }}", REACT_APP_ENABLE_FHIR_LOCATIONS: "{{ getv "/react/app/enable/fhir/locations" "false" }}", @@ -69,4 +48,8 @@ window._env_ = { REACT_APP_ENABLE_QUEST: "{{ getv "react/app/enable/quest" "false" }}", REACT_APP_ENABLE_FHIR_HEALTHCARE_SERVICES: "{{ getv "/react/app/enable/fhir/healthcare/services" "false" }}", REACT_APP_ENABLE_FHIR_GROUP: "{{ getv "/react/app/enable/fhir/group" "false" }}", + REACT_APP_AUTHZ_STRATEGY: "{{ getv "/react/app/authz/strategy" "keycloak" }}", + REACT_APP_PRACTITIONER_TO_ORG_ASSIGNMENT_STRATEGY: "{{ getv "react/app/practitioner/to/org/assignment/strategy" "ONE_TO_MANY" }}", + REACT_APP_COMMODITIES_LIST_RESOURCE_ID: "{{ getv "react/app/commodities/list/resource/id" "" }}", + REACT_APP_ENABLE_FHIR_COMMODITY: "{{ getv "react/app/enable/fhir/commodity" "false" }}", }; diff --git a/packages/fhir-location-management/package.json b/packages/fhir-location-management/package.json index 85ff463e1..691c3f793 100644 --- a/packages/fhir-location-management/package.json +++ b/packages/fhir-location-management/package.json @@ -40,7 +40,7 @@ "@opensrp/rbac": "workspace:^", "@opensrp/react-utils": "^0.0.12", "@opensrp/reducer-factory": "^0.0.13", - "@opensrp/server-service": "^0.0.16", + "@opensrp/server-service": "^0.0.17", "cycle": "^1.0.3", "fhirclient": "^2.4.0", "tree-model": "^1.0.7", diff --git a/packages/location-management/package.json b/packages/location-management/package.json index d6017b95f..2dc7988c6 100644 --- a/packages/location-management/package.json +++ b/packages/location-management/package.json @@ -39,7 +39,7 @@ "@opensrp/rbac": "workspace:^", "@opensrp/react-utils": "^0.0.12", "@opensrp/reducer-factory": "^0.0.13", - "@opensrp/server-service": "^0.0.16", + "@opensrp/server-service": "^0.0.17", "cycle": "^1.0.3", "fast_array_intersect": "^1.1.0", "tree-model": "^1.0.7", diff --git a/yarn.lock b/yarn.lock index fb1705db0..c5ed562e8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3562,7 +3562,7 @@ __metadata: "@opensrp/rbac": "workspace:^" "@opensrp/react-utils": ^0.0.12 "@opensrp/reducer-factory": ^0.0.13 - "@opensrp/server-service": ^0.0.16 + "@opensrp/server-service": ^0.0.17 "@smile-cdr/fhirts": 1.2.5 "@types/uuid": 8.3.0 cycle: ^1.0.3 @@ -3744,7 +3744,7 @@ __metadata: "@opensrp/rbac": "workspace:^" "@opensrp/react-utils": ^0.0.12 "@opensrp/reducer-factory": ^0.0.13 - "@opensrp/server-service": ^0.0.16 + "@opensrp/server-service": ^0.0.17 "@types/geojson": ^7946.0.7 "@types/uuid": 8.3.0 cycle: ^1.0.3 @@ -4003,7 +4003,7 @@ __metadata: "@opensrp/react-utils": ^0.0.12 "@opensrp/reducer-factory": ^0.0.13 "@opensrp/server-logout": ^0.0.2 - "@opensrp/server-service": ^0.0.16 + "@opensrp/server-service": ^0.0.17 "@opensrp/store": ^0.0.10 "@sentry/react": ^5.27.4 antd: ^5.5.2