@@ -17,7 +17,16 @@ import { PropTypes } from 'prop-types'
1717import React from 'react'
1818import { Formik , Form } from 'formik'
1919import * as Yup from 'yup'
20- import { Row , Col , Card , Button , CardHeader , CardBody , CardFooter , Alert } from 'reactstrap'
20+ import {
21+ Row ,
22+ Col ,
23+ Card ,
24+ Button ,
25+ CardHeader ,
26+ CardBody ,
27+ CardFooter ,
28+ Alert ,
29+ } from 'reactstrap'
2130import {
2231 SaasBoostInput ,
2332 SaasBoostSelect ,
@@ -52,20 +61,17 @@ OnboardingFormComponent.propTypes = {
5261
5362export default function OnboardingFormComponent ( props ) {
5463 const { error, errorName, submit, cancel, config, billingPlans } = props
55- const { domainName, minCount , maxCount , computeSize , billing } = config
64+ const { domainName, tier , billing } = config
5665 const hasBilling = ! ! billing
5766 const hasDomain = ! ! domainName
5867
5968 const initialValues = {
6069 name : '' ,
70+ tier : tier || 'default ' ,
6171 subdomain : '' ,
62- planId : '' ,
63- overrideDefaults : false ,
72+ billingPlan : '' ,
6473 hasBilling : hasBilling ,
6574 hasDomain : hasDomain ,
66- computeSize : computeSize ?? '' ,
67- minCount : minCount ?? 1 ,
68- maxCount : maxCount ?? 1 ,
6975 }
7076
7177 const getBillingUi = ( plans , hasBilling ) => {
@@ -80,7 +86,12 @@ export default function OnboardingFormComponent(props) {
8086 hasBilling && (
8187 < Row >
8288 < Col >
83- < SaasBoostSelect type = "select" name = "planId" id = "planId" label = "Billing Plan" >
89+ < SaasBoostSelect
90+ type = "select"
91+ name = "billingPlan"
92+ id = "billingPlan"
93+ label = "Billing Plan"
94+ >
8495 < option value = "" > Select One...</ option >
8596 { options }
8697 </ SaasBoostSelect >
@@ -94,11 +105,19 @@ export default function OnboardingFormComponent(props) {
94105 return hasDomain ? (
95106 < Row >
96107 < Col sm = { 8 } >
97- < SaasBoostInput name = "subdomain" label = "Subdomain" type = "text" maxLength = { 25 } />
108+ < SaasBoostInput
109+ name = "subdomain"
110+ label = "Subdomain"
111+ type = "text"
112+ maxLength = { 25 }
113+ />
98114 </ Col >
99115 < Col sm = { 4 } >
100116 < div > </ div >
101- < p className = "text-muted" style = { { marginLeft : '-20px' , marginTop : '42px' } } >
117+ < p
118+ className = "text-muted"
119+ style = { { marginLeft : '-20px' , marginTop : '42px' } }
120+ >
102121 .{ domainName }
103122 </ p >
104123 </ Col >
@@ -108,41 +127,22 @@ export default function OnboardingFormComponent(props) {
108127
109128 let validationSchema
110129 validationSchema = Yup . object ( {
111- name : Yup . string ( ) . max ( 100 , 'Must be 100 characters or less.' ) . required ( 'Required' ) ,
130+ name : Yup . string ( )
131+ . max ( 100 , 'Must be 100 characters or less.' )
132+ . required ( 'Required' ) ,
133+ tier : Yup . string ( ) . optional ( ) ,
112134 subdomain : Yup . string ( )
113135 . when ( 'hasDomain' , {
114136 is : true ,
115137 then : Yup . string ( )
116- . required ( 'Required because a domain name was specified during application setup' )
138+ . required (
139+ 'Required because a domain name was specified during application setup'
140+ )
117141 . matches ( '^[a-zA-Z0-9][a-zA-Z0-9.-]+[a-zA-Z0-9]$' ) ,
118142 otherwise : Yup . string ( ) ,
119143 } )
120144 . max ( 25 , 'Must be 25 characters or less.' ) ,
121- computeSize : Yup . string ( ) . when ( 'overrideDefaults' , {
122- is : true ,
123- then : Yup . string ( ) . required ( 'Instance size is a required field.' ) ,
124- otherwise : Yup . string ( ) ,
125- } ) ,
126- minCount : Yup . number ( ) . when ( 'overrideDefaults' , {
127- is : true ,
128- then : Yup . number ( )
129- . required ( 'Minimum count is a required field.' )
130- . integer ( 'Minimum count must be an integer value' )
131- . min ( 1 , 'Minimum count must be at least ${min}' ) ,
132- otherwise : Yup . number ( ) ,
133- } ) ,
134- maxCount : Yup . number ( ) . when ( 'overrideDefaults' , {
135- is : true ,
136- then : Yup . number ( )
137- . required ( 'Maximum count is a required field.' )
138- . integer ( 'Maximum count must be an integer value' )
139- . max ( 10 , 'Maximum count can be no larger than ${max}' )
140- . test ( 'match' , 'Maximum count cannot be smaller than minimum count' , function ( maxCount ) {
141- return maxCount >= this . parent . minCount
142- } ) ,
143- otherwise : Yup . number ( ) ,
144- } ) ,
145- planId : Yup . string ( ) . when ( 'hasBilling' , {
145+ billingPlan : Yup . string ( ) . when ( 'hasBilling' , {
146146 is : true ,
147147 then : Yup . string ( ) . required ( 'Billing plan is a required field' ) ,
148148 otherwise : Yup . string ( ) ,
@@ -167,47 +167,24 @@ export default function OnboardingFormComponent(props) {
167167 < Card >
168168 < CardHeader > Onboarding Request</ CardHeader >
169169 < CardBody >
170- < SaasBoostInput name = "name" label = "Tenant Name" type = "text" maxLength = { 100 } />
171- { getDomainUi ( domainName , hasDomain ) }
172- < SaasBoostCheckbox
173- name = "overrideDefaults"
174- id = "overrideDefaults"
175- label = "Override Application Defaults"
176- value = { formik . values ?. overrideDefaults }
177- > </ SaasBoostCheckbox >
170+ < SaasBoostInput
171+ name = "name"
172+ label = "Tenant Name"
173+ type = "text"
174+ maxLength = { 100 }
175+ />
178176 < SaasBoostSelect
179- disabled = { ! formik . values . overrideDefaults }
180177 type = "select"
181- name = "computeSize"
182- id = "computeSize"
183- label = "Compute Size"
178+ name = "tier"
179+ label = "Select Tier"
184180 >
185- < option value = "" > Select One... </ option >
186- < option value = "S" > Small </ option >
187- < option value = "M" > Medium </ option >
188- < option value = "L" > Large </ option >
189- < option value = "XL" > X-Large </ option >
181+ < option value = "default" > Default </ option >
182+ < option value = "S" > Silver </ option >
183+ < option value = "G" > Gold </ option >
184+ < option value = "P" > Platinum </ option >
185+ < option value = "UB" > Onobtainium </ option >
190186 </ SaasBoostSelect >
191- < Row >
192- < Col >
193- < SaasBoostInput
194- disabled = { ! formik . values . overrideDefaults }
195- key = "minCount"
196- label = "Minimum Instance Count"
197- name = "minCount"
198- type = "number"
199- />
200- </ Col >
201- < Col >
202- < SaasBoostInput
203- disabled = { ! formik . values . overrideDefaults }
204- key = "maxCount"
205- label = "Maximum Instance Count"
206- name = "maxCount"
207- type = "number"
208- />
209- </ Col >
210- </ Row >
187+ { getDomainUi ( domainName , hasDomain ) }
211188 { getBillingUi ( billingPlans , hasBilling ) }
212189 < SaasBoostFileUpload
213190 fileMask = ".zip"
0 commit comments