Skip to content

Commit

Permalink
Env clean up (#1306)
Browse files Browse the repository at this point in the history
* Fix package version in a few packages

* Cleanup lenvs

* Fix test regression
  • Loading branch information
peterMuriuki authored Dec 1, 2023
1 parent 5c9f688 commit 63b4746
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 102 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/automation-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 0 additions & 2 deletions app/src/App/fhir-apps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ import {
NewEditLocationUnit as FHIRNewEditLocationUnit,
} from '@opensrp/fhir-location-management';
import {
teamAssignmentProps,
teamAffiliationProps,
editLocationProps,
newLocationUnitProps,
Expand Down Expand Up @@ -305,7 +304,6 @@ const FHIRApps = () => {
disableLoginProtection={DISABLE_LOGIN_PROTECTION}
exact
path={URL_TEAMS}
{...teamAssignmentProps}
permissions={['Organization.read']}
component={FhirTeamsList}
/>
Expand Down
54 changes: 3 additions & 51 deletions app/src/App/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,23 @@ 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 = {
baseURL: OPENSRP_API_BASE_URL,
fhirBaseURL: FHIR_API_BASE_URL,
};

export const teamAssignmentProps = {
defaultPlanId: DEFAULT_PLAN_ID,
};

export const teamAffiliationProps = {
fhirRootLocationId: FHIR_ROOT_LOCATION_ID,
};
Expand All @@ -52,7 +35,6 @@ export const teamManagementProps = {
};

export const locationUnitProps = {
filterByParentId: FILTER_BY_PARENT_ID,
fhirRootLocationId: FHIR_ROOT_LOCATION_ID,
};

Expand Down Expand Up @@ -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,
};

Expand Down
6 changes: 2 additions & 4 deletions app/src/configs/__mocks__/env.ts
Original file line number Diff line number Diff line change
@@ -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'];
Expand Down Expand Up @@ -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;
8 changes: 0 additions & 8 deletions app/src/configs/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
10 changes: 3 additions & 7 deletions app/src/configs/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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;
25 changes: 4 additions & 21 deletions docker/config.js.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,57 +16,40 @@ 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" }}",
REACT_APP_FHIR_ROOT_LOCATION_ID: "{{ getv "react/app/fhir/root/location/id" "" }}",
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" }}",
};
2 changes: 1 addition & 1 deletion packages/fhir-location-management/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/location-management/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 63b4746

Please sign in to comment.