Skip to content

Commit

Permalink
Merge pull request #46 from CDC-HIS/develop
Browse files Browse the repository at this point in the history
Sync Develop to Master
  • Loading branch information
pirupius authored May 12, 2023
2 parents 6b5fdf6 + 46ae00e commit 8094239
Show file tree
Hide file tree
Showing 65 changed files with 41,983 additions and 461 deletions.
6 changes: 4 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
"@typescript-eslint",
"unused-imports"
],
"extends": ["ts-react-important-stuff", "plugin:prettier/recommended"],
"rules": {
Expand All @@ -28,7 +29,8 @@
}
]
}
]
],
"unused-imports/no-unused-imports" : "error"
}
}

80 changes: 46 additions & 34 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ name: Node.js CI

on:
push:
branches: [master,develop,etho_datepicker]
branches: [master, develop]
pull_request:
branches: [master]
branches: [master, develop]
release:
types:
- created

env:
ESM_NAME: "@openmrs/esm-ethiohri-app"
ESM_NAME: "@icap-ethiopia/esm-ethiohri-app"
JS_NAME: "openmrs-esm-ethiohri-app.js"

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
Expand All @@ -36,34 +36,33 @@ jobs:
dist
pre_release:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

needs: build

#if: ${{ github.event_name == 'push' }}
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop'}}

steps:
- run: echo "Uncomment the lines below and delete this one."
# - uses: actions/checkout@v2
# - name: Download Artifacts
# uses: actions/download-artifact@v2
# - name: Use Node.js
# uses: actions/setup-node@v1
# with:
# node-version: "16.x"
# registry-url: "https://registry.npmjs.org"
# - run: npm install
# - run: sed -i -e "s/\(\"version\":\\s\+\"\([0-9]\+\.\?\)\+\)/\1-pre.${{ github.run_number }}/" 'package.json'
# - run: npm publish --access public --tag next
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- uses: actions/checkout@v2
- name: Download Artifacts
uses: actions/download-artifact@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: "16.x"
registry-url: "https://registry.npmjs.org"
- run: yarn
- run: sed -i -e "s/\(\"version\":\\s\+\"\([0-9]\+\.\?\)\+\)/\1-pre.${{ github.run_number }}/" 'package.json'
- run: yarn cipublish --access public --tag next --no-git-tag-version
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

release:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

needs: build

if: ${{ github.event_name == 'push' }}
if: ${{ github.event_name == 'release' }}

steps:
- uses: actions/checkout@v2
Expand All @@ -74,18 +73,13 @@ jobs:
with:
node-version: "16.x"
registry-url: 'https://registry.npmjs.org'

- run: sed -i -e "s/\(\"version\":\\s\+\"\([0-9]\+\.\?\)\+\)/\1-pre.${{ github.run_number }}/" 'package.json'
- run: yarn install
- run: yarn build
- run: yarn publish --access public --tag latest --no-git-tag-version
- run: yarn
- run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn cipublish --access public --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.ICAP_ACCESS_TOKEN }}


NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

dev:
runs-on: ubuntu-20.04
#Test
runs-on: ubuntu-latest
needs: release

if: ${{ github.ref == 'refs/heads/develop' }}
Expand All @@ -96,9 +90,27 @@ jobs:
- name: Compute Timestamp
run: echo "TIMESTAMP=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- uses: garygrossgarten/github-action-ssh@release
name: Run the Update MicroFronEnd Script
name: Run the Update MicroFronEnd Script on dev server
with:
command: cd /usr/share/tomcat/frontendmodules/ && /bin/bash update_frontend_modules.sh
host: ${{ secrets.ETHIOHRI_HOST }}
username: ${{ secrets.ETHIOHRI_USER }}
privateKey: ${{ secrets.ETHIOHRI_DEV_PRIVATE_KEY}}
demo:
runs-on: ubuntu-latest
needs: release

if: ${{ github.ref == 'refs/heads/develop' }}

steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
- name: Compute Timestamp
run: echo "TIMESTAMP=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- uses: garygrossgarten/github-action-ssh@release
name: Run the Update MicroFronEnd Script on Demo server
with:
command: cd /usr/share/tomcat7/frontendmodules/ && /bin/bash update_frontend_modules.sh
host: ${{ secrets.ETHIOHRI_DEMO_HOST }}
username: ${{ secrets.ETHIOHRI_DEMO_USER }}
privateKey: ${{ secrets.ETHIOHRI_DEMO_PRIVATE_KEY}}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,4 @@ dist/
!.yarn/releases
!.yarn/sdks
!.yarn/versions
.yarn/install-state.gz
3 changes: 2 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

set -e # die on error
set -e # die on error

npx pretty-quick --staged
yarn lint
4 changes: 2 additions & 2 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

set -e # die on error
set -e # die on error

yarn verify
yarn verify
8 changes: 8 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
tsconfig.json
*.ts
!*.d.ts
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
.yarn/install-state.gz

Binary file removed .yarn/install-state.gz
Binary file not shown.
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@

# OpenMRS ESM Ethiohri App
# ETHIOHRI ESM

A custom microfrontend for Ethiopia's integration into OHRI
A custom microfrontend for Ethiopia's integration into OHRI built on top of OpenMRS 3.x

## Pre-requisites

