Skip to content

Commit

Permalink
Merge pull request #7 from openimis/develop
Browse files Browse the repository at this point in the history
April 2021 release
  • Loading branch information
edarchis authored May 7, 2021
2 parents 18bcab0 + a93392b commit 0a0ef44
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 134 deletions.
11 changes: 7 additions & 4 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"presets": [
["env", {
["@babel/preset-env", {
"modules": false
}],
"stage-0",
"react"
["@babel/preset-react"]
],
"plugins": [
"@babel/plugin-transform-runtime",
"@babel/plugin-proposal-class-properties"
]
}
}
50 changes: 50 additions & 0 deletions .github/workflows/npmpublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Node.js Package

on:
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
- run: yarn install
- run: yarn build

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
scope: openimis
- run: yarn install
- run: yarn build
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

publish-gpr:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://npm.pkg.github.com/
- run: yarn install
- run: yarn build
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ This repository holds the files of the openIMIS Frontend Administration referenc
It is dedicated to be deployed as a module of [openimis-fe_js](https://github.com/openimis/openimis-fe_js).

[![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)
[![Total alerts](https://img.shields.io/lgtm/alerts/g/openimis/openimis-fe-admin_js.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/openimis/openimis-fe-admin_js/alerts/)

## Main Menu Contributions
* **Administration** (admin.mainMenu translation key) main menu entry
Expand Down Expand Up @@ -49,7 +50,7 @@ It is dedicated to be deployed as a module of [openimis-fe_js](https://github.co
* `Locations.aspx`

## Available Contribution Points
None
* `admin.MainMenu`: ability to add entries within the main menu entry

## Published Components
None
Expand Down
103 changes: 25 additions & 78 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,98 +1,45 @@
{
"name": "@openimis/fe-admin",
"version": "1.1.0",
"version": "1.2.0-rc4",
"license": "AGPL-3.0-only",
"description": "openIMIS Frontend Admin reference module",
"repository": "openimis/openimis-fe-admin_js",
"main": "dist/index.js",
"module": "dist/index.es.js",
"jsnext:main": "dist/index.es.js",
"engines": {
"node": ">=8",
"npm": ">=5"
},
"scripts": {
"test": "cross-env CI=1 react-scripts test --env=jsdom",
"test:watch": "react-scripts test --env=jsdom",
"build": "rollup -c",
"start": "rollup -c -w",
"prepare": "yarn run build",
"predeploy": "cd example && yarn install && yarn run build",
"deploy": "gh-pages -d example/build"
"start": "rollup -c -w"
},
"peerDependencies": {
"@date-io/core": "^1.3.6",
"@material-ui/core": "^4.3.3",
"@material-ui/icons": "^4.2.1",
"@material-ui/pickers": "^3.2.2",
"@openimis/fe-core": ">=1.1.0",
"history": "^4.9.0",
"lodash": "^4.17.15",
"lodash-uuid": "^0.0.3",
"moment": "^2.24.0",
"prop-types": "^15.5.4",
"react": "^16.8.6",
"react-autosuggest": "^9.4.3",
"react-dom": "^16.8.6",
"react-intl": "^2.9.0",
"react-redux": "^7.0.3",
"react-router": "^5.0.0",
"react-router-dom": "^5.0.0",
"redux": "^4.0.1",
"redux-api-middleware": "^3.0.1",
"redux-thunk": "^2.3.0"
"peerDependency": {
"react-intl": "^5.8.1"
},
"devDependencies": {
"@date-io/core": "^1.3.6",
"@material-ui/core": "^4.3.3",
"@material-ui/icons": "^4.2.1",
"@material-ui/pickers": "^3.2.2",
"@openimis/fe-core": ">=1.1.0",
"@svgr/rollup": "^2.4.1",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-eslint": "^10.0.3",
"babel-plugin-external-helpers": "^6.22.0",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"classnames": "^2.2.6",
"cross-env": "^5.1.4",
"eslint": "^6.5.1",
"eslint-config-standard": "^14.1.0",
"eslint-config-standard-react": "^9.2.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.15.0",
"eslint-plugin-standard": "^4.0.1",
"gh-pages": "^1.2.0",
"history": "^4.9.0",
"lodash": "^4.17.15",
"lodash-uuid": "^0.0.3",
"moment": "^2.24.0",
"prop-types": "^15.5.4",
"react": "^16.8.6",
"react-autosuggest": "^9.4.3",
"react-dom": "^16.8.6",
"react-intl": "^2.9.0",
"react-redux": "^7.0.3",
"react-router": "^5.0.0",
"react-router-dom": "^5.0.0",
"react-scripts": "^1.1.4",
"redux": "^4.0.1",
"redux-api-middleware": "^3.0.1",
"redux-thunk": "^2.3.0",
"rollup": "^0.64.1",
"rollup-plugin-babel": "^3.0.7",
"rollup-plugin-commonjs": "^9.1.3",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-peer-deps-external": "^2.2.0",
"rollup-plugin-postcss": "^1.6.2",
"rollup-plugin-url": "^1.4.0"
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.6",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.9.6",
"@babel/preset-env": "^7.9.6",
"@babel/preset-react": "^7.9.4",
"@babel/runtime": "^7.9.6",
"@rollup/plugin-babel": "^5.0.0",
"@rollup/plugin-commonjs": "^11.1.0",
"@rollup/plugin-json": "^4.0.3",
"@rollup/plugin-node-resolve": "^7.1.3",
"@rollup/plugin-url": "^5.0.0",
"moment": "^2.25.3",
"prop-types": "^15.7.2",
"react-autosuggest": "^10.0.2",
"react-router-dom": "^5.2.0",
"redux": "^4.0.5",
"redux-api-middleware": "^3.2.1",
"rollup": "^2.10.0"
},
"files": [
"dist"
]
],
"dependencies": {}
}
45 changes: 22 additions & 23 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
import babel from 'rollup-plugin-babel'
import commonjs from 'rollup-plugin-commonjs'
import external from 'rollup-plugin-peer-deps-external'
import postcss from 'rollup-plugin-postcss'
import resolve from 'rollup-plugin-node-resolve'
import url from 'rollup-plugin-url'
import json from 'rollup-plugin-json'
import svgr from '@svgr/rollup'

import babel from '@rollup/plugin-babel'
import json from '@rollup/plugin-json'
import pkg from './package.json'

export default {
input: 'src/index.js',
output: [
{
file: pkg.main,
format: 'cjs',
file: pkg.module,
format: 'es',
sourcemap: true
},
{
file: pkg.module,
format: 'es',
file: 'dist/index.js',
format: 'cjs',
sourcemap: true
}
],
external: [
/^@babel.*/,
/^@date-io\/.*/,
/^@material-ui\/.*/,
/^@openimis.*/,
"classnames",
"clsx",
"history",
/^lodash.*/,
"moment",
"prop-types",
/^react.*/,
/^redux.*/
],
plugins: [
json(),
external(),
postcss({
modules: true
}),
url(),
svgr(),
babel({
exclude: 'node_modules/**',
plugins: [ 'external-helpers' ]
babelHelpers: 'runtime'
}),
resolve(),
commonjs()
]
}
}
22 changes: 9 additions & 13 deletions src/components/AdminMainMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { injectIntl } from 'react-intl';
import { connect } from "react-redux";
import {
AccountBalance,
AccountBox,
LocationCity,
Healing,
HealingOutlined,
Expand All @@ -16,7 +15,7 @@ import {
SupervisorAccount,
Tune
} from "@material-ui/icons";
import { formatMessage, MainMenuContribution } from "@openimis/fe-core";
import { formatMessage, MainMenuContribution, withModulesManager } from "@openimis/fe-core";
import {
RIGHT_PRODUCTS,
RIGHT_HEALTHFACILITIES,
Expand All @@ -28,10 +27,11 @@ import {
RIGHT_CLAIMADMINISTRATOR,
RIGHT_USERS,
RIGHT_PAYERS,
RIGHT_LOCATIONS,
RIGHT_USERPROFILES,
RIGHT_LOCATIONS
} from "../constants";

const ADMIN_MAIN_MENU_CONTRIBUTION_KEY = "admin.MainMenu";

class AdminMainMenu extends Component {
render() {
const { rights } = this.props;
Expand Down Expand Up @@ -71,7 +71,7 @@ class AdminMainMenu extends Component {
entries.push({
text: formatMessage(this.props.intl, "admin", "menu.medicalServices"),
icon: <Healing />,
route: "/admin/medilcalServices"
route: "/admin/medicalServices"
});
}
if (rights.includes(RIGHT_MEDICALITEMS)) {
Expand All @@ -89,13 +89,6 @@ class AdminMainMenu extends Component {
route: "/admin/users"
});
}
if (rights.includes(RIGHT_USERPROFILES)) {
entries.push({
text: formatMessage(this.props.intl, "admin", "menu.usersProfiles"),
icon: <AccountBox />,
route: "/admin/userProfiles"
});
}
if (rights.includes(RIGHT_ENROLMENTOFFICER)) {
entries.push({
text: formatMessage(this.props.intl, "admin", "menu.enrollmentOfficers"),
Expand Down Expand Up @@ -125,6 +118,9 @@ class AdminMainMenu extends Component {
});
}

entries.push(
...this.props.modulesManager.getContribs(ADMIN_MAIN_MENU_CONTRIBUTION_KEY).filter(c => !c.filter || c.filter(rights)));

if (!entries.length) return null;
return (
<MainMenuContribution
Expand All @@ -141,4 +137,4 @@ const mapStateToProps = state => ({
rights: !!state.core && !!state.core.user && !!state.core.user.i_user ? state.core.user.i_user.rights : [],
})

export default injectIntl(connect(mapStateToProps)(AdminMainMenu));
export default withModulesManager(injectIntl(connect(mapStateToProps)(AdminMainMenu)));
11 changes: 0 additions & 11 deletions src/components/UserProfilesPage.js

This file was deleted.

1 change: 0 additions & 1 deletion src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ export const RIGHT_CLAIMADMINISTRATOR=121601
export const RIGHT_USERS=121701
export const RIGHT_PAYERS=121801
export const RIGHT_LOCATIONS=121901
export const RIGHT_USERPROFILES=122001
4 changes: 1 addition & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { MedicalItemsPriceListPage } from "./components/MedicalItemsPriceListPag
import { MedicalServicesPage } from "./components/MedicalServicesPage";
import { MedicalItemsPage } from "./components/MedicalItemsPage";
import { UsersPage } from "./components/UsersPage";
import { UserProfilesPage } from "./components/UserProfilesPage";
import { EnrollmentOfficersPage } from "./components/EnrollmentOfficersPage";
import { ClaimAdministratorsPage } from "./components/ClaimAdministratorsPage";
import { PayersPage } from "./components/PayersPage";
Expand All @@ -17,10 +16,9 @@ const DEFAULT_CONFIG = {
{ path: "admin/products", component: ProductsPage },
{ path: "admin/medicalServicesPriceList", component: MedicalServicesPriceListPage },
{ path: "admin/medicalItemsPriceList", component: MedicalItemsPriceListPage },
{ path: "admin/medilcalServices", component: MedicalServicesPage },
{ path: "admin/medicalServices", component: MedicalServicesPage },
{ path: "admin/medilcalItems", component: MedicalItemsPage },
{ path: "admin/users", component: UsersPage },
{ path: "admin/userProfiles", component: UserProfilesPage },
{ path: "admin/enrollmentOfficers", component: EnrollmentOfficersPage },
{ path: "admin/claimAdministrators", component: ClaimAdministratorsPage },
{ path: "admin/payers", component: PayersPage },
Expand Down

0 comments on commit 0a0ef44

Please sign in to comment.