Skip to content

Commit 360bb76

Browse files
committed
Merge branch 'main' of github.com:openmrs/openmrs-esm-core
2 parents 0d3f54a + d3a5bf3 commit 360bb76

File tree

14 files changed

+228
-46
lines changed

14 files changed

+228
-46
lines changed

.github/workflows/e2e.yml

Lines changed: 86 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
- 'example.env'
4646
- '.github/workflows/e2e.yml'
4747
48-
main:
48+
run-e2e-on-esm-core:
4949
needs: changes
5050
if: ${{ needs.changes.outputs.test-changes == 'true' }}
5151

@@ -74,35 +74,111 @@ jobs:
7474
- name: Install dependencies
7575
run: yarn install --immutable
7676

77+
- name: Setup local cache server for Turborepo
78+
uses: felixmosh/turborepo-gh-artifacts@v3
79+
with:
80+
repo-token: ${{ secrets.GITHUB_TOKEN }}
81+
server-token: ${{ env.TURBO_TOKEN }}
82+
83+
- name: Build apps
84+
run: yarn turbo run build --color --concurrency=5
85+
86+
- name: Run dev server
87+
run: bash e2e/support/github/run-e2e-docker-env.sh
88+
89+
- name: Copy test environment variables
90+
run: cp example.env .env
91+
7792
- name: Install Playwright Browsers
78-
run: yarn playwright install chromium --with-deps
93+
run: npx playwright install chromium --with-deps
94+
95+
- name: Wait for the OpenMRS instance to start
96+
run: while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:8080/openmrs/login.htm)" != "200" ]]; do sleep 10; done
97+
98+
- name: Run E2E tests
99+
run: yarn playwright test
100+
101+
- name: Upload Report
102+
uses: actions/upload-artifact@v4
103+
if: always()
104+
with:
105+
name: report-esm-core
106+
path: playwright-report/
107+
retention-days: 30
108+
109+
110+
run-e2e-on-other-repos:
111+
needs: changes
112+
if: ${{ needs.changes.outputs.test-changes == 'true' }}
113+
runs-on: ubuntu-latest
114+
strategy:
115+
matrix:
116+
repo:
117+
- openmrs-esm-patient-management
118+
- openmrs-esm-patient-chart
119+
- openmrs-esm-form-builder
120+
121+
steps:
122+
- name: Checkout esm-core repo
123+
uses: actions/checkout@v4
124+
125+
- name: Setup node
126+
uses: actions/setup-node@v4
127+
with:
128+
node-version: 18
129+
130+
- name: Cache dependencies
131+
id: cache
132+
uses: actions/cache@v4
133+
with:
134+
path: '**/node_modules'
135+
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
79136

80137
- name: Setup local cache server for Turborepo
81138
uses: felixmosh/turborepo-gh-artifacts@v3
82139
with:
83140
repo-token: ${{ secrets.GITHUB_TOKEN }}
84141
server-token: ${{ env.TURBO_TOKEN }}
85142

143+
- name: Install dependencies
144+
run: yarn install --immutable
145+
86146
- name: Build apps
87147
run: yarn turbo run build --color --concurrency=5
88148

89149
- name: Run dev server
90150
run: bash e2e/support/github/run-e2e-docker-env.sh
91151

92-
- name: Wait for OpenMRS instance to start
152+
- name: Checkout to the ${{ matrix.repo }} main branch
153+
uses: actions/checkout@v4
154+
with:
155+
repository: openmrs/${{ matrix.repo }}
156+
ref: main
157+
path: e2e_repo
158+
159+
- name: Copy test environment variables
160+
run: cp example.env .env
161+
working-directory: e2e_repo
162+
163+
- name: Install dependencies
164+
run: yarn install --immutable
165+
working-directory: e2e_repo
166+
167+
- name: Install Playwright Browsers
168+
run: npx playwright install chromium --with-deps
169+
working-directory: e2e_repo
170+
171+
- name: Wait for the OpenMRS instance to start
93172
run: while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:8080/openmrs/login.htm)" != "200" ]]; do sleep 10; done
94173

95174
- name: Run E2E tests
96175
run: yarn playwright test
176+
working-directory: e2e_repo
97177

98-
- name: Stop dev server
99-
if: '!cancelled()'
100-
run: docker stop $(docker ps -a -q)
101-
102-
- name: Upload report
178+
- name: Upload Report
103179
uses: actions/upload-artifact@v4
104180
if: always()
105181
with:
106-
name: playwright-report
107-
path: playwright-report/
182+
name: report-${{ matrix.repo }}
183+
path: e2e_repo/playwright-report/
108184
retention-days: 30

