Skip to content

Commit 96c0501

Browse files
Merge pull request #1526 from KelvinTegelaar/dev
Dev to release
2 parents bd6a41a + d7c6b9f commit 96c0501

32 files changed

+990
-325
lines changed

public/version_latest.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.4.0
1+
3.5.0

src/_nav.js

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
faExclamationTriangle,
1919
faUserShield,
2020
faEnvelope,
21+
faToolbox,
2122
} from '@fortawesome/free-solid-svg-icons'
2223

2324
const _nav = [
@@ -134,6 +135,35 @@ const _nav = [
134135
},
135136
],
136137
},
138+
{
139+
component: CNavGroup,
140+
name: 'Tools',
141+
section: 'Tools',
142+
to: '/tenant/administration',
143+
icon: <FontAwesomeIcon icon={faToolbox} className="nav-icon" />,
144+
items: [
145+
{
146+
component: CNavItem,
147+
name: 'Graph Explorer',
148+
to: '/tenant/administration/graph-explorer',
149+
},
150+
{
151+
component: CNavItem,
152+
name: 'Application Approval',
153+
to: '/tenant/administration/appapproval',
154+
},
155+
{
156+
component: CNavItem,
157+
name: 'Tenant Lookup',
158+
to: '/tenant/administration/tenantlookup',
159+
},
160+
{
161+
component: CNavItem,
162+
name: 'Individual Domain Check',
163+
to: '/tenant/standards/individual-domains',
164+
},
165+
],
166+
},
137167
{
138168
component: CNavGroup,
139169
name: 'Standards',
@@ -161,11 +191,6 @@ const _nav = [
161191
name: 'Domains Analyser',
162192
to: '/tenant/standards/domains-analyser',
163193
},
164-
{
165-
component: CNavItem,
166-
name: 'Individual Domain Check',
167-
to: '/tenant/standards/individual-domains',
168-
},
169194
],
170195
},
171196
{
@@ -214,11 +239,6 @@ const _nav = [
214239
to: '/tenant/reports',
215240
icon: <FontAwesomeIcon icon={faChartBar} className="nav-icon" />,
216241
items: [
217-
{
218-
component: CNavItem,
219-
name: 'Graph Explorer',
220-
to: '/tenant/administration/graph-explorer',
221-
},
222242
{
223243
component: CNavItem,
224244
name: 'Licence Report',
@@ -671,8 +691,8 @@ const _nav = [
671691
},
672692
{
673693
component: CNavItem,
674-
name: 'Application Approval',
675-
to: '/tenant/administration/appapproval',
694+
name: 'GDAP Relationships',
695+
to: '/tenant/administration/gdap-relationships',
676696
},
677697
{
678698
component: CNavItem,

src/adminRoutes.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ const GDAPStatus = React.lazy(() => import('src/views/tenant/administration/List
66
const GDAP = React.lazy(() => import('src/views/tenant/administration/GDAPWizard'))
77
const GDAPRoleWizard = React.lazy(() => import('src/views/tenant/administration/GDAPRoleWizard'))
88
const GDAPRoles = React.lazy(() => import('src/views/tenant/administration/ListGDAPRoles'))
9+
const GDAPRelationships = React.lazy(() =>
10+
import('./views/tenant/administration/ListGDAPRelationships'),
11+
)
912
const appapproval = React.lazy(() => import('src/views/cipp/AppApproval'))
1013

1114
const adminRoutes = [
@@ -24,6 +27,11 @@ const adminRoutes = [
2427
name: 'GDAP Roles',
2528
component: GDAPRoles,
2629
},
30+
{
31+
path: '/tenant/administration/gdap-relationships',
32+
name: 'GDAP Relationships',
33+
component: GDAPRelationships,
34+
},
2735
{ path: '/tenant/administration/appapproval', name: 'App Approval', component: appapproval },
2836
{ path: '/tenant/administration/gdap-status', name: 'GDAP Status', component: GDAPStatus },
2937
{ path: '/tenant/standards/apply-standard', name: 'Apply Standard', component: ApplyStandard },

src/components/header/AppHeaderSearch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ const AppHeaderSearch = () => {
1212
}, [dispatch])
1313
return (
1414
<>
15-
<CButton size="sm" variant="ghost" onClick={handleFastSwitcher}>
16-
<FontAwesomeIcon icon={faSearch} />
15+
<CButton variant="ghost" onClick={handleFastSwitcher}>
16+
<FontAwesomeIcon icon={faSearch} size="lg" />
1717
</CButton>
1818
</>
1919
)

src/components/layout/AppHeader.js

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import React from 'react'
22
import { useSelector, useDispatch } from 'react-redux'
33
import {
4+
CAlert,
5+
CAlertLink,
46
CContainer,
7+
CCollapse,
58
CHeader,
69
CHeaderNav,
10+
CNavItem,
711
CHeaderToggler,
812
CImage,
913
CSidebarBrand,
@@ -17,16 +21,23 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
1721
import { faCaretSquareLeft, faCaretSquareRight } from '@fortawesome/free-solid-svg-icons'
1822
import { toggleSidebarShow } from 'src/store/features/app'
1923
import { useMediaPredicate } from 'react-media-hook'
24+
import { useGenericGetRequestQuery } from 'src/store/api/app'
2025

2126
const AppHeader = () => {
2227
const dispatch = useDispatch()
2328
const sidebarShow = useSelector((state) => state.app.sidebarShow)
2429
const currentTheme = useSelector((state) => state.app.currentTheme)
2530
const preferredTheme = useMediaPredicate('(prefers-color-scheme: dark)') ? 'impact' : 'cyberdrain'
31+
const {
32+
data: dashboard,
33+
isLoading: isLoadingDash,
34+
isSuccess: issuccessDash,
35+
} = useGenericGetRequestQuery({ path: '/api/GetCippAlerts' })
36+
2637
return (
27-
<CHeader position="sticky">
28-
<CContainer fluid>
29-
<CSidebarBrand className="me-auto p-2" to="/">
38+
<>
39+
<CHeader position="sticky">
40+
<CSidebarBrand className="me-auto pt-xs-2 p-md-2" to="/">
3041
<CImage
3142
className="sidebar-brand-full me-2"
3243
src={
@@ -47,16 +58,31 @@ const AppHeader = () => {
4758
className="me-2"
4859
/>
4960
</CHeaderToggler>
50-
<TenantSelector className="me-2" NavSelector={true} />
5161
</CHeaderNav>
5262
</CSidebarBrand>
53-
54-
<CHeaderNav className="ms-auto p-2">
55-
<AppHeaderSearch />
56-
<AppHeaderDropdown />
63+
<CHeaderNav className="p-md-2 flex-grow-1">
64+
<TenantSelector NavSelector={true} />
65+
<CNavItem>
66+
<AppHeaderSearch />
67+
</CNavItem>
68+
<CNavItem>
69+
<AppHeaderDropdown />
70+
</CNavItem>
5771
</CHeaderNav>
58-
</CContainer>
59-
</CHeader>
72+
</CHeader>
73+
74+
{dashboard &&
75+
dashboard.map((item, index) => (
76+
<div
77+
className="mb-3"
78+
style={{ zIndex: 10000, 'padding-left': '20rem', 'padding-right': '3rem' }}
79+
>
80+
<CAlert key={index} color={item.type} variant dismissible>
81+
{item.Alert} <CAlertLink href={item.link}>Link</CAlertLink>
82+
</CAlert>
83+
</div>
84+
))}
85+
</>
6086
)
6187
}
6288

src/components/tables/CellDate.js

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ import React from 'react'
22
import moment from 'moment'
33
import PropTypes from 'prop-types'
44
import { CTooltip } from '@coreui/react'
5+
import TimeAgo from 'javascript-time-ago'
6+
import en from 'javascript-time-ago/locale/en.json'
7+
TimeAgo.addDefaultLocale(en)
8+
import ReactTimeAgo from 'react-time-ago'
59

610
/**
711
*
8-
* @param format ['short', 'long']
12+
* @param format ['short', 'long', 'relative']
913
* @param value
1014
* @returns {JSX.Element}
1115
* @constructor
@@ -27,35 +31,52 @@ export const CellDate = ({ format = 'short', showTime = true, showDate = true, c
2731
]
2832

2933
const dateTimeFormatOptions = {}
34+
if (format == 'relative') {
35+
try {
36+
return (
37+
<CTooltip content={cell}>
38+
<ReactTimeAgo date={cell} />
39+
</CTooltip>
40+
)
41+
} catch (error) {
42+
console.error('Error formatting date, fallback to string value', { date: cell, error })
43+
return (
44+
<CTooltip content={cell}>
45+
<div>{String(cell)}</div>
46+
</CTooltip>
47+
)
48+
}
49+
} else {
50+
if (showTime) {
51+
dateTimeFormatOptions.timeStyle = format
52+
}
53+
if (showDate) {
54+
dateTimeFormatOptions.dateStyle = format
55+
}
3056

31-
if (showTime) {
32-
dateTimeFormatOptions.timeStyle = format
33-
}
34-
if (showDate) {
35-
dateTimeFormatOptions.dateStyle = format
36-
}
57+
dateTimeArgs.push(dateTimeFormatOptions)
3758

38-
dateTimeArgs.push(dateTimeFormatOptions)
59+
let formatted
3960

40-
let formatted
41-
try {
42-
// lots of dates returned are unreliably parsable (e.g. non ISO8601 format)
43-
// fallback using moment to parse into date object
44-
formatted = new Intl.DateTimeFormat(...dateTimeArgs).format(moment(cell).toDate())
45-
} catch (error) {
46-
console.error('Error formatting date, fallback to string value', { date: cell, error })
47-
formatted = cell
48-
}
61+
try {
62+
// lots of dates returned are unreliably parsable (e.g. non ISO8601 format)
63+
// fallback using moment to parse into date object
64+
formatted = new Intl.DateTimeFormat(...dateTimeArgs).format(moment(cell).toDate())
65+
} catch (error) {
66+
console.error('Error formatting date, fallback to string value', { date: cell, error })
67+
formatted = cell
68+
}
4969

50-
return (
51-
<CTooltip content={cell}>
52-
<div>{String(formatted)}</div>
53-
</CTooltip>
54-
)
70+
return (
71+
<CTooltip content={cell}>
72+
<div>{String(formatted)}</div>
73+
</CTooltip>
74+
)
75+
}
5576
}
5677

5778
CellDate.propTypes = {
58-
format: PropTypes.oneOf(['short', 'medium', 'long', 'full']),
79+
format: PropTypes.oneOf(['short', 'medium', 'long', 'full', 'relative']),
5980
cell: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date)]),
6081
showTime: PropTypes.bool,
6182
showDate: PropTypes.bool,

src/components/tables/CellGenericFormat.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ export const cellGenericFormatter =
7979
return CellTip(cell)
8080
}
8181
if (Array.isArray(cell) || typeof cell === 'object') {
82-
console.log(cell)
8382
return CellTip(JSON.stringify(cell))
8483
}
8584
}

src/components/tables/CippDatatable.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,20 @@ import { CippTablePropTypes } from 'src/components/tables/CippTable'
66

77
export default function CippDatatable({ path, params, ...rest }) {
88
const [refreshGuid, setRefreshGuid] = React.useState('')
9+
const [graphFilter, setGraphFilter] = React.useState('')
910
const {
1011
data = [],
1112
isFetching,
1213
error,
13-
} = useListDatatableQuery({ path, params: { refreshGuid, ...params } })
14+
} = useListDatatableQuery({ path, params: { refreshGuid, graphFilter, ...params } })
1415
return (
1516
<CippTable
1617
{...rest}
1718
data={data}
1819
isFetching={isFetching}
1920
error={error}
2021
refreshFunction={setRefreshGuid}
22+
graphFilterFunction={setGraphFilter}
2123
/>
2224
)
2325
}

0 commit comments

Comments
 (0)