Skip to content

Commit 8898c20

Browse files
Merge pull request #1732 from KelvinTegelaar/dev
Dev to release
2 parents 106823e + 81979af commit 8898c20

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2479
-595
lines changed

package-lock.json

Lines changed: 708 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,13 @@
3838
"@fortawesome/free-regular-svg-icons": "^5.15.4",
3939
"@fortawesome/free-solid-svg-icons": "^5.15.4",
4040
"@fortawesome/react-fontawesome": "^0.1.16",
41+
"@monaco-editor/react": "^4.5.2",
4142
"@popperjs/core": "^2.10.2",
4243
"@reduxjs/toolkit": "^1.7.0",
44+
"@rjsf/bootstrap-4": "^5.12.1",
45+
"@rjsf/core": "^5.12.1",
46+
"@rjsf/utils": "^5.12.1",
47+
"@rjsf/validator-ajv8": "^5.12.1",
4348
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.3",
4449
"axios": "^0.24.0",
4550
"buffer": "^6.0.3",
@@ -56,6 +61,7 @@
5661
"prop-types": "^15.7.2",
5762
"react": "^17.0.2",
5863
"react-app-polyfill": "^2.0.0",
64+
"react-bootstrap": "^1.6.5",
5965
"react-copy-to-clipboard": "^5.0.4",
6066
"react-data-table-component": "^7.4.5",
6167
"react-datepicker": "^4.10.0",

public/version_latest.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.1.0
1+
4.2.0

src/App.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import Skeleton from 'react-loading-skeleton'
99
import TimeAgo from 'javascript-time-ago'
1010
import en from 'javascript-time-ago/locale/en.json'
1111
TimeAgo.addDefaultLocale(en)
12+
import { library } from '@fortawesome/fontawesome-svg-core'
13+
import { fas } from '@fortawesome/free-solid-svg-icons'
14+
15+
library.add(fas)
1216

1317
// Containers
1418
const DefaultLayout = React.lazy(() => import('./layout/DefaultLayout'))

