1
1
import React , { useState } from 'react'
2
2
import { CButton , CCallout , CCol , CForm , CRow , CSpinner , CTooltip } from '@coreui/react'
3
3
import { useSelector } from 'react-redux'
4
- import { Field , Form , FormSpy } from 'react-final-form'
5
- import {
6
- Condition ,
7
- RFFCFormInput ,
8
- RFFCFormRadio ,
9
- RFFCFormRadioList ,
10
- RFFCFormSwitch ,
11
- RFFSelectSearch ,
12
- } from 'src/components/forms'
13
- import {
14
- useGenericGetRequestQuery ,
15
- useLazyGenericGetRequestQuery ,
16
- useLazyGenericPostRequestQuery ,
17
- } from 'src/store/api/app'
4
+ import { Field , Form } from 'react-final-form'
5
+ import { Condition , RFFCFormInput , RFFCFormRadioList , RFFSelectSearch } from 'src/components/forms'
6
+ import { useLazyGenericGetRequestQuery , useLazyGenericPostRequestQuery } from 'src/store/api/app'
18
7
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
19
8
import { faCircleNotch , faEdit , faEye } from '@fortawesome/free-solid-svg-icons'
20
9
import { CippContentCard , CippPage , CippPageList } from 'src/components/layout'
21
- import { CellTip } from 'src/components/tables/CellGenericFormat'
10
+ import { CellTip , cellGenericFormatter } from 'src/components/tables/CellGenericFormat'
22
11
import 'react-datepicker/dist/react-datepicker.css'
23
- import { CippActionsOffcanvas , ModalService , TenantSelector } from 'src/components/utilities'
12
+ import { TenantSelector } from 'src/components/utilities'
24
13
import arrayMutators from 'final-form-arrays'
25
14
import DatePicker from 'react-datepicker'
26
15
import 'react-datepicker/dist/react-datepicker.css'
27
16
import { useListUsersQuery } from 'src/store/api/users'
28
- import { useListConditionalAccessPoliciesQuery } from 'src/store/api/tenants'
29
17
import GDAPRoles from 'src/data/GDAPRoles'
18
+ import { CippDatatable , cellDateFormatter } from 'src/components/tables'
30
19
31
20
const DeployJITAdmin = ( ) => {
32
21
const [ ExecuteGetRequest , getResults ] = useLazyGenericGetRequestQuery ( )
@@ -42,12 +31,13 @@ const DeployJITAdmin = () => {
42
31
const startTime = Math . floor ( startDate . getTime ( ) / 1000 )
43
32
const endTime = Math . floor ( endDate . getTime ( ) / 1000 )
44
33
const shippedValues = {
45
- tenantFilter : tenantDomain ,
34
+ TenantFilter : tenantDomain ,
46
35
UserId : values . UserId ?. value ,
47
- PolicyId : values . PolicyId ?. value ,
36
+ useraction : values . useraction ,
37
+ AdminRoles : values . AdminRoles ?. map ( ( role ) => role . value ) ,
48
38
StartDate : startTime ,
49
39
EndDate : endTime ,
50
- ExpireAction : values ? .expireAction ?? 'delete' ,
40
+ ExpireAction : values . expireAction . value ,
51
41
}
52
42
genericPostRequest ( { path : '/api/ExecJITAdmin' , values : shippedValues } ) . then ( ( res ) => {
53
43
setRefreshState ( res . requestId )
@@ -63,8 +53,8 @@ const DeployJITAdmin = () => {
63
53
return (
64
54
< CippPage title = { `Add JIT Admin` } tenantSelector = { false } >
65
55
< >
66
- < CRow >
67
- < CCol md = { 4 } >
56
+ < CRow className = "mb-3" >
57
+ < CCol lg = { 4 } md = { 12 } >
68
58
< CippContentCard title = "Add JIT Admin" icon = { faEdit } >
69
59
< Form
70
60
onSubmit = { onSubmit }
@@ -81,7 +71,9 @@ const DeployJITAdmin = () => {
81
71
< CRow className = "mb-3" >
82
72
< CCol >
83
73
< label className = "mb-2" > Tenant</ label >
84
- < Field name = "tenantFilter" > { ( props ) => < TenantSelector /> } </ Field >
74
+ < Field name = "tenantFilter" >
75
+ { ( props ) => < TenantSelector showAllTenantSelector = { false } /> }
76
+ </ Field >
85
77
</ CCol >
86
78
</ CRow >
87
79
< CRow >
@@ -102,7 +94,17 @@ const DeployJITAdmin = () => {
102
94
</ CCol >
103
95
</ CRow >
104
96
< Condition when = "useraction" is = "create" >
105
- < CRow className = "mb-3" >
97
+ < CRow >
98
+ < CCol >
99
+ < RFFCFormInput label = "First Name" name = "FirstName" />
100
+ </ CCol >
101
+ </ CRow >
102
+ < CRow >
103
+ < CCol >
104
+ < RFFCFormInput label = "Last Name" name = "LastName" />
105
+ </ CCol >
106
+ </ CRow >
107
+ < CRow >
106
108
< CCol >
107
109
< RFFCFormInput label = "User Principal Name" name = "UserPrincipalName" />
108
110
</ CCol >
@@ -124,6 +126,7 @@ const DeployJITAdmin = () => {
124
126
</ CCol >
125
127
</ CRow >
126
128
</ Condition >
129
+ < hr />
127
130
< CRow className = "mb-3" >
128
131
< CCol >
129
132
< RFFSelectSearch
@@ -217,6 +220,45 @@ const DeployJITAdmin = () => {
217
220
/>
218
221
</ CippContentCard >
219
222
</ CCol >
223
+ < CCol lg = { 8 } md = { 12 } >
224
+ < CippContentCard title = "JIT Admins" icon = "user-shield" >
225
+ < CippDatatable
226
+ title = "JIT Admins"
227
+ path = "/api/ExecJITAdmin?Action=List"
228
+ params = { { TenantFilter : tenantDomain } }
229
+ columns = { [
230
+ {
231
+ name : 'User' ,
232
+ selector : ( row ) => row [ 'userPrincipalName' ] ,
233
+ sortable : true ,
234
+ cell : cellGenericFormatter ( ) ,
235
+ exportSelector : 'userPrincipalName' ,
236
+ } ,
237
+ {
238
+ name : 'JIT Enabled' ,
239
+ selector : ( row ) => row [ 'jitAdminEnabled' ] ,
240
+ sortable : true ,
241
+ cell : cellGenericFormatter ( ) ,
242
+ exportSelector : 'jitAdminEnabled' ,
243
+ } ,
244
+ {
245
+ name : 'JIT Expires' ,
246
+ selector : ( row ) => row [ 'jitAdminExpiration' ] ,
247
+ sortable : true ,
248
+ cell : cellDateFormatter ( { format : 'short' } ) ,
249
+ exportSelector : 'jitAdminExpiration' ,
250
+ } ,
251
+ {
252
+ name : 'Admin Roles' ,
253
+ selector : ( row ) => row [ 'memberOf' ] ,
254
+ sortable : false ,
255
+ cell : cellGenericFormatter ( ) ,
256
+ exportSelector : 'memberOf' ,
257
+ } ,
258
+ ] }
259
+ />
260
+ </ CippContentCard >
261
+ </ CCol >
220
262
</ CRow >
221
263
</ >
222
264
</ CippPage >
0 commit comments