e2e/support/github/.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# .dockerignore
2+
node_modules

e2e/support/github/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ WORKDIR /app
88

99
COPY . .
1010

11-
RUN npm_config_legacy_peer_deps=true npm install -g openmrs@${APP_SHELL_VERSION:-next}
1211
ARG CACHE_BUST
13-
RUN npm_config_legacy_peer_deps=true openmrs assemble --manifest --mode config --config spa-assemble-config.json --target ./spa
12+
13+
RUN yarn install
14+
RUN npm_config_legacy_peer_deps=true node packages/tooling/openmrs/dist/cli.js assemble --manifest --mode config --config spa-assemble-config.json --target ./spa
15+
RUN npm_config_legacy_peer_deps=true node packages/tooling/openmrs/dist/cli.js build --target ./spa
16+
1417

1518
FROM --platform=$BUILDPLATFORM openmrs/openmrs-reference-application-3-frontend:nightly as frontend
1619
FROM nginx:1.23-alpine
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
backend_container_id=$(docker ps --filter "name=backend" --format "{{.ID}}")
4+
db_container_id=$(docker ps --filter "name=db" --format "{{.ID}}")
5+
frontend_container_id=$(docker ps --filter "name=frontend" --format "{{.ID}}")
6+
gateway_container_id=$(docker ps --filter "name=gateway" --format "{{.ID}}")
7+
8+
docker commit $frontend_container_id frontend
9+
docker commit $gateway_container_id gateway
10+
docker commit $backend_container_id backend
11+
docker commit $db_container_id db
12+
13+
docker save frontend > e2e_release_env_images.tar
14+
docker save frontend gateway backend db > e2e_release_env_images.tar
15+
16+
# compress the file (to decrease the upload file size)
17+
gzip -c e2e_release_env_images.tar > e2e_release_env_images.tar.gz

e2e/support/github/docker-compose.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,25 @@ version: "3.7"
44

55
services:
66
gateway:
7+
container_name: gateway
78
image: openmrs/openmrs-reference-application-3-gateway:${TAG:-nightly}
89
ports:
910
- "8080:80"
1011

1112
frontend:
13+
container_name: frontend
1214
build:
1315
context: .
1416
environment:
1517
SPA_PATH: /openmrs/spa
1618
API_URL: /openmrs
1719

1820
backend:
21+
container_name: backend
1922
image: openmrs/openmrs-reference-application-3-backend:nightly-with-data
2023
depends_on:
2124
- db
2225

2326
db:
27+
container_name: db
2428
image: openmrs/openmrs-reference-application-3-db:nightly-with-data

e2e/support/github/run-e2e-docker-env.sh

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
# get the dir containing the script
44
script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
5+
repository_root="$script_dir/../../../."
56
# create a temporary working directory
67
working_dir=$(mktemp -d "${TMPDIR:-/tmp/}openmrs-e2e-frontends.XXXXXXXXXX")
8+
echo $working_dir
79
# get a list of all the apps in this workspace
810
apps=$(yarn workspaces list --json | jq -r 'if .location | test("-app$") then .name else empty end')
911
# this array will hold all of the packed app names
@@ -20,7 +22,7 @@ do
2022
# run yarn pack for our app and add it to the working directory
2123
yarn workspace "$app" pack -o "$working_dir/$app_name.tgz" >/dev/null;
2224
done;
23-
echo "Created packed app archives"
25+
echo "Created packed app archives"
2426

