@@ -40,7 +40,7 @@ import {
40
40
} from "../../../../common/utils" ;
41
41
import {
42
42
commonFormValidation ,
43
- IValidation
43
+ IValidation ,
44
44
} from "../../../../utils/validationFunctions" ;
45
45
import GenericWizard from "../../Common/GenericWizard/GenericWizard" ;
46
46
import { IWizardElement } from "../../Common/GenericWizard/types" ;
@@ -52,49 +52,50 @@ import {
52
52
ICapacity ,
53
53
ITenantCreator ,
54
54
} from "../../../../common/types" ;
55
+ import { NewTenantCredential } from "./TenantCredentialsPrompt/types" ;
55
56
56
57
interface IAddTenantProps {
57
58
open : boolean ;
58
59
closeModalAndRefresh : (
59
60
reloadData : boolean ,
60
- res : NewServiceAccount | null
61
+ res : NewTenantCredential | null
61
62
) => any ;
62
63
classes : any ;
63
64
}
64
65
65
66
const styles = ( theme : Theme ) =>
66
67
createStyles ( {
67
68
errorBlock : {
68
- color : "red"
69
+ color : "red" ,
69
70
} ,
70
71
buttonContainer : {
71
- textAlign : "right"
72
+ textAlign : "right" ,
72
73
} ,
73
74
multiContainer : {
74
75
display : "flex" ,
75
76
alignItems : "center" as const ,
76
- justifyContent : "flex-start" as const
77
+ justifyContent : "flex-start" as const ,
77
78
} ,
78
79
sizeFactorContainer : {
79
80
marginLeft : 8 ,
80
- alignSelf : "flex-start" as const
81
+ alignSelf : "flex-start" as const ,
81
82
} ,
82
83
headerElement : {
83
84
position : "sticky" ,
84
85
top : 0 ,
85
86
paddingTop : 5 ,
86
87
marginBottom : 10 ,
87
88
backgroundColor : "#fff" ,
88
- zIndex : 500
89
+ zIndex : 500 ,
89
90
} ,
90
91
tableTitle : {
91
92
fontWeight : 700 ,
92
- width : "30%"
93
+ width : "30%" ,
93
94
} ,
94
95
zoneError : {
95
96
color : "#dc1f2e" ,
96
97
fontSize : "0.75rem" ,
97
- paddingLeft : 120
98
+ paddingLeft : 120 ,
98
99
} ,
99
100
error : {
100
101
color : "#dc1f2e" ,
@@ -111,7 +112,7 @@ interface Opts {
111
112
const AddTenant = ( {
112
113
open,
113
114
closeModalAndRefresh,
114
- classes
115
+ classes,
115
116
} : IAddTenantProps ) => {
116
117
// Fields
117
118
const [ addSending , setAddSending ] = useState < boolean > ( false ) ;
@@ -212,7 +213,9 @@ const AddTenant = ({
212
213
const elements = get ( res , "elements" , [ ] ) ;
213
214
214
215
const newStorage = elements . map ( ( storageClass : any ) => {
215
- const name = get ( storageClass , "name" , "" ) . split ( "." ) [ 0 ] ;
216
+ const name = get ( storageClass , "name" , "" ) . split (
217
+ ".storageclass.storage.k8s.io/requests.storage"
218
+ ) [ 0 ] ;
216
219
217
220
return { label : name , value : name } ;
218
221
} ) ;
@@ -265,16 +268,6 @@ const AddTenant = ({
265
268
) ;
266
269
267
270
setDistribution ( distrCalculate ) ;
268
-
269
- /*const errorDistribution = get(distrCalculate, "error", "");
270
-
271
- if (errorDistribution === "") {
272
- const disksPerServer = get(distrCalculate, "disks", 0);
273
- const totalNodes = get(distrCalculate, "nodes", 0);
274
- const sizePerVolume = get(distrCalculate, "pvSize", 0);
275
-
276
- getParity(totalNodes, disksPerServer, sizePerVolume);
277
- }*/
278
271
} ;
279
272
280
273
/*Calculate Allocation End*/
@@ -301,8 +294,8 @@ const AddTenant = ({
301
294
302
295
setNameTenantValid (
303
296
! ( "tenant-name" in commonValidation ) &&
304
- ! ( "namespace" in commonValidation ) &&
305
- storageClasses . length > 0
297
+ ! ( "namespace" in commonValidation ) &&
298
+ storageClasses . length > 0
306
299
) ;
307
300
308
301
setValidationErrors ( commonValidation ) ;
@@ -337,9 +330,9 @@ const AddTenant = ({
337
330
338
331
setConfigValid (
339
332
! ( "nodes" in commonValidation ) &&
340
- ! ( "volume_size" in commonValidation ) &&
341
- ! ( "memory_per_node" in commonValidation ) &&
342
- distribution . error === ""
333
+ ! ( "volume_size" in commonValidation ) &&
334
+ ! ( "memory_per_node" in commonValidation ) &&
335
+ distribution . error === ""
343
336
) ;
344
337
345
338
setValidationErrors ( commonValidation ) ;
@@ -356,8 +349,8 @@ const AddTenant = ({
356
349
required : true ,
357
350
value : imageName ,
358
351
pattern : / ^ ( ( .* ?) \/ ( .* ?) : ( .+ ) ) $ / ,
359
- customPatternMessage : "Format must be of form: 'minio/minio:VERSION'"
360
- }
352
+ customPatternMessage : "Format must be of form: 'minio/minio:VERSION'" ,
353
+ } ,
361
354
] ;
362
355
}
363
356
@@ -590,9 +583,13 @@ const AddTenant = ({
590
583
api
591
584
. invoke ( "POST" , `/api/v1/tenants` , dataSend )
592
585
. then ( ( res ) => {
593
- const newSrvAcc : NewServiceAccount = {
586
+ const newSrvAcc : NewTenantCredential = {
594
587
accessKey : res . access_key ,
595
588
secretKey : res . secret_key ,
589
+ console : {
590
+ accessKey : res . console . access_key ,
591
+ secretKey : res . console . secret_key ,
592
+ } ,
596
593
} ;
597
594
598
595
setAddSending ( false ) ;
@@ -620,7 +617,7 @@ const AddTenant = ({
620
617
enabled : true ,
621
618
action : ( ) => {
622
619
closeModalAndRefresh ( false , null ) ;
623
- }
620
+ } ,
624
621
} ;
625
622
626
623
const wizardSteps : IWizardElement [ ] = [
@@ -690,7 +687,7 @@ const AddTenant = ({
690
687
id = "adv_mode"
691
688
name = "adv_mode"
692
689
checked = { advancedMode }
693
- onChange = { e => {
690
+ onChange = { ( e ) => {
694
691
const targetD = e . target ;
695
692
const checked = targetD . checked ;
696
693
@@ -703,8 +700,8 @@ const AddTenant = ({
703
700
) ,
704
701
buttons : [
705
702
cancelButton ,
706
- { label : "Next" , type : "next" , enabled : nameTenantValid }
707
- ]
703
+ { label : "Next" , type : "next" , enabled : nameTenantValid } ,
704
+ ] ,
708
705
} ,
709
706
{
710
707
label : "Configure" ,
@@ -1080,8 +1077,8 @@ const AddTenant = ({
1080
1077
buttons : [
1081
1078
cancelButton ,
1082
1079
{ label : "Back" , type : "back" , enabled : true } ,
1083
- { label : "Next" , type : "next" , enabled : true }
1084
- ]
1080
+ { label : "Next" , type : "next" , enabled : true } ,
1081
+ ] ,
1085
1082
} ,
1086
1083
{
1087
1084
label : "Encryption" ,
@@ -1504,8 +1501,8 @@ const AddTenant = ({
1504
1501
buttons : [
1505
1502
cancelButton ,
1506
1503
{ label : "Back" , type : "back" , enabled : true } ,
1507
- { label : "Next" , type : "next" , enabled : true }
1508
- ]
1504
+ { label : "Next" , type : "next" , enabled : true } ,
1505
+ ] ,
1509
1506
} ,
1510
1507
{
1511
1508
label : "Tenant Size" ,
@@ -1720,16 +1717,16 @@ const AddTenant = ({
1720
1717
enabled : ! addSending ,
1721
1718
action : ( ) => {
1722
1719
setAddSending ( true ) ;
1723
- }
1724
- }
1725
- ]
1726
- }
1720
+ } ,
1721
+ } ,
1722
+ ] ,
1723
+ } ,
1727
1724
] ;
1728
1725
1729
1726
let filteredWizardSteps = wizardSteps ;
1730
1727
1731
1728
if ( ! advancedMode ) {
1732
- filteredWizardSteps = wizardSteps . filter ( step => ! step . advancedOnly ) ;
1729
+ filteredWizardSteps = wizardSteps . filter ( ( step ) => ! step . advancedOnly ) ;
1733
1730
}
1734
1731
1735
1732
return (
0 commit comments