@@ -72,6 +72,7 @@ import { setModalErrorSnackMessage } from "../../../../actions";
72
72
import { getHardcodedAffinity } from "../TenantDetails/utils" ;
73
73
import history from "../../../../history" ;
74
74
import PageHeader from "../../Common/PageHeader/PageHeader" ;
75
+ import CredentialsPrompt from "../../Common/CredentialsPrompt/CredentialsPrompt" ;
75
76
76
77
interface IAddTenantProps {
77
78
open : boolean ;
@@ -140,6 +141,13 @@ const styles = (theme: Theme) =>
140
141
} ) ;
141
142
142
143
const AddTenant = ( { classes } : IAddTenantProps ) => {
144
+ // Modals
145
+ const [ showNewCredentials , setShowNewCredentials ] = useState < boolean > ( false ) ;
146
+ const [
147
+ createdAccount ,
148
+ setCreatedAccount ,
149
+ ] = useState < NewServiceAccount | null > ( null ) ;
150
+
143
151
// Fields
144
152
const [ addSending , setAddSending ] = useState < boolean > ( false ) ;
145
153
const [ tenantName , setTenantName ] = useState < string > ( "" ) ;
@@ -292,6 +300,10 @@ const AddTenant = ({ classes }: IAddTenantProps) => {
292
300
const [ vaultCAVal , setVaultCAVal ] = useState < string > ( "" ) ;
293
301
const [ gemaltoCAVal , setGemaltoCAVal ] = useState < string > ( "" ) ;
294
302
303
+ // Flow
304
+
305
+ const showCredentialsAndRedirect = ( ) => { } ;
306
+
295
307
// CA Certificates functions
296
308
const addCaCertificate = ( ) => {
297
309
setCaCertificates ( ( currentCertificates ) => [
@@ -1225,7 +1237,9 @@ const AddTenant = ({ classes }: IAddTenantProps) => {
1225
1237
} ;
1226
1238
1227
1239
setAddSending ( false ) ;
1228
- history . push ( "/tenants" ) ;
1240
+
1241
+ setShowNewCredentials ( true ) ;
1242
+ setCreatedAccount ( newSrvAcc ) ;
1229
1243
} )
1230
1244
. catch ( ( err ) => {
1231
1245
setAddSending ( false ) ;
@@ -2831,13 +2845,27 @@ const AddTenant = ({ classes }: IAddTenantProps) => {
2831
2845
filteredWizardSteps = wizardSteps . filter ( ( step ) => ! step . advancedOnly ) ;
2832
2846
}
2833
2847
2848
+ const closeCredentialsModal = ( ) => {
2849
+ history . push ( "/tenants" ) ;
2850
+ } ;
2851
+
2834
2852
return (
2835
2853
< React . Fragment >
2836
2854
{ addSending && (
2837
2855
< Grid item xs = { 12 } >
2838
2856
< LinearProgress />
2839
2857
</ Grid >
2840
2858
) }
2859
+ { showNewCredentials && (
2860
+ < CredentialsPrompt
2861
+ newServiceAccount = { createdAccount }
2862
+ open = { showNewCredentials }
2863
+ closeModal = { ( ) => {
2864
+ closeCredentialsModal ( ) ;
2865
+ } }
2866
+ entity = "Tenant"
2867
+ />
2868
+ ) }
2841
2869
< PageHeader label = { "Add Tenant" } />
2842
2870
< Grid container >
2843
2871
< Grid item xs = { 12 } className = { classes . container } >
0 commit comments