Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
Upgrade Dependencies, Allow ReadOnly Access for Poc Details (#334)
Browse files Browse the repository at this point in the history
* upgrade

* update routing; disable group update
  • Loading branch information
ggrund-tsi authored Feb 16, 2023
1 parent 50f33ad commit bf7b2d0
Show file tree
Hide file tree
Showing 21 changed files with 520 additions and 339 deletions.
68 changes: 33 additions & 35 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,43 @@
"version": "1.0.0",
"private": true,
"dependencies": {
"@fortawesome/fontawesome-free": "^5.15.3",
"@fortawesome/fontawesome-free": "^6.3.0",
"@react-keycloak/web": "^3.4.0",
"@testing-library/dom": "^8.13.0",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"@types/crypto-js": "^4.0.1",
"@types/file-saver": "^2.0.2",
"@types/jest": "^26.0.15",
"@types/node": "^12.0.0",
"@types/react": "^17.0.0",
"@types/react-datepicker": "^4.3.4",
"@types/react-dom": "^17.0.0",
"@types/react-pdf": "^5.0.2",
"@types/react-router-dom": "^5.3.3",
"@types/qrcode.react": "^1.0.1",
"@types/uuid": "^8.3.0",
"axios": "^0.21.1",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^14.4.3",
"axios": "^1.3.3",
"bootstrap": "^4.6.0",
"crypto-js": "^4.0.0",
"file-saver": "^2.0.5",
"generate-license-file": "^1.1.0",
"husky": "^5.1.3",
"i18next": "^19.9.2",
"i18next-resource-store-loader": "^0.1.2",
"generate-license-file": "^2.0.0",
"husky": "^8.0.3",
"i18next": "^22.0.4",
"i18next-browser-languagedetector": "^7.0.1",
"i18next-http-backend": "^2.0.1",
"icao-transliteration": "https://github.com/corona-warn-app/cwa-icao-transliteration.git",
"lint-staged": "^13.1.2",
"keycloak-js": "^20.0.1",
"lint-staged": "^10.5.4",
"moment": "^2.29.1",
"popper.js": "1.16.1",
"prettier": "^2.2.1",
"prop-types": "15.7.0",
"qrcode.react": "^1.0.0",
"react": "^17.0.0",
"prop-types": "15.8.1",
"qrcode.react": "^3.1.0",
"react": "^18.2.0",
"react-bootstrap": "^1.5.2",
"react-datepicker": "^4.6.0",
"react-dom": "^17.0.0",
"react-i18next": "^11.8.10",
"react-dom": "^18.2.0",
"react-i18next": "^11.18.4",
"react-moment": "^1.1.1",
"react-pdf": "^5.2.0",
"react-qr-reader": "^2.2.1",
"react-router-dom": "^5.3.1",
"react-scripts": "4.0.3",
"react-pdf": "^6.2.2",
"react-qr-reader": "^3.0.0-beta-1",
"react-router-dom": "^6.8.1",
"react-scripts": "5.0.1",
"sass": "^1.43.4",
"typescript": "^4.1.2",
"uuid": "^8.3.2",
"web-vitals": "^1.0.1"
},
"resolutions": {
"@types/react": "17.0.43"
"uuid": "^9.0.0",
"web-vitals": "^3.1.1"
},
"lint-staged": {
"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}": [
Expand Down Expand Up @@ -91,8 +78,19 @@
}
},
"devDependencies": {
"@types/crypto-js": "^4.0.1",
"@types/file-saver": "^2.0.2",
"@types/jest": "^29.4.0",
"@types/node": "^18.13.0",
"@types/qrcode.react": "^1.0.1",
"@types/react": "^18.0.8",
"@types/react-datepicker": "^4.3.4",
"@types/react-dom": "^18.0.11",
"@types/react-pdf": "^6.2.0",
"@types/react-qr-reader": "^2.1.3",
"http-proxy-middleware": "^1.1.1",
"@types/react-router-dom": "^5.3.3",
"@types/uuid": "^9.0.0",
"http-proxy-middleware": "^2.0.6",
"https-proxy-agent": "^5.0.0"
}
}
File renamed without changes.
File renamed without changes.
Empty file removed src/assets/i18n/index.js
Empty file.
107 changes: 86 additions & 21 deletions src/components/modals/group-modal.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,18 @@
*/

import React from 'react';
import { Button, Modal, Form, Col, Row, Spinner, Fade, Container, Collapse, Dropdown } from 'react-bootstrap';
import {
Button,
Modal,
Form,
Col,
Row,
Spinner,
Fade,
Container,
Collapse,
Dropdown,
} from 'react-bootstrap';

