Skip to content

Commit d576f4e

Browse files
committed
Onboarding service now bound to tier service (vs. hardcoded)
1 parent 3822fc1 commit d576f4e

File tree

2 files changed

+34
-18
lines changed

2 files changed

+34
-18
lines changed

client/web/src/onboarding/OnboardingCreateContainer.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
selectPlanError,
3434
} from '../billing/ducks'
3535
import { saveToPresignedBucket } from '../settings/ducks'
36+
import { selectAllTiers } from '../tier/ducks'
3637
export default function OnboardingCreateContainer(props) {
3738
const dispatch = useDispatch()
3839
const history = useHistory()
@@ -45,6 +46,7 @@ export default function OnboardingCreateContainer(props) {
4546

4647
const loadingPlans = useSelector(selectPlanLoading)
4748
const errorPlans = useSelector(selectPlanError)
49+
const tiers = useSelector(selectAllTiers)
4850
const plans = useSelector(selectAllPlans)
4951

5052
const [file, setFile] = useState({})
@@ -106,14 +108,15 @@ export default function OnboardingCreateContainer(props) {
106108

107109
return (
108110
<OnboardingFormComponent
109-
loading={loading}
110-
error={error}
111-
errorName={errorName}
111+
billingPlans={plans}
112112
cancel={cancel}
113-
submit={submitOnboardingRequestForm}
114113
config={config}
115-
billingPlans={plans}
114+
error={error}
115+
errorName={errorName}
116+
loading={loading}
116117
onFileSelected={handleFileSelected}
118+
submit={submitOnboardingRequestForm}
119+
tiers={tiers}
117120
/>
118121
)
119122
}

client/web/src/onboarding/OnboardingFormComponent.js

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,43 @@ OnboardingFormComponent.propTypes = {
6060
}
6161

6262
export default function OnboardingFormComponent(props) {
63-
const { error, errorName, submit, cancel, config, billingPlans } = props
63+
const {
64+
error,
65+
errorName,
66+
submit,
67+
cancel,
68+
config,
69+
billingPlans,
70+
tiers,
71+
} = props
6472
const { domainName, tier, billing } = config
6573
const hasBilling = !!billing
6674
const hasDomain = !!domainName
6775

6876
const initialValues = {
6977
name: '',
70-
tier: tier || 'default ',
78+
tier: tier || 'default',
7179
subdomain: '',
7280
billingPlan: '',
7381
hasBilling: hasBilling,
7482
hasDomain: hasDomain,
7583
}
7684

85+
const getTiers = (tiers) => {
86+
const options = tiers.map((tier) => {
87+
return (
88+
<option value={tier.name} key={tier.id}>
89+
{tier.description}
90+
</option>
91+
)
92+
})
93+
return (
94+
<SaasBoostSelect type="select" name="tier" label="Select Tier">
95+
{options}
96+
</SaasBoostSelect>
97+
)
98+
}
99+
77100
const getBillingUi = (plans, hasBilling) => {
78101
const options = plans.map((plan) => {
79102
return (
@@ -173,17 +196,7 @@ export default function OnboardingFormComponent(props) {
173196
type="text"
174197
maxLength={100}
175198
/>
176-
<SaasBoostSelect
177-
type="select"
178-
name="tier"
179-
label="Select Tier"
180-
>
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>
186-
</SaasBoostSelect>
199+
{getTiers(tiers)}
187200
{getDomainUi(domainName, hasDomain)}
188201
{getBillingUi(billingPlans, hasBilling)}
189202
<SaasBoostFileUpload

0 commit comments

Comments
 (0)