2527
echo "Creating dynamic spa-assemble-config.json..."
2628
# dynamically assemble our list of frontend modules, prepending the
@@ -29,17 +31,64 @@ echo "Creating dynamic spa-assemble-config.json..."
2931
jq -n \
3032
--arg apps "$apps" \
3133
--arg app_names "$(echo ${app_names[@]})" \
32-
'(
34+
'{
35+
"@openmrs/esm-active-visits-app": "next",
36+
"@openmrs/esm-appointments-app": "next",
37+
"@openmrs/esm-cohort-builder-app": "next",
38+
"@openmrs/esm-devtools-app": "next",
39+
"@openmrs/esm-dispensing-app": "next",
40+
"@openmrs/esm-fast-data-entry-app": "next",
41+
"@openmrs/esm-form-builder-app": "next",
42+
"@openmrs/esm-form-engine-app": "next",
43+
"@openmrs/esm-generic-patient-widgets-app": "next",
44+
"@openmrs/esm-home-app": "next",
45+
"@openmrs/esm-laboratory-app": "next",
46+
"@openmrs/esm-openconceptlab-app": "next",
47+
"@openmrs/esm-patient-allergies-app": "next",
48+
"@openmrs/esm-patient-attachments-app": "next",
49+
"@openmrs/esm-patient-banner-app": "next",
50+
"@openmrs/esm-patient-chart-app": "next",
51+
"@openmrs/esm-patient-conditions-app": "next",
52+
"@openmrs/esm-patient-flags-app": "next",
53+
"@openmrs/esm-patient-forms-app": "next",
54+
"@openmrs/esm-patient-immunizations-app": "next",
55+
"@openmrs/esm-patient-labs-app": "next",
56+
"@openmrs/esm-patient-list-management-app": "next",
57+
"@openmrs/esm-patient-lists-app": "next",
58+
"@openmrs/esm-patient-medications-app": "next",
59+
"@openmrs/esm-patient-notes-app": "next",
60+
"@openmrs/esm-patient-orders-app": "next",
61+
"@openmrs/esm-patient-programs-app": "next",
62+
"@openmrs/esm-patient-registration-app": "next",
63+
"@openmrs/esm-patient-search-app": "next",
64+
"@openmrs/esm-patient-vitals-app": "next",
65+
"@openmrs/esm-service-queues-app": "next",
66+
"@openmrs/esm-system-admin-app": "next"
67+
} + (
3368
($apps | split("\n")) as $apps | ($app_names | split(" ") | map("/app/" + .)) as $app_files
3469
| [$apps, $app_files]
3570
| transpose
3671
| map({"key": .[0], "value": .[1]})
3772
| from_entries
3873
)' | jq '{"frontendModules": .}' > "$working_dir/spa-assemble-config.json"
74+
3975
echo "Created dynamic spa-assemble-config.json"
4076

77+
echo "Copying tooling, shell and framework..."
78+
mkdir -p "$working_dir/packages"
79+
mkdir -p "$working_dir/packages/tooling"
80+
81+
cp -r "$repository_root/.yarn" "$working_dir/.yarn"
82+
cp -r "$repository_root/.yarnrc.yml" "$working_dir/.yarnrc.yml"
83+
cp -r "$repository_root/packages/tooling" "$working_dir/packages"
84+
cp -r "$repository_root/packages/shell" "$working_dir/packages"
85+
cp -r "$repository_root/packages/framework" "$working_dir/packages"
86+
cp "$repository_root/package.json" "$working_dir/package.json"
87+
cp "$repository_root/yarn.lock" "$working_dir/yarn.lock"
88+
4189
echo "Copying Docker configuration..."
4290
cp "$script_dir/Dockerfile" "$working_dir/Dockerfile"
91+
cp "$script_dir/.dockerignore" "$working_dir/.dockerignore"
4392
cp "$script_dir/docker-compose.yml" "$working_dir/docker-compose.yml"
4493

4594
cd $working_dir

packages/framework/esm-framework/docs/API.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5777,7 +5777,7 @@ This component also provides everything needed for workspace notifications to be
57775777

57785778
#### Defined in
57795779

