From 0349ee60fbdd56ed151ea3e29e3bccd90edb0c23 Mon Sep 17 00:00:00 2001 From: Nick Mitchell Date: Wed, 3 Aug 2022 11:59:33 -0400 Subject: [PATCH] fix: implement profile selection change in new ProfileExplorer Fixes #425 --- .../src/components/ProfileExplorer.tsx | 11 ++++++++++- .../plugin-codeflare/src/components/ProfileSelect.tsx | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/plugin-codeflare/src/components/ProfileExplorer.tsx b/plugins/plugin-codeflare/src/components/ProfileExplorer.tsx index a4bc9d32..0b1affe9 100644 --- a/plugins/plugin-codeflare/src/components/ProfileExplorer.tsx +++ b/plugins/plugin-codeflare/src/components/ProfileExplorer.tsx @@ -73,6 +73,11 @@ export default class ProfileExplorer extends React.PureComponent { this.init() } + private readonly _handleProfileSelection = (selectedProfile: string) => { + this.setState({ selectedProfile }) + emitSelectProfile(selectedProfile) + } + private readonly _handleBoot = () => handleBoot(this.state.selectedProfile) private readonly _handleShutdown = () => handleShutdown(this.state.selectedProfile) @@ -206,7 +211,11 @@ export default class ProfileExplorer extends React.PureComponent { return ( - + diff --git a/plugins/plugin-codeflare/src/components/ProfileSelect.tsx b/plugins/plugin-codeflare/src/components/ProfileSelect.tsx index d5f390da..f0845399 100644 --- a/plugins/plugin-codeflare/src/components/ProfileSelect.tsx +++ b/plugins/plugin-codeflare/src/components/ProfileSelect.tsx @@ -23,6 +23,7 @@ import { UserIcon } from "@patternfly/react-icons" type Props = { selectedProfile?: string profiles?: Profiles.Profile[] + onSelect: (profile: string) => void } type State = { @@ -67,6 +68,7 @@ export default class ProfileSelect extends React.PureComponent { selectDefaultOption: selection, selectIsOpen: false, }) + this.props.onSelect(selection.toString()) } }