src/_nav.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,11 @@ const _nav = [
171171
name: 'Individual Domain Check',
172172
to: '/tenant/standards/individual-domains',
173173
},
174+
{
175+
component: CNavItem,
176+
name: 'BPA Report Builder',
177+
to: '/tenant/tools/bpa-report-builder',
178+
},
174179
],
175180
},
176181
{

src/components/header/AppHeaderDropdown.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,30 @@ const AppHeaderDropdown = () => {
1818
const [profileVisible, setProfileVisible] = useState(false)
1919
const [cippQueueExtendedInfo, setCippQueueExtendedInfo] = useState([])
2020
const [cippQueueVisible, setCippQueueVisible] = useState(false)
21-
const [cippQueueRefresh, setCippQueueRefresh] = useState('')
21+
const [cippQueueRefresh, setCippQueueRefresh] = useState(
22+
(Math.random() + 1).toString(36).substring(7),
23+
)
2224
const { data: profile } = authApi.endpoints.loadClientPrincipal.useQueryState()
2325

2426
const [getCippQueueList, cippQueueList] = useLazyGenericGetRequestQuery()
2527

2628
function loadCippQueue() {
2729
setCippQueueVisible(true)
30+
getCippQueueList({ path: 'api/ListCippQueue', params: { refresh: cippQueueRefresh } })
31+
}
32+
33+
function refreshCippQueue() {
2834
setCippQueueRefresh((Math.random() + 1).toString(36).substring(7))
29-
getCippQueueList({ path: `api/ListCippQueue?refresh=${cippQueueRefresh}` })
35+
loadCippQueue()
3036
}
3137

3238
useEffect(() => {
33-
if (cippQueueList.isFetching) {
39+
if (cippQueueList.isFetching || cippQueueList.isLoading) {
3440
setCippQueueExtendedInfo([
3541
{
3642
label: 'Fetching recent jobs',
3743
value: 'Please wait',
38-
timpestamp: Date(),
44+
timestamp: Date(),
3945
link: '#',
4046
},
4147
])
@@ -101,6 +107,7 @@ const AppHeaderDropdown = () => {
101107
title="Recent Jobs"
102108
extendedInfo={[]}
103109
cards={cippQueueExtendedInfo}
110+
refreshFunction={refreshCippQueue}
104111
actions={[
105112
{
106113
label: 'Clear History',

src/components/layout/AppFooter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import netfriends from 'src/assets/images/netfriends.png'
88
//todo: Add darkmode detection and change logos accordingly.
99
const AppFooter = () => {
1010
return (
11-
<CFooter className="d-flex justify-content-between align-items-center">
11+
<CFooter className="d-flex justify-content-between align-items-center" position="sticky">
1212
<div className="sponsors">
1313
<p>
1414
This application is sponsored by{' '}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import PropTypes from 'prop-types'
2+
import { CellBadge } from './CellBadge'
3+
4+
export function CellDelegatedPrivilege({ cell }) {
5+
if (!cell) {
6+
return <CellBadge color="info" label="DAP" />
7+
}
8+
if (cell.toLowerCase() == 'none') {
9+
return <CellBadge color="info" label="No Access" />
10+
}
11+
if (cell === 'delegatedAdminPrivileges') {
12+
return <CellBadge color="info" label="DAP Only" />
13+
}
14+
if (cell === 'delegatedAndGranularDelegetedAdminPrivileges') {
15+
return <CellBadge color="info" label="GDAP & DAP" />
16+
}
17+
if (cell === 'granularDelegatedAdminPrivileges') {
18+
return <CellBadge color="info" label="GDAP" />
19+
}
20+
return <CellBadge color="info" label="Unknown" />
21+
}
22+
23+
CellDelegatedPrivilege.propTypes = {
24+
cell: PropTypes.string,
25+
}

src/components/tables/CippTable.js

Lines changed: 140 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
CModalBody,
1515
CModalTitle,
1616
CCallout,
17+
CFormSelect,
1718
} from '@coreui/react'
1819
import DataTable, { createTheme } from 'react-data-table-component'
1920
import PropTypes from 'prop-types'
@@ -24,6 +25,7 @@ import { cellGenericFormatter } from './CellGenericFormat'
2425
import { ModalService } from '../utilities'
2526
import { useLazyGenericGetRequestQuery, useLazyGenericPostRequestQuery } from 'src/store/api/app'
2627
import { ConfirmModal } from '../utilities/SharedModal'
28+
import { useState } from 'react'
2729

2830
const FilterComponent = ({
2931
filterText,
@@ -156,6 +158,40 @@ export default function CippTable({
156158
const [selectedRows, setSelectedRows] = React.useState(false)
157159
const [genericGetRequest, getResults] = useLazyGenericGetRequestQuery()
158160
const [genericPostRequest, postResults] = useLazyGenericPostRequestQuery()
161+
const [getDrowndownInfo, dropDownInfo] = useLazyGenericGetRequestQuery()
162+
const [modalContent, setModalContent] = useState(null)
163+
useEffect(() => {
164+
if (dropDownInfo.isFetching) {
165+
handleModal(
166+
<CSpinner />,
167+
modalContent.item.modalUrl,
168+
modalContent.item.modalType,
169+
modalContent.item.modalBody,
170+
modalContent.item.modalInput,
171+
modalContent.item.modalDropdown,
172+
)
173+
}
174+
if (dropDownInfo.isSuccess) {
175+
console.log(modalContent)
176+
handleModal(
177+
modalContent.item.modalMessage,
178+
modalContent.item.modalUrl,
179+
modalContent.item.modalType,
180+
modalContent.item.modalBody,
181+
modalContent.item.modalInput,
182+
modalContent.item.modalDropdown,
183+
)
184+
} else if (dropDownInfo.isError) {
185+
handleModal(
186+
'Error connecting to the API.',
187+
modalContent.item.modalUrl,
188+
modalContent.item.modalType,
189+
modalContent.item.modalBody,
190+
modalContent.item.modalInput,
191+
modalContent.item.modalDropdown,
192+
)
193+
}
194+
}, [dropDownInfo])
159195
const handleSelectedChange = ({ selectedRows }) => {
160196
setSelectedRows(selectedRows)
161197
if (selectedRows.length < 1) {
@@ -229,84 +265,118 @@ export default function CippTable({
229265
},
230266
},
231267
}
232-
const subHeaderComponentMemo = React.useMemo(() => {
233-
const handleClear = () => {
234-
if (filterText) {
235-
setResetPaginationToggle(!resetPaginationToggle)
236-
setFilterText('')
237-
}
238-
}
239-
const handleModal = (modalMessage, modalUrl, modalType = 'GET', modalBody, modalInput) => {
240-
if (modalType === 'GET') {
241-
ModalService.confirm({
242-
body: (
243-
<div style={{ overflow: 'visible' }}>
244-
<div>{modalMessage}</div>
245-
</div>
246-
),
247-
title: 'Confirm',
248-
onConfirm: async () => {
249-
const resultsarr = []
250-
for (const row of selectedRows) {
251-
setLoopRunning(true)
252-
const urlParams = new URLSearchParams(modalUrl.split('?')[1])
253-
for (let [paramName, paramValue] of urlParams.entries()) {
254-
if (paramValue.startsWith('!')) {
255-
urlParams.set(paramName, row[paramValue.replace('!', '')])
256-
}
268+
const handleModal = (
269+
modalMessage,
270+
modalUrl,
271+
modalType = 'GET',
272+
modalBody,
273+
modalInput,
274+
modalDropdown,
275+
) => {
276+
if (modalType === 'GET') {
277+
ModalService.confirm({
278+
body: (
279+
<div style={{ overflow: 'visible' }}>
280+
<div>{modalMessage}</div>
281+
</div>
282+
),
283+
title: 'Confirm',
284+
onConfirm: async () => {
285+
const resultsarr = []
286+
for (const row of selectedRows) {
287+
setLoopRunning(true)
288+
const urlParams = new URLSearchParams(modalUrl.split('?')[1])
289+
for (let [paramName, paramValue] of urlParams.entries()) {
290+
if (paramValue.startsWith('!')) {
291+
urlParams.set(paramName, row[paramValue.replace('!', '')])
257292
}
258-
const NewModalUrl = `${modalUrl.split('?')[0]}?${urlParams.toString()}`
259-
const results = await genericGetRequest({ path: NewModalUrl, refreshParam: row.id })
260-
resultsarr.push(results)
261-
setMassResults(resultsarr)
262293
}
263-
setLoopRunning(false)
264-
},
265-
})
266-
} else {
267-
ModalService.confirm({
268-
body: (
269-
<div style={{ overflow: 'visible' }}>
270-
{modalInput && (
271-
<div>
272-
<CFormInput ref={inputRef} type="text" />
273-
</div>
274-
)}
275-
<div>{modalMessage}</div>
276-
</div>
277-
),
278-
title: 'Confirm',
279-
onConfirm: async () => {
280-
const resultsarr = []
281-
for (const row of selectedRows) {
282-
setLoopRunning(true)
283-
const urlParams = new URLSearchParams(modalUrl.split('?')[1])
284-
for (let [paramName, paramValue] of urlParams.entries()) {
285-
if (paramValue.toString().startsWith('!')) {
286-
urlParams.set(paramName, row[paramValue.replace('!', '')])
287-
}
294+
const NewModalUrl = `${modalUrl.split('?')[0]}?${urlParams.toString()}`
295+
const results = await genericGetRequest({ path: NewModalUrl, refreshParam: row.id })
296+
resultsarr.push(results)
297+
setMassResults(resultsarr)
298+
}
299+
setLoopRunning(false)
300+
},
301+
})
302+
} else {
303+
ModalService.confirm({
304+
body: (
305+
<div style={{ overflow: 'visible' }}>
306+
{modalInput && (
307+
<div>
308+
<CFormInput ref={inputRef} type="text" />
309+
</div>
310+
)}
311+
{modalDropdown && (
312+
<div>
313+
{dropDownInfo.isSuccess && (
314+
<CFormSelect
315+
ref={inputRef}
316+
options={dropDownInfo.data.map((data) => ({
317+
value: data[modalDropdown.valueField],
318+
label: data[modalDropdown.labelField],
319+
}))}
320+
/>
321+
)}
322+
</div>
323+
)}
324+
<div>{modalMessage}</div>
325+
</div>
326+
),
327+
title: 'Confirm',
328+
onConfirm: async () => {
329+
const resultsarr = []
330+
for (const row of selectedRows) {
331+
setLoopRunning(true)
332+
const urlParams = new URLSearchParams(modalUrl.split('?')[1])
333+
for (let [paramName, paramValue] of urlParams.entries()) {
334+
if (paramValue.toString().startsWith('!')) {
335+
urlParams.set(paramName, row[paramValue.replace('!', '')])
288336
}
289-
const newModalBody = {}
290-
for (let [objName, objValue] of Object.entries(modalBody)) {
291-
if (objValue.toString().startsWith('!')) {
292-
newModalBody[objName] = row[objValue.replace('!', '')]
293-
}
337+
}
338+
const newModalBody = {}
339+
for (let [objName, objValue] of Object.entries(modalBody)) {
340+
if (objValue.toString().startsWith('!')) {
341+
newModalBody[objName] = row[objValue.replace('!', '')]
294342
}
295-
const NewModalUrl = `${modalUrl.split('?')[0]}?${urlParams.toString()}`
296-
const results = await genericPostRequest({
297-
path: NewModalUrl,
298-
values: { ...modalBody, ...newModalBody, ...{ input: inputRef.current.value } },
299-
})
300-
resultsarr.push(results)
301-
setMassResults(resultsarr)
302343
}
303-
setLoopRunning(false)
304-
},
305-
})
344+
const NewModalUrl = `${modalUrl.split('?')[0]}?${urlParams.toString()}`
345+
const results = await genericPostRequest({
346+
path: NewModalUrl,
347+
values: { ...modalBody, ...newModalBody, ...{ input: inputRef.current.value } },
348+
})
349+
resultsarr.push(results)
350+
setMassResults(resultsarr)
351+
}
352+
setLoopRunning(false)
353+
},
354+
})
355+
}
356+
}
357+
const subHeaderComponentMemo = React.useMemo(() => {
358+
const handleClear = () => {
359+
if (filterText) {
360+
setResetPaginationToggle(!resetPaginationToggle)
361+
setFilterText('')
306362
}
307363
}
364+
308365
const executeselectedAction = (item) => {
309-
handleModal(item.modalMessage, item.modalUrl, item.modalType, item.modalBody, item.modalInput)
366+
setModalContent({
367+
item,
368+
})
369+
if (item.modalDropdown) {
370+
getDrowndownInfo({ path: item.modalDropdown.url })
371+
}
372+
handleModal(
373+
item.modalMessage,
374+
item.modalUrl,
375+
item.modalType,
376+
item.modalBody,
377+
item.modalInput,
378+
item.modalDropdown,
379+
)
310380
}
311381
const defaultActions = []
312382
const dataKeys = () => {

src/components/tables/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { CellDate, cellDateFormatter } from 'src/components/tables/CellDate'
44
import { CellTip, CellTipButton, CellTipIcon } from 'src/components/tables/CellTip'
55
import { CellNullText, cellNullTextFormatter } from 'src/components/tables/CellNullText'
66
import { CellProgressBar, cellProgressBarFormatter } from 'src/components/tables/CellProgressBar'
7+
import { CellDelegatedPrivilege } from './CellDelegatedPrivilege'
78
import CippDatatable from 'src/components/tables/CippDatatable'
89
import CippOffcanvasTable from 'src/components/tables/CippOffcanvasTable'
910
import CippTable from 'src/components/tables/CippTable'
@@ -27,4 +28,5 @@ export {
2728
CippOffcanvasTable,
2829
CippTable,
2930
WizardTableField,
31+
CellDelegatedPrivilege,
3032
}

0 commit comments

Comments
 (0)