-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
1,516 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
|
||
yarn lint | ||
|
||
yarn test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Build and Release | ||
on: | ||
push: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
jobs: | ||
build-release: | ||
name: Build the web app and make a zip release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout to repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js 16.x | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: "16.x" | ||
|
||
- name: Install dependencies | ||
run: yarn install | ||
|
||
- name: Run tests | ||
run: yarn test | ||
|
||
- name: Build the app | ||
run: yarn build-prod | ||
|
||
- name: Zip the build | ||
run: zip -r person-management-app.zip build | ||
|
||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: Build ${{ github.run_number }} | ||
tag_name: v-${{ github.run_number }} | ||
files: person-management-app.zip | ||
token: ${{secrets.BAHMNI_PAT}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Workflow to validate PRs | ||
|
||
on: | ||
pull_request: | ||
branches: [master] | ||
|
||
jobs: | ||
build-release: | ||
name: Build the web app and make a zip release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout to repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js 16.x | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: "16.x" | ||
|
||
- name: Install dependencies | ||
run: yarn install | ||
|
||
- name: Run tests | ||
run: yarn test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const fs = require('fs'); | ||
|
||
const indexPath = 'build/index.html'; | ||
let html = fs.readFileSync(indexPath, 'utf8'); | ||
|
||
const cssHrefRegex = /href="\.\/static\/css\/([^"]+\.css)"/; | ||
const cssMatch = html.match(cssHrefRegex); | ||
if (cssMatch) { | ||
const originalHref = cssMatch[0]; | ||
const cssFilename = cssMatch[1]; | ||
const newHref = `href="/person-management/static/css/${cssFilename}"`; | ||
|
||
html = html.replace(originalHref, newHref); | ||
} | ||
|
||
const jsHrefRegex = /src="\.\/static\/js\/([^"]+\.js)"/; | ||
const jsMatch = html.match(jsHrefRegex); | ||
if (jsMatch) { | ||
const originalHref = jsMatch[0]; | ||
const jsFilename = jsMatch[1]; | ||
const newHref = `src="/person-management/static/js/${jsFilename}"`; | ||
|
||
html = html.replace(originalHref, newHref); | ||
} | ||
|
||
fs.writeFileSync(indexPath, html); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import { Constants } from '../components/common/constants'; | ||
|
||
export async function getPersonAttributeTypeUuid(attributeName) { | ||
try { | ||
const url = | ||
Constants.personAttributeType + '?q=' + attributeName + '&v=default'; | ||
const response = await fetch(url).then(function(response) { | ||
if (!response.status === 200) { | ||
throw Error({ response: response }); | ||
} | ||
return response.json(); | ||
}); | ||
return response.results[0].uuid; | ||
} catch (error) { | ||
console.error(error); | ||
return error.response; | ||
} | ||
} | ||
|
||
export async function savePerson(payload) { | ||
try { | ||
return await fetch(Constants.person, { | ||
method: 'POST', | ||
body: JSON.stringify(payload), | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Accept: 'application/json' | ||
}, | ||
credentials: 'include' | ||
}); | ||
} catch (error) { | ||
console.error(error); | ||
return error.response; | ||
} | ||
} | ||
|
||
export async function searchPerson(person) { | ||
try { | ||
const url = | ||
Constants.person + | ||
'?q=' + | ||
person + | ||
'&v=custom%3Auuid%2Cdisplay%2Cage%2Cgender%2CdateCreated'; | ||
return await fetch(url, { | ||
method: 'GET', | ||
credentials: 'include' | ||
}); | ||
} catch (error) { | ||
console.error(error); | ||
return error.response; | ||
} | ||
} | ||
|
||
export async function fetchPerson(uuid) { | ||
try { | ||
const url = Constants.person + '/' + uuid; | ||
return await fetch(url, { | ||
method: 'GET', | ||
credentials: 'include' | ||
}); | ||
} catch (error) { | ||
console.error(error); | ||
return error.response; | ||
} | ||
} | ||
|
||
export async function updatePerson(uuid, payload) { | ||
try { | ||
const url = Constants.person + '/' + uuid; | ||
return await fetch(url, { | ||
method: 'POST', | ||
body: JSON.stringify(payload), | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Accept: 'application/json' | ||
}, | ||
credentials: 'include' | ||
}); | ||
} catch (error) { | ||
console.error(error); | ||
return error.response; | ||
} | ||
} | ||
|
||
export async function fetchPersonAttributeConfig() { | ||
try { | ||
const url = Constants.registrationConfig; | ||
return await fetch(url, { | ||
method: 'GET', | ||
credentials: 'include' | ||
}); | ||
} catch (error) { | ||
console.error(error); | ||
return error.response; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
select:disabled { | ||
background: #dddddd; | ||
cursor: not-allowed; | ||
pointer-events: all !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import './Dropdown.css'; | ||
|
||
const Dropdown = props => { | ||
const { name, required, title, items, onChange, value, disabled } = props; | ||
return ( | ||
<div className="form-input"> | ||
<div className="input-label"> | ||
<label className={required ? 'required' : null}>{title}</label> | ||
</div> | ||
<div> | ||
<select | ||
className="div-select" | ||
name={name} | ||
value={value} | ||
onChange={onChange} | ||
disabled={disabled} | ||
> | ||
{items.map(item => { | ||
return ( | ||
<option key={item} value={item}> | ||
{item} | ||
</option> | ||
); | ||
})} | ||
</select> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
Dropdown.propTypes = { | ||
title: PropTypes.string.isRequired, | ||
name: PropTypes.string.isRequired, | ||
value: PropTypes.string.isRequired, | ||
onChange: PropTypes.func.isRequired | ||
}; | ||
|
||
export default Dropdown; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
input:disabled { | ||
background: #dddddd; | ||
cursor: not-allowed; | ||
pointer-events: all !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.