Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/routes-in-devtools
Browse files Browse the repository at this point in the history
  • Loading branch information
ibacher committed Dec 4, 2023
2 parents 562f529 + 4c8a8fb commit 5b3d361
Show file tree
Hide file tree
Showing 36 changed files with 152 additions and 145 deletions.
54 changes: 23 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
:wave: New to our project? Be sure to review the [OpenMRS 3 Frontend Developer Documentation](https://openmrs.github.io/openmrs-esm-core/#/). You may find the [Map of the Project](https://openmrs.github.io/openmrs-esm-core/#/main/map) especially helpful.

:wave: New to our project? Be sure to review the [OpenMRS 3 Frontend Developer Documentation](https://o3-docs.openmrs.org/). You may find the [Introduction](https://o3-docs.openmrs.org/docs/introduction) especially helpful.

Also see the [API documentation](./packages/framework/esm-framework/docs/API.md)
for `@openmrs/esm-framework`, which is contained in this repository.


![OpenMRS CI](https://github.com/openmrs/openmrs-esm-core/workflows/OpenMRS%20CI/badge.svg)
![Check documentation](https://github.com/openmrs/openmrs-esm-core/actions/workflows/docs.yml/badge.svg)


Below is the documentation for this repository.

# OpenMRS Frontend Core
Expand Down Expand Up @@ -152,21 +149,19 @@ yarn turbo test --force

### Linking the framework

If you want to try out changes to a framework library, you will
probably want to `yarn link` or `npm link` it into a frontend module.
Note that even though frontend modules import from `@openmrs/esm-framework`,
the package you need to link is the sub-library; for example, if you are trying
to test changes in `packages/framework/esm-api`, you will need to link it:
If you want to try out changes to a framework library, you will probably want to `yarn link` or `npm link` it into a frontend module.
Note that even though frontend modules import from `@openmrs/esm-framework`, the package you need to link is the sub-library; for example, if you are trying to test changes in `packages/framework/esm-api`, you will need to link it:

```
```sh
yarn link path/to/openmrs-esm-core/packages/framework/esm-framework
yarn link path/to/openmrs-esm-core/packages/framework/esm-api
```

This satisfies the build tooling, but we must do one more step to get the frontend
to load these dependencies at runtime
(see docs on [Runtime Dependencies](https://o3-dev.docs.openmrs.org/#/main/deps)).
Here, there are two options.

Here, there are two options:

#### Method 1: Using the frontend dev server

Expand All @@ -185,40 +180,37 @@ If you're not able to get this working, try the
Read the [dev documentation](https://o3-dev.docs.openmrs.org/#/getting_started/setup?id=import-map-overrides)
about import map overrides if you have not already.

In `esm-core`, start the app shell with `yarn run:shell`. Then, in the patient chart
repository, `cd` into whatever packages you are working on and run `yarn serve`
from there. Then use the import map override tool in the browser to tell the frontend
to load your local patient chart packages.
In `esm-core`, start the app shell with `yarn run:shell`. Then, in the patient chart repository, `cd` into whatever packages you are working on and run `yarn serve` from there. Then use the import map override tool in the browser to tell the frontend to load your local patient chart packages.

#### Once it's working

Please note that this will result in entries being added to the package.json file
in the `resolutions` field. These changes must be undone before creating your PR,
which you can do by running `yarn unlink --all` in the patient chart repo.
Please note that this will result in entries being added to the package.json file in the `resolutions` field. These changes must be undone before creating your PR, which you can do by running `yarn unlink --all` in the patient chart repo.

Check your work by adding a `console.log` at the top level of a file you're
working on in `esm-api`.
Check your work by adding a `console.log` at the top level of a file you're working on in `esm-api`.

### Version and release

We use Yarn [workspaces](https://yarnpkg.com/features/workspaces) to handle versioning in this monorepo.

To increment the version, run the following command:

```sh
yarn release
yarn release [version]
```

You will need to pick the next version number. We use minor changes (e.g. `3.2.0``3.3.0`)
to indicate big new features and breaking changes, and patch changes (e.g. `3.2.0``3.2.1`)
otherwise.
Where version corresponds to:

- `patch` for bug fixes e.g. `3.2.0``3.2.1`
- `minor` for new features that are backwards-compatible e.g `3.2.0``3.3.0`
- `major` for breaking changes e.g. `3.2.0``4.0.0`

Note that this command will not create a new tag, nor publish the packages. After running it, make a PR or merge to `main` with the resulting changeset. Note that the release commit message must resemble `(chore) Release vx.x.x` where `x.x.x` is the new version number prefixed with `v`.

This is because we don't want to trigger a pre-release build when effecting a version bump.

Note that this command will not create a new tag, nor publish the packages.
After running it, make a PR or merge to `main` with the resulting changeset.
Once the version bump commit is merged, go to GitHub and [draft a new release](https://github.com/openmrs/openmrs-esm-core/releases/new).

Once the version bump is merged, go to GitHub and
[draft a new release](https://github.com/openmrs/openmrs-esm-core/releases/new).
The tag should be prefixed with `v` (e.g., `v3.2.1`), while the release title
should just be the version number (e.g., `3.2.1`). The creation of the GitHub release
will cause GitHub Actions to publish the packages, completing the release process.
The tag should be prefixed with `v` (e.g., `v3.2.1`), while the release title should just be the version number (e.g., `3.2.1`). The creation of the GitHub release will cause GitHub Actions to publish the packages, completing the release process.

> Don't run `npm publish`, `yarn publish`, or `lerna publish`. Use the above process.
Expand Down
33 changes: 5 additions & 28 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,13 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="1; url=https://o3-docs.openmrs.org/">
<title>OpenMRS Frontend 3.0 Documentation for Developers</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="description" content="Description">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<link rel="icon" href="openmrs.svg">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-simple.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/themes/prism.css">
</head>
<body>
<div id="app"></div>
<script src="//cdn.jsdelivr.net/npm/docsify-edit-on-github"></script>
<script>
window.$docsify = {
name: 'Frontend 3.0 for Developers',
logo: 'logo.png',
repo: 'openmrs/openmrs-esm-core',
auto2top: true,
loadSidebar: true,
subMaxLevel: 1,
relativePath: true,
plugins: [
EditOnGithubPlugin.create("https://github.com/openmrs/openmrs-esm-core/edit/main/docs/")
]
}
window.location.href = "https://o3-docs.openmrs.org/"
</script>
<script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
<script src="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/js/docsify-themeable.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-typescript.min.js"></script>
<script src="//unpkg.com/docsify-pagination/dist/docsify-pagination.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/search.min.js"></script>
</head>
<body>
These docs have been moved.. If you are not redirected automatically, follow this <a href="https://o3-docs.openmrs.org/">link to the updated docs</a>.
</body>
</html>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openmrs/esm-core",
"version": "5.3.0",
"version": "5.3.1",
"private": true,
"workspaces": [
"packages/apps/*",
Expand Down
8 changes: 4 additions & 4 deletions packages/apps/esm-devtools-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openmrs/esm-devtools-app",
"version": "5.3.0",
"version": "5.3.1",
"license": "MPL-2.0",
"description": "Dev tools for frontend devs using OpenMRS",
"browser": "dist/openmrs-esm-devtools-app.js",
Expand Down Expand Up @@ -44,15 +44,15 @@
"rxjs": "6.x"
},
"devDependencies": {
"@openmrs/esm-framework": "^5.3.0",
"@openmrs/webpack-config": "^5.3.0",
"@openmrs/esm-framework": "^5.3.1",
"@openmrs/webpack-config": "^5.3.1",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-i18next": "^11.18.6",
"webpack": "^5.88.0"
},
"dependencies": {
"@carbon/react": "^1.37.0",
"@carbon/react": "~1.37.0",
"fuzzy": "^0.1.3"
}
}
8 changes: 4 additions & 4 deletions packages/apps/esm-implementer-tools-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openmrs/esm-implementer-tools-app",
"version": "5.3.0",
"version": "5.3.1",
"license": "MPL-2.0",
"description": "The admin interface for OpenMRS Frontend",
"browser": "dist/openmrs-esm-implementer-tools-app.js",
Expand Down Expand Up @@ -38,7 +38,7 @@
"access": "public"
},
"dependencies": {
"@carbon/react": "^1.37.0",
"@carbon/react": "~1.37.0",
"lodash-es": "^4.17.21"
},
"peerDependencies": {
Expand All @@ -50,8 +50,8 @@
"swr": "2.x"
},
"devDependencies": {
"@openmrs/esm-framework": "^5.3.0",
"@openmrs/webpack-config": "^5.3.0",
"@openmrs/esm-framework": "^5.3.1",
"@openmrs/webpack-config": "^5.3.1",
"ace-builds": "^1.4.14",
"react": "^18.1.0",
"react-ace": "^9.5.0",
Expand Down
8 changes: 4 additions & 4 deletions packages/apps/esm-login-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openmrs/esm-login-app",
"version": "5.3.0",
"version": "5.3.1",
"license": "MPL-2.0",
"description": "The login microfrontend for the OpenMRS SPA",
"browser": "dist/openmrs-esm-login-app.js",
Expand Down Expand Up @@ -38,7 +38,7 @@
"access": "public"
},
"dependencies": {
"@carbon/react": "^1.37.0",
"@carbon/react": "~1.37.0",
"lodash-es": "^4.17.21"
},
"peerDependencies": {
Expand All @@ -51,8 +51,8 @@
"swr": "2.x"
},
"devDependencies": {
"@openmrs/esm-framework": "^5.3.0",
"@openmrs/webpack-config": "^5.3.0",
"@openmrs/esm-framework": "^5.3.1",
"@openmrs/webpack-config": "^5.3.1",
"jest": "^29.7.0",
"react": "^18.1.0",
"react-dom": "^18.1.0",
Expand Down
30 changes: 20 additions & 10 deletions packages/apps/esm-login-app/src/login/login.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,30 @@ const Login: React.FC<LoginProps> = () => {
[config?.links?.loginSuccess, location.state, navigate]
);

const handleUpdateSessionStore = useCallback(() => {
refetchCurrentUser().then(() => {
const authenticated = getSessionStore().getState().session.authenticated;
if (authenticated) {
handleLogin(getSessionStore().getState().session);
}
});
}, [handleLogin]);

useEffect(() => {
if (user) {
clearCurrentUser();
refetchCurrentUser().then(() => {
const authenticated =
getSessionStore().getState().session.authenticated;
if (authenticated) {
handleLogin(getSessionStore().getState().session);
}
});
handleUpdateSessionStore();
} else if (!username && location.pathname === "/login/confirm") {
navigate("/login", { state: location.state });
}
}, [username, navigate, location, user, handleLogin]);
}, [
username,
navigate,
location,
user,
handleLogin,
handleUpdateSessionStore,
]);

useEffect(() => {
const field = showPassword
Expand Down Expand Up @@ -142,7 +152,7 @@ const Login: React.FC<LoginProps> = () => {
const valid = authData && authData.authenticated;

if (valid) {
handleLogin(authData);
handleUpdateSessionStore();
} else {
throw new Error("invalidCredentials");
}
Expand All @@ -160,7 +170,7 @@ const Login: React.FC<LoginProps> = () => {
continueLogin,
username,
password,
handleLogin,
handleUpdateSessionStore,
resetUserNameAndPassword,
]
);
Expand Down
5 changes: 4 additions & 1 deletion packages/apps/esm-login-app/src/logout/logout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

.logout {
padding-right: 0rem;
@include brand-02(background-color);
@extend .productiveHeading01;
width: 16rem;

&:hover {
@include brand-01(background-color);
}
}
8 changes: 4 additions & 4 deletions packages/apps/esm-offline-tools-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openmrs/esm-offline-tools-app",
"version": "5.3.0",
"version": "5.3.1",
"license": "MPL-2.0",
"description": "The offline tools microfrontend for the OpenMRS SPA",
"browser": "dist/openmrs-esm-offline-tools-app.js",
Expand Down Expand Up @@ -38,7 +38,7 @@
"access": "public"
},
"dependencies": {
"@carbon/react": "^1.37.0",
"@carbon/react": "~1.37.0",
"lodash-es": "^4.17.21",
"swr": "^2.2.2"
},
Expand All @@ -52,8 +52,8 @@
"swr": "2.x"
},
"devDependencies": {
"@openmrs/esm-framework": "^5.3.0",
"@openmrs/webpack-config": "^5.3.0",
"@openmrs/esm-framework": "^5.3.1",
"@openmrs/webpack-config": "^5.3.1",
"@types/lodash-es": "^4.17.5",
"jest": "^29.7.0",
"react": "^18.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,18 @@ const OfflineActionsModeButton: React.FC = () => {

return (
<div className={styles.offlineModeButtonContainer}>
<Network_3 size={20} />
<div onClick={doNotCloseMenu} role="none">
<span>{t("offlineReady", "Offline Ready")}</span>
<Toggle
className={styles.toggle}
id="offlineModeSwitch"
toggled={active}
onToggle={toggle}
/>
<div>
<Network_3 size={20} />
<span onClick={doNotCloseMenu} role="none">
{t("offlineReady", "Offline Ready")}
</span>
</div>
<Toggle
className={styles.toggle}
id="offlineModeSwitch"
toggled={active}
onToggle={toggle}
/>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
display: flex;
flex-direction: row;
width: 16rem;
justify-content: flex-start;
justify-content: space-between;
color: $field-01;
align-items: center;
@extend .bodyLong01;
Expand All @@ -17,7 +17,7 @@
}

:global(.cds--toggle) {
margin: 0 0 1rem 1rem;
margin: 0 1rem;
}

:global(.cds--toggle__text) {
Expand Down
Loading

0 comments on commit 5b3d361

Please sign in to comment.