@@ -8,16 +8,17 @@ import {
8
8
CFormInput ,
9
9
CFormLabel ,
10
10
CFormRange ,
11
+ CProgress ,
11
12
} from '@coreui/react'
12
13
import { Field , FormSpy } from 'react-final-form'
13
14
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
14
15
import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons'
15
16
import { CippWizard } from 'src/components/layout'
16
- import { WizardTableField } from 'src/components/tables'
17
+ import { CippTable , WizardTableField } from 'src/components/tables'
17
18
import { TitleButton } from 'src/components/buttons'
18
19
import PropTypes from 'prop-types'
19
20
import { useLazyGenericGetRequestQuery , useLazyGenericPostRequestQuery } from 'src/store/api/app'
20
- import { CippCodeBlock } from 'src/components/utilities '
21
+ import { cellGenericFormatter } from 'src/components/tables/CellGenericFormat '
21
22
22
23
const Error = ( { name } ) => (
23
24
< Field
@@ -52,14 +53,46 @@ const GDAPInviteWizard = () => {
52
53
setLoopRunning ( true )
53
54
for ( var x = 0 ; x < inviteCount ; x ++ ) {
54
55
const results = await genericPostRequest ( { path : '/api/ExecGDAPInvite' , values : values } )
55
- resultsarr . push ( results )
56
+ resultsarr . push ( results . data )
56
57
setMassResults ( resultsarr )
57
58
}
58
59
setLoopRunning ( false )
59
60
}
60
61
61
62
const formValues = { }
62
63
64
+ const inviteColumns = [
65
+ {
66
+ name : 'Id' ,
67
+ selector : ( row ) => row ?. Invite ?. RowKey ,
68
+ exportSelector : 'Invite/RowKey' ,
69
+ sortable : true ,
70
+ omit : true ,
71
+ cell : cellGenericFormatter ( ) ,
72
+ } ,
73
+ {
74
+ name : 'Invite Link' ,
75
+ sortable : true ,
76
+ selector : ( row ) => row ?. Invite ?. InviteUrl ,
77
+ exportSelector : 'Invite/InviteUrl' ,
78
+ cell : cellGenericFormatter ( ) ,
79
+ } ,
80
+ {
81
+ name : 'Onboarding Link' ,
82
+ sortable : true ,
83
+ selector : ( row ) => row ?. Invite ?. OnboardingUrl ,
84
+ exportSelector : 'Invite/OnboardingUrl' ,
85
+ cell : cellGenericFormatter ( ) ,
86
+ } ,
87
+ {
88
+ name : 'Message' ,
89
+ sortable : true ,
90
+ selector : ( row ) => row ?. Message ,
91
+ exportSelector : 'Message' ,
92
+ cell : cellGenericFormatter ( ) ,
93
+ } ,
94
+ ]
95
+
63
96
return (
64
97
< CippWizard
65
98
initialValues = { { ...formValues } }
@@ -183,37 +216,31 @@ const GDAPInviteWizard = () => {
183
216
} }
184
217
</ FormSpy >
185
218
) }
186
- { ( massResults . length >= 1 || loopRunning ) &&
187
- massResults . map ( ( message , idx ) => {
188
- const results = message ?. data
189
- const displayResults = Array . isArray ( results ) ? results . join ( ', ' ) : results
190
- return (
191
- < CCallout color = "success" key = { idx } >
192
- { results . Results . map ( ( message , idx ) => {
193
- return < li key = { idx } > { message } </ li >
194
- } ) }
195
- < CippCodeBlock
196
- key = { idx }
197
- code = { results . Invite . InviteUrl }
198
- showLineNumbers = { false }
199
- wrapLongLines = { true }
200
- language = "text"
201
- />
219
+ { ( massResults . length >= 1 || loopRunning ) && (
220
+ < >
221
+ < div style = { { width : '100%' } } className = "mb-3" >
222
+ { loopRunning ? (
223
+ < span >
224
+ Generating Invites < CSpinner className = "ms-2" size = "sm" />
225
+ </ span >
226
+ ) : (
227
+ < span >
228
+ Generating Invites
229
+ < FontAwesomeIcon className = "ms-2" icon = "check-circle" />
230
+ </ span >
231
+ ) }
232
+ < CProgress className = "mt-2" value = { ( massResults . length / inviteCount ) * 100 } >
233
+ { massResults . length } /{ inviteCount }
234
+ </ CProgress >
235
+ </ div >
202
236
203
- < TitleButton
204
- href = {
205
- '/tenant/administration/tenant-onboarding-wizard?tableFilter=Complex: id eq ' +
206
- results . Invite . RowKey
207
- }
208
- title = "Start Onboarding"
209
- />
210
- </ CCallout >
211
- )
212
- } ) }
213
- { loopRunning && (
214
- < li >
215
- < CSpinner size = "sm" />
216
- </ li >
237
+ < CippTable
238
+ reportName = "gdap-invites"
239
+ data = { massResults }
240
+ columns = { inviteColumns }
241
+ disablePDFExport = { true }
242
+ />
243
+ </ >
217
244
) }
218
245
< hr className = "my-4" />
219
246
</ CippWizard . Page >
0 commit comments