## Running this code
- [Node v16 or higher](https://nodejs.org/en/download/)
- Yarn
- TypeScript
- Code editor (VSCode is preferred)

## Getting Started

```sh
yarn # to install dependencies
yarn start # to run the dev server
# With SSH
git clone git@github.com:CDC-HIS/openmrs-esm-ethiohri.git

# Without SSH
git clone https://github.com/CDC-HIS/openmrs-esm-ethiohri.git

# Change directory
cd openmrs-esm-ethiohri
# Install dependencies
yarn

# Run development server on port 8080
yarn start

# OR to run on a different port for example 8090
yarn start --port 8090
```
42 changes: 42 additions & 0 deletions deployment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
## Frontend


### Import Map

```
{
"imports": {
"@openmrs/esm-home-app": "next",
"@openmrs/esm-patient-notes-app": "next",
"@openmrs/esm-patient-forms-app": "next",
"@openmrs/esm-patient-programs-app": "next",
"@openmrs/esm-patient-test-results-app": "next",
"@openmrs/esm-patient-attachments-app": "next",
"@openmrs/esm-patient-search-app": "next",
"@openmrs/esm-patient-appointments-app": "next",
"@openmrs/esm-patient-list-app": "next",
"@openmrs/esm-patient-medications-app": "next",
"@icap-ethiopia/esm-patient-chart-app": "next",
"@openmrs/esm-patient-immunizations-app": "next",
"@openmrs/esm-patient-conditions-app": "next",
"@openmrs/esm-dispensing-app": "next",
"@openmrs/esm-patient-banner-app": "next",
"@openmrs/esm-devtools-app": "next",
"@openmrs/esm-patient-biometrics-app": "next",
"@openmrs/esm-login-app": "next",
"@icap-ethiopia/esm-patient-registration-app": "next",
"@openmrs/esm-patient-allergies-app": "next",
"@openmrs/esm-primary-navigation-app": "next",
"@openmrs/esm-patient-vitals-app": "next",
"@ohri/openmrs-esm-ohri-core-app": "next",
"@openmrs/esm-appointments-app": "next",
"@openmrs/esm-outpatient-app": "next",
"@openmrs/esm-implementer-tools-app": "next",
"@ohri/openmrs-esm-ohri-cervical-cancer-app": "next",
"@ohri/openmrs-esm-ohri-hiv-app": "next",
"@openmrs/esm-form-builder-app": "next",
"@icap-ethiopia/esm-ethiohri-app": "next"
}
}
```
18 changes: 11 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@icap-ethiopia/esm-ethiohri-app",
"version": "1.0.0",
"version": "1.0.1",
"license": "MPL-2.0",
"author": "ICAP Ethiopia",
"description": "A microfrontend ethiohri OpenMRS",
Expand All @@ -12,13 +12,14 @@
"serve": "webpack serve --mode=development",
"build": "webpack --mode production",
"analyze": "webpack --mode=production --env.analyze=true",
"lint": "eslint src --ext js,jsx,ts,tsx",
"lint": "eslint src --ext js,jsx,ts,tsx --fix",
"prettier": "prettier --write \"src/**/*.{ts,tsx}\"",
"typescript": "tsc",
"test": "jest --config jest.config.js --passWithNoTests",
"verify": "concurrently 'yarn:lint' 'yarn:test' 'yarn:typescript'",
"coverage": "yarn test -- --coverage",
"prepare": "husky install"
"prepare": "husky install",
"cipublish": "npm publish"
},
"husky": {
"hooks": {
Expand Down Expand Up @@ -47,20 +48,22 @@
},
"dependencies": {
"@adobe/react-spectrum": "^3.19.0",
"@carbon/charts-react": "^1.5.2",
"@carbon/react": "^1.17.0",
"dayjs": "^1.8.16",
"lodash-es": "^4.17.15",
"swr": "^1.3.0"
"swr": "^2.0.1"
},
"peerDependencies": {
"@openmrs/esm-framework": "4.x",
"react": "18.x",
"react-i18next": "11.x",
"rxjs": "6.x"
},
"devDependencies": {
"@ohri/openmrs-esm-ohri-commons-lib": "next",
"@ohri/openmrs-ohri-form-engine-lib": "next",
"@openmrs/esm-framework": "^4.0.3-pre.434",
"@openmrs/esm-framework": "next",
"@openmrs/esm-patient-common-lib": "next",
"@openmrs/esm-styleguide": "4.x",
"@swc/cli": "^0.1.57",
Expand All @@ -83,13 +86,14 @@
"eslint-config-prettier": "^8.5.0",
"eslint-config-ts-react-important-stuff": "^3.0.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-unused-imports": "^2.0.0",
"file-loader": "^6.2.0",
"husky": "^8.0.0",
"husky": "^8.0.3",
"identity-obj-proxy": "^3.0.0",
"jest": "^28.0.0",
"jest-cli": "^28.0.0",
"jest-environment-jsdom": "^28.1.2",
"openmrs": "^4.0.3-pre.434",
"openmrs": "next",
"prettier": "^2.7.1",
"pretty-quick": "^3.1.3",
"react": "^18.2.0",
Expand Down
39 changes: 39 additions & 0 deletions src/actions-buttons/test-patient-details-button.component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React from "react";
import { navigate } from "@openmrs/esm-framework";
import { useTranslation } from "react-i18next";

interface TestPatientDetailsButtonProps {
onTransition?: () => void;
patientUuid: string;
}

const TestPatientDetailsButton: React.FC<TestPatientDetailsButtonProps> = ({
patientUuid,
onTransition,
}) => {
const { t } = useTranslation();
const handleClick = React.useCallback(() => {
navigate({
to: `\${openmrsSpaBase}/patient/${patientUuid}/chart/Clinical Visits`,
});
onTransition && onTransition();
}, [onTransition, patientUuid]);

return (
<li className="cds--overflow-menu-options__option">
<button
className="cds--overflow-menu-options__btn"
role="menuitem"
title={t("Open Forms", "Test patient details")}
data-floating-menu-primary-focus
onClick={handleClick}
>
<span className="cds--overflow-menu-options__option-content">
{t("testactionbutton", "Test patient details")}
</span>
</button>
</li>
);
};

export default TestPatientDetailsButton;
3 changes: 3 additions & 0 deletions src/actions-buttons/test-patient-details-button.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.link {
text-decoration: none;
}
Loading

0 comments on commit 8094239

Please sign in to comment.