Skip to content

Commit fd46595

Browse files
committed
fix: implement profile selection change in new ProfileExplorer
Fixes #425
1 parent 7b6d331 commit fd46595

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

plugins/plugin-codeflare/src/components/ProfileExplorer.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ export default class ProfileExplorer extends React.PureComponent<Props, State> {
7373
this.init()
7474
}
7575

76+
private readonly _handleProfileSelection = (selectedProfile: string) => {
77+
this.setState({ selectedProfile })
78+
emitSelectProfile(selectedProfile)
79+
}
80+
7681
private readonly _handleBoot = () => handleBoot(this.state.selectedProfile)
7782
private readonly _handleShutdown = () => handleShutdown(this.state.selectedProfile)
7883

@@ -206,7 +211,11 @@ export default class ProfileExplorer extends React.PureComponent<Props, State> {
206211
return (
207212
<Flex className="codeflare--profile-explorer flex-fill" direction={{ default: "column" }}>
208213
<FlexItem>
209-
<ProfileSelect selectedProfile={this.state.selectedProfile} profiles={this.state.profiles} />
214+
<ProfileSelect
215+
selectedProfile={this.state.selectedProfile}
216+
profiles={this.state.profiles}
217+
onSelect={this._handleProfileSelection}
218+
/>
210219
</FlexItem>
211220

212221
<FlexItem>

plugins/plugin-codeflare/src/components/ProfileSelect.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { UserIcon } from "@patternfly/react-icons"
2323
type Props = {
2424
selectedProfile?: string
2525
profiles?: Profiles.Profile[]
26+
onSelect: (profile: string) => void
2627
}
2728

2829
type State = {
@@ -67,6 +68,7 @@ export default class ProfileSelect extends React.PureComponent<Props, State> {
6768
selectDefaultOption: selection,
6869
selectIsOpen: false,
6970
})
71+
this.props.onSelect(selection.toString())
7072
}
7173
}
7274

0 commit comments

Comments
 (0)