import '../../i18n';
import { useTranslation } from 'react-i18next';
Expand All @@ -33,8 +44,9 @@ import {
import { IGroupDetails, IGroupNode, IGroup } from '../../misc/user';
import { useGetGroupDetails } from '../../api';
import CwaSpinner from '../spinner/spinner.component';
import utils from '../../misc/utils';
import { useKeycloak } from '@react-keycloak/web';
import AppContext from '../../store/app-context';
import CancellationSteps from '../../misc/CancellationSteps';

const emptyGroup: IGroupDetails = {
id: '',
Expand All @@ -55,6 +67,11 @@ const GroupModal = (props: any) => {
const [btnOkDisabled, setBtnOkDisabled] = React.useState(true);
const { t } = useTranslation();
const { keycloak } = useKeycloak();
const { cancellation, utils, contextConfig } = React.useContext(AppContext);
const step = utils?.getCancellationStep(
cancellation?.cancellation,
contextConfig['cancellation-complete-pending-tests']
);

const [data, setData] = React.useState('');
const [validated, setValidated] = React.useState(false);
Expand Down Expand Up @@ -215,7 +232,7 @@ const GroupModal = (props: any) => {
}

error = openingHours.find((element) => {
return !new RegExp(utils.pattern.openingHours).test(element);
return !new RegExp(utils?.pattern.openingHours!).test(element);
});

if (error) {
Expand Down Expand Up @@ -256,10 +273,15 @@ const GroupModal = (props: any) => {
collectChildren(selfIdOrChildren, node.group);
}

const fList = props.groups.filter((groupNode: IGroupNode) => selfIdOrChildren.indexOf(groupNode.group.id) < 0);
const fList = props.groups.filter(
(groupNode: IGroupNode) => selfIdOrChildren.indexOf(groupNode.group.id) < 0
);

result = fList.map((groupNode: IGroupNode) => (
<option key={groupNode.group.id} value={groupNode.group.id}>
<option
key={groupNode.group.id}
value={groupNode.group.id}
>
{'\u00A0\u00A0\u00A0\u00A0'.repeat(groupNode.level) + groupNode.group.name}
</option>
));
Expand All @@ -273,7 +295,11 @@ const GroupModal = (props: any) => {
const getDropdownItems = () => {
setDropdownItems(
dropdownList.map((item: string) => (
<Dropdown.Item onSelect={(eventKey: any) => setSelectedDropdownValue(eventKey)} eventKey={item} key={item}>
<Dropdown.Item
onSelect={(eventKey: any) => setSelectedDropdownValue(eventKey)}
eventKey={item}
key={item}
>
{item}
</Dropdown.Item>
))
Expand All @@ -294,10 +320,22 @@ const GroupModal = (props: any) => {
{!isReady ? (
<CwaSpinner background='#eeeeee' />
) : (
<Fade appear={true} in={true}>
<Form className='form-flex' onSubmit={handleSubmit} validated={validated}>
<Modal.Header id='data-header' className='pb-0'>
<Modal.Title>{isNew ? t('translation:add-group') : t('translation:edit-group')}</Modal.Title>
<Fade
appear={true}
in={true}
>
<Form
className='form-flex'
onSubmit={handleSubmit}
validated={validated}
>
<Modal.Header
id='data-header'
className='pb-0'
>
<Modal.Title>
{isNew ? t('translation:add-group') : t('translation:edit-group')}
</Modal.Title>
</Modal.Header>

<Modal.Body className='bg-light'>
Expand Down Expand Up @@ -345,12 +383,14 @@ const GroupModal = (props: any) => {
maxLength={300}
/>

{utils.hasRole(keycloak, 'c19_quick_test_poc_nat_admin') ? (
{utils?.hasRole(keycloak, 'c19_quick_test_poc_nat_admin') ? (
<FormGroupPermissionCkb
controlId='formenablePcr'
title={t('translation:enablePcr')}
//label={t('translation:for-counter')}
onChange={(evt: any) => updateSearchPortalConsent('enablePcr', evt.currentTarget.checked)}
onChange={(evt: any) =>
updateSearchPortalConsent('enablePcr', evt.currentTarget.checked)
}
type='checkbox'
checked={group.enablePcr}
/>
Expand All @@ -376,7 +416,9 @@ const GroupModal = (props: any) => {
controlId='formsearchPortalConsent'
title={t('translation:searchPortalConsent')}
//label={t('translation:for-counter')}
onChange={(evt: any) => updateSearchPortalConsent('searchPortalConsent', evt.currentTarget.checked)}
onChange={(evt: any) =>
updateSearchPortalConsent('searchPortalConsent', evt.currentTarget.checked)
}
type='checkbox'
checked={group.searchPortalConsent}
/>
Expand All @@ -392,7 +434,7 @@ const GroupModal = (props: any) => {
props.resetError();
}}
type='email'
pattern={utils.pattern.eMail}
pattern={utils?.pattern.eMail}
minLength={5}
maxLength={255}
/>
Expand All @@ -410,7 +452,7 @@ const GroupModal = (props: any) => {
props.resetError();
}}
maxLength={100}
pattern={utils.pattern.url}
pattern={utils?.pattern.url}
/>

<FormGroupTextarea
Expand All @@ -423,14 +465,16 @@ const GroupModal = (props: any) => {
}}
type='textarea'
rows={7}
pattern={utils.pattern.email}
pattern={utils?.pattern.email}
isInvalid={errorOpeningHour}
invalidText={errorOpeningHour && t('translation:' + errorOpeningHour)}
/>
<FormGroupPermissionCkb
controlId='formAppointmentRequired'
title={t('translation:searchPortalAppointmentRequired')}
onChange={(evt: any) => updateGroupProp('appointmentRequired', evt.currentTarget.checked)}
onChange={(evt: any) =>
updateGroupProp('appointmentRequired', evt.currentTarget.checked)
}
type='checkbox'
checked={group?.appointmentRequired ? group.appointmentRequired : false}
/>
Expand All @@ -455,13 +499,34 @@ const GroupModal = (props: any) => {
<Modal.Footer id='data-footer'>
<Container className='p-0'>
<Row>
<Col sm='6' lg='4' className='mb-2 mb-sm-0 p-0 pr-sm-2'>
<Button className='p-0' block variant='outline-primary' onClick={handleCancel}>
<Col
sm='6'
lg='4'
className='mb-2 mb-sm-0 p-0 pr-sm-2'
>
<Button
className='p-0'
block
variant='outline-primary'
onClick={handleCancel}
>
{t('translation:cancel')}
</Button>
</Col>
<Col sm='6' lg='4' className='p-0 pl-sm-2'>
<Button className='p-0' block type='submit' disabled={btnOkDisabled}>
<Col
sm='6'
lg='4'
className='p-0 pl-sm-2'
>
<Button
className='p-0'
block
type='submit'
disabled={
btnOkDisabled ||
(step ? step >= CancellationSteps.DOWNLOAD_REQUESTED : false)
}
>
{isNew ? t('translation:add') : t('translation:edit')}

<Spinner
Expand Down
31 changes: 24 additions & 7 deletions src/components/modules/group-table.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ const GroupTable = (props: any) => {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [bGroups]);

const flattenGroups = (groups: IGroup[], groupNodes: IGroupNode[], level: number, parentGroup?: string): void => {
const flattenGroups = (
groups: IGroup[],
groupNodes: IGroupNode[],
level: number,
parentGroup?: string
): void => {
groups.forEach((group: IGroup) => {
const gNode: IGroupNode = {
group: group,
Expand All @@ -109,7 +114,9 @@ const GroupTable = (props: any) => {

updateGroup(uGroup)
.then(() => {
const fgroupNode = props.groupNodes.find((groupNode: IGroupNode) => groupNode.group.id === group.id);
const fgroupNode = props.groupNodes.find(
(groupNode: IGroupNode) => groupNode.group.id === group.id
);

if (
keycloak.token &&
Expand Down Expand Up @@ -199,9 +206,15 @@ const GroupTable = (props: any) => {
{!(props.groupNodes && groupIsReady) ? (
<CwaSpinner background='#eeeeee' />
) : (
<Collapse appear={true} in={true}>
<Collapse
appear={true}
in={true}
>
<Container className='p-0 '>
<Table bordered hover>
<Table
bordered
hover
>
<thead>
<tr>
<th>{t('translation:name')}</th>
Expand All @@ -219,9 +232,9 @@ const GroupTable = (props: any) => {
<Row className='m-0 justify-content-around'>
<Button
className='btn-icon edit-icon'
disabled={step ? step >= CancellationSteps.DOWNLOAD_REQUESTED : false}
// disabled={step ? step >= CancellationSteps.DOWNLOAD_REQUESTED : false}
onClick={() => startEditGroup(g)}
></Button>
/>
<Button
className='btn-icon delete-icon'
disabled={step ? step >= CancellationSteps.DOWNLOAD_REQUESTED : false}
Expand All @@ -244,7 +257,11 @@ const GroupTable = (props: any) => {
setIsGroupEdit(true);
}}
>
<img className='mr-2' src={imageAdd} alt='Hinzufügen' />
<img
className='mr-2'
src={imageAdd}
alt='Hinzufügen'
/>
{t('translation:add-group')}
</Button>
</Container>
Expand Down
Loading

0 comments on commit bf7b2d0

Please sign in to comment.