@@ -78,9 +78,6 @@ export default class ProfileExplorer extends React.PureComponent<Props, State> {
7878 emitSelectProfile ( selectedProfile )
7979 }
8080
81- private readonly _handleBoot = ( ) => handleBoot ( this . state . selectedProfile )
82- private readonly _handleShutdown = ( ) => handleShutdown ( this . state . selectedProfile )
83-
8481 private updateDebouncer : null | ReturnType < typeof setTimeout > = null
8582
8683 private readonly updateFn = ( ) => {
@@ -139,20 +136,47 @@ export default class ProfileExplorer extends React.PureComponent<Props, State> {
139136 }
140137 }
141138
139+ public render ( ) {
140+ if ( this . state && this . state . catastrophicError ) {
141+ return "Internal Error"
142+ } else if ( ! this . state || ! this . state . profiles || ! this . state . selectedProfile ) {
143+ return < Loading />
144+ } else {
145+ return (
146+ < div className = "codeflare--profile-explorer flex-fill top-pad left-pad right-pad bottom-pad" >
147+ < ProfileCard
148+ profile = { this . state . selectedProfile }
149+ profiles = { this . state . profiles }
150+ onSelectProfile = { this . _handleProfileSelection }
151+ />
152+ </ div >
153+ )
154+ }
155+ }
156+ }
157+
158+ class ProfileCard extends React . PureComponent < {
159+ profile : string
160+ profiles : Profiles . Profile [ ]
161+ onSelectProfile : ( profile : string ) => void
162+ } > {
163+ private readonly _handleBoot = ( ) => handleBoot ( this . props . profile )
164+ private readonly _handleShutdown = ( ) => handleShutdown ( this . props . profile )
165+
142166 private title ( ) {
143167 return (
144168 < Title headingLevel = "h2" size = "xl" >
145- { this . state . selectedProfile }
169+ < ProfileSelect
170+ selectedProfile = { this . props . profile }
171+ profiles = { this . props . profiles }
172+ onSelect = { this . props . onSelectProfile }
173+ />
146174 </ Title >
147175 )
148176 }
149177
150178 private actions ( ) {
151- return (
152- < Title headingLevel = "h2" size = "md" >
153- Status: pending
154- </ Title >
155- )
179+ return "Status: pending"
156180 }
157181
158182 private body ( ) {
@@ -196,41 +220,23 @@ export default class ProfileExplorer extends React.PureComponent<Props, State> {
196220 </ Button >
197221 </ FlexItem >
198222 < FlexItem flex = { { default : "flex_1" } } >
199- < DashboardSelect selectedProfile = { this . state . selectedProfile } />
223+ < DashboardSelect selectedProfile = { this . props . profile } />
200224 </ FlexItem >
201225 </ Flex >
202226 )
203227 }
204228
205229 public render ( ) {
206- if ( this . state && this . state . catastrophicError ) {
207- return "Internal Error"
208- } else if ( ! this . state || ! this . state . profiles ) {
209- return < Loading />
210- } else {
211- return (
212- < Flex className = "codeflare--profile-explorer flex-fill" direction = { { default : "column" } } >
213- < FlexItem >
214- < ProfileSelect
215- selectedProfile = { this . state . selectedProfile }
216- profiles = { this . state . profiles }
217- onSelect = { this . _handleProfileSelection }
218- />
219- </ FlexItem >
220-
221- < FlexItem >
222- < Card className = "top-pad left-pad right-pad bottompad" isSelectableRaised isSelected >
223- < CardHeader >
224- < CardTitle > { this . title ( ) } </ CardTitle >
225- < CardActions hasNoOffset > { this . actions ( ) } </ CardActions >
226- </ CardHeader >
227- < CardBody > { this . body ( ) } </ CardBody >
228- < Divider />
229- < CardFooter > { this . footer ( ) } </ CardFooter >
230- </ Card >
231- </ FlexItem >
232- </ Flex >
233- )
234- }
230+ return (
231+ < Card className = "top-pad left-pad right-pad bottompad" isSelectableRaised isSelected >
232+ < CardHeader >
233+ < CardTitle > { this . title ( ) } </ CardTitle >
234+ < CardActions hasNoOffset > { this . actions ( ) } </ CardActions >
235+ </ CardHeader >
236+ < CardBody > { this . body ( ) } </ CardBody >
237+ < Divider />
238+ < CardFooter > { this . footer ( ) } </ CardFooter >
239+ </ Card >
240+ )
235241 }
236242}
0 commit comments