Skip to content

Commit 5f11caf

Browse files
authored
Merge pull request #2749 from JohnDuprey/dev
GDAP Invites
2 parents 04b91af + da771ee commit 5f11caf

File tree

5 files changed

+104
-5
lines changed

5 files changed

+104
-5
lines changed

src/_nav.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,12 @@ const _nav = [
326326
{
327327
component: CNavItem,
328328
name: 'Invite Wizard',
329-
to: '/tenant/administration/gdap-invite',
329+
to: '/tenant/administration/gdap-invite-wizard',
330+
},
331+
{
332+
component: CNavItem,
333+
name: 'Invite List',
334+
to: '/tenant/administration/gdap-invites',
330335
},
331336
{
332337
component: CNavItem,

src/importsMap.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ import React from 'react'
147147
"/cipp/setup": React.lazy(() => import('./views/cipp/Setup')),
148148
"/tenant/administration/securescore": React.lazy(() => import('./views/tenant/administration/SecureScore')),
149149
"/tenant/administration/gdap": React.lazy(() => import('./views/tenant/administration/GDAPWizard')),
150-
"/tenant/administration/gdap-invite": React.lazy(() => import('./views/tenant/administration/GDAPInviteWizard')),
150+
"/tenant/administration/gdap-invite-wizard": React.lazy(() => import('./views/tenant/administration/GDAPInviteWizard')),
151+
"/tenant/administration/gdap-invites": React.lazy(() => import('./views/tenant/administration/ListGDAPInvites')),
151152
"/tenant/administration/gdap-role-wizard": React.lazy(() => import('./views/tenant/administration/GDAPRoleWizard')),
152153
"/tenant/administration/gdap-roles": React.lazy(() => import('./views/tenant/administration/ListGDAPRoles')),
153154
"/tenant/administration/gdap-relationships": React.lazy(() => import('././views/tenant/administration/ListGDAPRelationships')),

src/routes.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -999,11 +999,17 @@
999999
"allowedRoles": ["admin"]
10001000
},
10011001
{
1002-
"path": "/tenant/administration/gdap-invite",
1002+
"path": "/tenant/administration/gdap-invite-wizard",
10031003
"name": "GDAP Invite Wizard",
10041004
"component": "views/tenant/administration/GDAPInviteWizard",
10051005
"allowedRoles": ["admin"]
10061006
},
1007+
{
1008+
"path": "/tenant/administration/gdap-invites",
1009+
"name": "GDAP Invites",
1010+
"component": "views/tenant/administration/ListGDAPInvites",
1011+
"allowedRoles": ["admin"]
1012+
},
10071013
{
10081014
"path": "/tenant/administration/gdap-role-wizard",
10091015
"name": "GDAP Role Wizard",

src/views/tenant/administration/GDAPInviteWizard.jsx

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const Error = ({ name }) => (
2828
render={({ meta: { touched, error } }) =>
2929
touched && error ? (
3030
<CCallout color="danger">
31-
<FontAwesomeIcon icon={faExclamationTriangle} color="danger" />
31+
<FontAwesomeIcon icon={faExclamationTriangle} color="danger" className="me-2" />
3232
{error}
3333
</CCallout>
3434
) : null
@@ -40,7 +40,31 @@ Error.propTypes = {
4040
name: PropTypes.string.isRequired,
4141
}
4242

43-
const requiredArray = (value) => (value && value.length !== 0 ? undefined : 'Required')
43+
const requiredArray = (value) => {
44+
if (value && value.length !== 0) {
45+
/// group each item in value by roleDefinitionId and select Role name where count is greater than 1
46+
const duplicateRoles = value
47+
.map((item) => item.roleDefinitionId)
48+
.filter((item, index, self) => index !== self.indexOf(item))
49+
console.log(duplicateRoles)
50+
51+
if (duplicateRoles.length > 0) {
52+
var duplicates = value.filter((item) => duplicateRoles.includes(item.roleDefinitionId))
53+
/// get unique list of duplicate roles
54+
duplicates = duplicates
55+
.filter(
56+
(role, index, self) =>
57+
index === self.findIndex((t) => t.roleDefinitionId === role.roleDefinitionId),
58+
)
59+
.map((role) => role.RoleName)
60+
return `Duplicate GDAP Roles selected, remove one of the mapped groups for the listed roles to continue: ${duplicates}`
61+
} else {
62+
return undefined
63+
}
64+
} else {
65+
return 'You must select at least one GDAP Role'
66+
}
67+
}
4468

4569
const GDAPInviteWizard = () => {
4670
const defaultRolesArray = [
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import React from 'react'
2+
import { CippPageList } from 'src/components/layout'
3+
import { TitleButton } from 'src/components/buttons'
4+
import { cellGenericFormatter } from 'src/components/tables/CellGenericFormat'
5+
import { cellDateFormatter } from 'src/components/tables'
6+
7+
const ListGDAPInvites = () => {
8+
const columns = [
9+
{
10+
name: 'Created',
11+
selector: (row) => row['Timestamp'],
12+
sortable: true,
13+
exportSelector: 'Timestamp',
14+
cell: cellDateFormatter({ format: 'short' }),
15+
},
16+
{
17+
name: 'Relationship ID',
18+
selector: (row) => row['RowKey'],
19+
sortable: true,
20+
exportSelector: 'RowKey',
21+
cell: cellGenericFormatter(),
22+
},
23+
{
24+
name: 'Invite URL',
25+
selector: (row) => row['InviteUrl'],
26+
exportSelector: 'InviteUrl',
27+
cell: cellGenericFormatter(),
28+
},
29+
{
30+
name: 'Onboarding URL',
31+
selector: (row) => row['OnboardingUrl'],
32+
exportSelector: 'OnboardingUrl',
33+
cell: cellGenericFormatter(),
34+
},
35+
{
36+
name: 'Role Mapping',
37+
selector: (row) => row['RoleMappings'],
38+
exportSelector: 'RoleMappings',
39+
cell: cellGenericFormatter(),
40+
},
41+
]
42+
return (
43+
<div>
44+
<CippPageList
45+
capabilities={{ allTenants: true, helpContext: 'https://google.com' }}
46+
title="GDAP Invite List"
47+
tenantSelector={false}
48+
datatable={{
49+
keyField: 'id',
50+
columns,
51+
reportName: `GDAP-Invite-List`,
52+
path: '/api/ListGDAPInvite',
53+
tableProps: {
54+
selectableRows: true,
55+
keyField: 'RowKey',
56+
},
57+
}}
58+
/>
59+
</div>
60+
)
61+
}
62+
63+
export default ListGDAPInvites

0 commit comments

Comments
 (0)