diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 402d46e..e4be05d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,7 @@ on: branches: - master - 'release-*' + - BAH-4104 tags: - '[0-9]+.[0-9]+.[0-9]+' workflow_dispatch: @@ -37,38 +38,38 @@ jobs: platforms: linux/amd64,linux/arm64 file: package/docker/Dockerfile push: true - tags: bahmniindiadistro/hiu-ui:${{env.ARTIFACT_VERSION}},bahmniindiadistro/hiu-ui:latest - - name: Helm - Update Version and Image Tag - run: | - yq --inplace '.image.tag = "${{ env.ARTIFACT_VERSION }}"' $HELM_CHART_PATH/values.yaml - yq --inplace '.version = "${{ env.ARTIFACT_VERSION }}"' $HELM_CHART_PATH/Chart.yaml + tags: bahmniindiadistro/hiu-ui:${{env.ARTIFACT_VERSION}} + # - name: Helm - Update Version and Image Tag + # run: | + # yq --inplace '.image.tag = "${{ env.ARTIFACT_VERSION }}"' $HELM_CHART_PATH/values.yaml + # yq --inplace '.version = "${{ env.ARTIFACT_VERSION }}"' $HELM_CHART_PATH/Chart.yaml - - name: Helm Lint - run: helm lint $HELM_CHART_PATH + # - name: Helm Lint + # run: helm lint $HELM_CHART_PATH - - name: Helm Package - run: helm package $HELM_CHART_PATH + # - name: Helm Package + # run: helm package $HELM_CHART_PATH - - name: Helm - Checkout Charts Repository - uses: actions/checkout@v2 - with: - repository: Bahmniindiadistro/helm-charts - ref: gh-pages - path: helm-charts - persist-credentials: false + # - name: Helm - Checkout Charts Repository + # uses: actions/checkout@v2 + # with: + # repository: Bahmniindiadistro/helm-charts + # ref: gh-pages + # path: helm-charts + # persist-credentials: false - - name: Helm - Copy chart - run: mkdir -p helm-charts/hiu-ui/ && cp hiu-ui-${{ env.ARTIFACT_VERSION }}.tgz helm-charts/hiu-ui/ + # - name: Helm - Copy chart + # run: mkdir -p helm-charts/hiu-ui/ && cp hiu-ui-${{ env.ARTIFACT_VERSION }}.tgz helm-charts/hiu-ui/ - - name: Helm - reIndex - working-directory: helm-charts/ - run: helm repo index --merge index.yaml --url https://bahmniindiadistro.github.io/helm-charts/ . + # - name: Helm - reIndex + # working-directory: helm-charts/ + # run: helm repo index --merge index.yaml --url https://bahmniindiadistro.github.io/helm-charts/ . - - name: Helm - Publish Chart - working-directory: helm-charts/ - run: | - git config user.name ${{ secrets.BAHMNI_USERNAME}} - git config user.email ${{ secrets.BAHMNI_EMAIL}} - git add . - git commit -m "Release of hiu-ui-${{ env.ARTIFACT_VERSION }}" - git push 'https://${{ secrets.BAHMNI_USERNAME}}:${{ secrets.BAHMNI_PAT}}@github.com/bahmniindiadistro/helm-charts.git' gh-pages \ No newline at end of file + # - name: Helm - Publish Chart + # working-directory: helm-charts/ + # run: | + # git config user.name ${{ secrets.BAHMNI_USERNAME}} + # git config user.email ${{ secrets.BAHMNI_EMAIL}} + # git add . + # git commit -m "Release of hiu-ui-${{ env.ARTIFACT_VERSION }}" + # git push 'https://${{ secrets.BAHMNI_USERNAME}}:${{ secrets.BAHMNI_PAT}}@github.com/bahmniindiadistro/helm-charts.git' gh-pages \ No newline at end of file diff --git a/src/components/ConsentsListTable/ConsentDetailPanel.js b/src/components/ConsentsListTable/ConsentDetailPanel.js new file mode 100644 index 0000000..e1fde26 --- /dev/null +++ b/src/components/ConsentsListTable/ConsentDetailPanel.js @@ -0,0 +1,130 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { makeStyles } from '@material-ui/core/styles'; +import Typography from '@material-ui/core/Typography'; +import { Grid, Table, TableBody, TableCell, TableHead, TableRow } from '@material-ui/core'; +import { formatDateString } from '../common/HealthInfo/FhirResourcesUtils'; + +const useStyles = makeStyles(theme => ({ + detailPanel: { + paddingTop: theme.spacing(2), + paddingBottom: theme.spacing(2), + paddingLeft: theme.spacing(5), + backgroundColor: theme.palette.background.default + } +})); + +const getHiTypesText = hiTypes => { + return hiTypes.join(', '); +}; + +const getPermissionDateRangeText = permission => { + let fromDate = formatDateString(permission.dateRange.from, false); + let toDate = formatDateString(permission.dateRange.to, false); + return `${fromDate} - ${toDate}`; +}; + +const consentExpiredComponent = (expiryTimestamp) => { + return ( + + Consent Request Expired on {formatDateString(expiryTimestamp, true)} + + ) +} + +const consentDeniedComponent = (deniedTimestamp) => { + return ( + + Consent Request Denied on {formatDateString(deniedTimestamp, true)} + + ) +} + +const consentArtefactDetailsComponent = (consentArtefacts) => { + return consentArtefacts.length === 0 ? + + + No Consent Artefacts available + + : + ( + + + Granted HI Types: {getHiTypesText(consentArtefacts[0].hiTypes)} + + + + + Granted Date Range: {getPermissionDateRangeText(consentArtefacts[0].permission)} + + + + + Consent Artefacts: + + + + + Facility Name + Status + Status Last Updated on + + + + {consentArtefacts.map((consentArtefact, index) => { + return ( + {consentArtefact.hipName} + {consentArtefact.status} + {formatDateString(consentArtefact.dateModified, true)} + ) + })} + +
+
+
+ ) +} + + +const ConsentDetailPanel = ({ consentDetail }) => { + const classes = useStyles(); + const consentStatus = consentDetail.status; + return ( + + + + Requested HI Types: {getHiTypesText(consentDetail.hiTypes)} + + + + + Requested Date Range: {getPermissionDateRangeText(consentDetail.permission)} + + + + {consentStatus === 'DENIED' && consentDeniedComponent(consentDetail.dateModified)} + {consentStatus === 'EXPIRED' && consentExpiredComponent(consentDetail.expiredDate)} + {(consentStatus === 'GRANTED' || consentStatus === 'REVOKED') && ( + + {consentDetail.consentArtefacts.length === 0 ? + + + No Consent Artefacts available + + + : + ( + consentArtefactDetailsComponent(consentDetail.consentArtefacts) + )} + + )} + + + ); +}; + +ConsentDetailPanel.propTypes = { + consentDetail: PropTypes.object.isRequired +}; + +export default ConsentDetailPanel; diff --git a/src/components/ConsentsListTable/ConsentsListTable.js b/src/components/ConsentsListTable/ConsentsListTable.js index b6d6e61..0fc0f0e 100644 --- a/src/components/ConsentsListTable/ConsentsListTable.js +++ b/src/components/ConsentsListTable/ConsentsListTable.js @@ -7,6 +7,7 @@ import { makeStyles } from '@material-ui/core/styles'; import Typography from '@material-ui/core/Typography'; import { formatDateString } from '../common/HealthInfo/FhirResourcesUtils'; import compareDates from '../common/DateUtil'; +import ConsentDetailPanel from './ConsentDetailPanel'; const useStyles = makeStyles(theme => ({ table: { @@ -31,7 +32,7 @@ const ConsentsListTable = ({ loadConsents, consentsList, loading }) => { requestStatus: 'Request Status', consentGrantedDate: 'Consent granted on', consentExpiryDate: 'Consent expiry on', - consentCreatedDate: 'Consent created on' + consentCreatedDate: 'Requested on' }; function getStatusText(status) { @@ -45,9 +46,9 @@ const ConsentsListTable = ({ loadConsents, consentsList, loading }) => { case 'DENIED': return 'Request Denied'; case 'REVOKED': - return 'Consent Revoked'; + return 'Consent Revoked'; case 'EXPIRED': - return 'Consent Expired'; + return 'Consent Expired'; default: return 'Request sent'; } @@ -57,6 +58,10 @@ const ConsentsListTable = ({ loadConsents, consentsList, loading }) => { return status.toUpperCase() == 'GRANTED'; } + function showGrantedAndExpiredDate(status) { + return isGranted(status) || status.toUpperCase() == 'EXPIRED' || status.toUpperCase() == 'REVOKED'; + } + function getPatientFullName(patient) { return `${patient.firstName} ${patient.lastName}`; } @@ -103,10 +108,10 @@ const ConsentsListTable = ({ loadConsents, consentsList, loading }) => { name: getPatientFullName(consent.patient), id: consent.patient.id, status: getStatusText(consent.status), - grantedOn: isGranted(consent.status) + grantedOn: showGrantedAndExpiredDate(consent.status) ? formatDateString(consent.approvedDate, true) : '-', - expiredOn: isGranted(consent.status) + expiredOn: showGrantedAndExpiredDate(consent.status) ? formatDateString(consent.expiredDate, true) : '-', createdOn: formatDateString(consent.createdDate, true), @@ -116,7 +121,8 @@ const ConsentsListTable = ({ loadConsents, consentsList, loading }) => { ) : ( '' - ) + ), + consentDetail: consent }))} title={( @@ -131,6 +137,9 @@ const ConsentsListTable = ({ loadConsents, consentsList, loading }) => { onClick: () => setRefreshCounter(refreshCounter + 1) } ]} + detailPanel={rowData => ( + + )} /> ); diff --git a/src/components/ConsentsListTable/__tests__/__snapshots__/ConsentsListTable.test.js.snap b/src/components/ConsentsListTable/__tests__/__snapshots__/ConsentsListTable.test.js.snap index 5270606..51dfe7e 100644 --- a/src/components/ConsentsListTable/__tests__/__snapshots__/ConsentsListTable.test.js.snap +++ b/src/components/ConsentsListTable/__tests__/__snapshots__/ConsentsListTable.test.js.snap @@ -37,7 +37,7 @@ exports[`ConsentsListTable should render properly 1`] = ` Object { "customSort": [Function], "field": "createdOn", - "title": "Consent created on", + "title": "Requested on", }, Object { "customSort": [Function],