@@ -32,10 +32,10 @@ interface ClusterDetailsProps {
3232}
3333
3434const DEPLOYMENT_FULL_DESCRIPTION : { [ key : string ] : string } = {
35- " Colocated" : "Colocated (shared infrastructure for optimized value)" ,
36- " Dedicated" : " Dedicated (dedicated infrastructure for consistent performance)" ,
37- " Self-Hosted" : "Self-Hosted (your own infrastructure)" ,
38- }
35+ ' Colocated' : 'Shared infrastructure for optimized value' ,
36+ ' Dedicated' : ' Dedicated infrastructure for consistent performance' ,
37+ ' Self-Hosted' : 'Your own infrastructure' ,
38+ } ;
3939
4040export function ClusterDetails ( {
4141 calculatedNames,
@@ -51,14 +51,37 @@ export function ClusterDetails({
5151 totalPrice,
5252} : ClusterDetailsProps ) {
5353 const { isDirty, isValid } = useFormState ( ) ;
54- const availablePerformanceDescriptions = useMemo ( ( ) =>
55- Object . keys ( deploymentToPerformanceToPlan [ selectedDeployment ] || { } ) , [ deploymentToPerformanceToPlan , selectedDeployment ] ) ;
54+ const availablePerformanceDescriptions = useMemo ( ( ) => {
55+ return Object . keys ( deploymentToPerformanceToPlan [ selectedDeployment ] || { } ) . map ( performanceTier => {
56+ const splitByParens = performanceTier . slice ( 0 , - 1 ) . split ( '(' ) ;
57+ if ( splitByParens . length > 1 ) {
58+ return {
59+ performanceTier,
60+ name : splitByParens [ 0 ] ,
61+ description : splitByParens [ 1 ] ,
62+ } ;
63+ }
64+ const splitByFor = performanceTier . split ( ' for ' ) ;
65+ if ( splitByFor . length > 1 ) {
66+ return {
67+ performanceTier,
68+ name : splitByFor [ 0 ] ,
69+ description : 'For ' + splitByFor [ 1 ] ,
70+ } ;
71+ }
72+ return {
73+ performanceTier,
74+ name : performanceTier ,
75+ description : '' ,
76+ } ;
77+ } ) ;
78+ } , [ deploymentToPerformanceToPlan , selectedDeployment ] ) ;
5679 const availableDeploymentTypes = useMemo ( ( ) =>
5780 Object . keys ( deploymentToPerformanceToPlan ) . sort ( ) , [ deploymentToPerformanceToPlan ] ) ;
5881
5982 useEffect ( function autoSelectFirstAvailablePerformanceDescription ( ) {
60- if ( availablePerformanceDescriptions ?. length && ! availablePerformanceDescriptions . includes ( selectedPerformance ) ) {
61- form . setValue ( 'performanceDescription' , availablePerformanceDescriptions [ 0 ] ) ;
83+ if ( availablePerformanceDescriptions ?. length && ! availablePerformanceDescriptions . find ( sp => sp . performanceTier === selectedPerformance ) ) {
84+ form . setValue ( 'performanceDescription' , availablePerformanceDescriptions [ 0 ] . performanceTier ) ;
6285 void form . trigger ( ) ;
6386 }
6487 } , [ selectedDeployment , selectedPerformance , availablePerformanceDescriptions , form ] ) ;
@@ -102,7 +125,7 @@ export function ClusterDetails({
102125 field . onChange ( deploymentDescription ) ;
103126 void form . trigger ( ) ;
104127 } } >
105- < SelectTrigger className = "w-full" >
128+ < SelectTrigger className = "w-full h-auto " >
106129 < SelectValue placeholder = "Choose Tier" />
107130 </ SelectTrigger >
108131 < SelectContent >
@@ -111,7 +134,11 @@ export function ClusterDetails({
111134 < SelectItem
112135 key = { deploymentDescription }
113136 value = { deploymentDescription }
114- > { DEPLOYMENT_FULL_DESCRIPTION [ deploymentDescription ] ?? deploymentDescription } </ SelectItem >
137+ >
138+ < dt className = "text-left font-bold text-sm/6" > { deploymentDescription } </ dt >
139+ { DEPLOYMENT_FULL_DESCRIPTION [ deploymentDescription ] && (
140+ < dd className = "font-light" > { DEPLOYMENT_FULL_DESCRIPTION [ deploymentDescription ] } </ dd > ) }
141+ </ SelectItem >
115142 ) ) }
116143 </ SelectGroup >
117144 </ SelectContent >
@@ -138,16 +165,20 @@ export function ClusterDetails({
138165 void form . trigger ( ) ;
139166 } }
140167 disabled = { ! availablePerformanceDescriptions ?. length } >
141- < SelectTrigger className = "w-full" >
168+ < SelectTrigger className = "w-full h-auto " >
142169 < SelectValue placeholder = "Choose Tier" />
143170 </ SelectTrigger >
144171 < SelectContent >
145172 < SelectGroup >
146173 { availablePerformanceDescriptions . map ( ( performanceDescription ) => (
147174 < SelectItem
148- key = { performanceDescription }
149- value = { performanceDescription }
150- > { performanceDescription } </ SelectItem >
175+ key = { performanceDescription . name }
176+ value = { performanceDescription . performanceTier }
177+ >
178+ < dt className = "text-left font-bold text-sm/6" > { performanceDescription . name } </ dt >
179+ { performanceDescription . description && (
180+ < dd className = "font-light" > { performanceDescription . description } </ dd > ) }
181+ </ SelectItem >
151182 ) ) }
152183 </ SelectGroup >
153184 </ SelectContent >
0 commit comments