5780-
[packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx:67](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx#L67)
5780+
[packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx:68](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx#L68)
57815781

57825782
___
57835783

@@ -7214,7 +7214,9 @@ with the key "webservices.rest.maxResultsDefault". See: https://openmrs.atlassia
72147214

72157215
This hook fetches data from a paginated rest endpoint, initially by fetching the first page of the results.
72167216
It provides a callback to load data from subsequent pages as needed. This hook is intended to serve UIs that
7217-
provide infinite loading / scrolling of results.
7217+
provide infinite loading / scrolling of results. Unlike `useOpenmrsPagination`, this hook does not allow random access
7218+
(and lazy-loading) of any arbitrary page; rather, it fetches pages sequentially starting form the initial page, and the next page
7219+
is fetched by calling `loadMore`. See: https://swr.vercel.app/docs/pagination#useswrinfinite
72187220

72197221
**`see`** `useOpenmrsPagination`
72207222

@@ -7243,7 +7245,7 @@ a UseServerInfiniteReturnObject object
72437245

72447246
#### Defined in
72457247

7246-
[packages/framework/esm-react-utils/src/useOpenmrsInfinite.ts:97](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useOpenmrsInfinite.ts#L97)
7248+
[packages/framework/esm-react-utils/src/useOpenmrsInfinite.ts:99](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useOpenmrsInfinite.ts#L99)
72477249

72487250
___
72497251

@@ -7385,7 +7387,7 @@ ___
73857387

73867388
### age
73877389

7388-
▸ **age**(`birthDate`, `currentDate?`): `string`
7390+
▸ **age**(`birthDate`, `currentDate?`): `string` \| ``null``
73897391

73907392
Gets a human readable and locale supported representation of a person's age, given their birthDate,
73917393
The representation logic follows the guideline here:
@@ -7396,12 +7398,12 @@ https://webarchive.nationalarchives.gov.uk/ukgwa/20160921162509mp_/http://system
73967398

73977399
| Name | Type | Description |
73987400
| :------ | :------ | :------ |
7399-
| `birthDate` | `undefined` \| ``null`` \| `string` \| `number` \| `Date` \| `Dayjs` | The birthDate. |
7401+
| `birthDate` | `undefined` \| ``null`` \| `string` \| `number` \| `Date` \| `Dayjs` | The birthDate. If birthDate is null, returns null. |
74007402
| `currentDate` | `undefined` \| ``null`` \| `string` \| `number` \| `Date` \| `Dayjs` | Optional. If provided, calculates the age of the person at the provided currentDate (instead of now). |
74017403

74027404
#### Returns
74037405

7404-
`string`
7406+
`string` \| ``null``
74057407

74067408
A human-readable string version of the age.
74077409

packages/framework/esm-framework/docs/interfaces/WorkspaceContainerProps.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#### Defined in
2121

22-
[packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx:19](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx#L19)
22+
[packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx:20](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx#L20)
2323

2424
___
2525

@@ -29,7 +29,7 @@ ___
2929

3030
#### Defined in
3131

32-
[packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx:16](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx#L16)
32+
[packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx:17](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx#L17)
3333

3434
___
3535

@@ -39,7 +39,7 @@ ___
3939

4040
#### Defined in
4141

42-
[packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx:17](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx#L17)
42+
[packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx:18](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx#L18)
4343

4444
___
4545

@@ -49,4 +49,4 @@ ___
4949

5050
#### Defined in
5151

52-
[packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx:18](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx#L18)
52+
[packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx:19](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx#L19)

packages/framework/esm-styleguide/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"i18next": "21.x",
6060
"react": "18.x",
6161
"react-dom": "18.x",
62+
"react-i18next": "11.x",
6263
"rxjs": "6.x"
6364
},
6465
"devDependencies": {

packages/framework/esm-styleguide/src/workspaces/container/workspace-container.component.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import ActionMenu from './action-menu.component';
1111
import { type OpenWorkspace, updateWorkspaceWindowState, useWorkspaces } from '../workspaces';
1212
import { WorkspaceRenderer } from './workspace-renderer.component';
1313
import styles from './workspace.module.scss';
14+
import { useTranslation } from 'react-i18next';
1415

1516
export interface WorkspaceContainerProps {
1617
contextKey: string;
@@ -125,6 +126,7 @@ interface WorkspaceProps {
125126
}
126127

127128
function Workspace({ workspaceInstance, additionalWorkspaceProps }: WorkspaceProps) {
129+
const { t } = useTranslation(workspaceInstance.moduleName);
128130
const layout = useLayoutType();
129131
const { workspaceWindowState } = useWorkspaces();
130132
const isMaximized = workspaceWindowState === 'maximized';
@@ -160,7 +162,7 @@ function Workspace({ workspaceInstance, additionalWorkspaceProps }: WorkspacePro
160162
{!isDesktop(layout) && !canHide && (
161163
<HeaderMenuButton renderMenuIcon={<ArrowLeftIcon />} onClick={closeWorkspace} />
162164
)}
163-
<HeaderName prefix="">{workspaceInstance.titleNode ?? workspaceInstance.title}</HeaderName>
165+
<HeaderName prefix="">{workspaceInstance.titleNode ?? t(workspaceInstance.title)}</HeaderName>
164166
<div className={styles.overlayHeaderSpacer} />
165167
<HeaderGlobalBar className={styles.headerButtons}>
166168
<ExtensionSlot

0 commit comments

Comments
 (0)