Skip to content

Commit

Permalink
Merge pull request #491 from kinvolk/group-channel-fix
Browse files Browse the repository at this point in the history
frontend: Fix group channel editing
  • Loading branch information
joaquimrocha authored Oct 4, 2021
2 parents 4bd78a1 + bd1c854 commit 3201254
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
13 changes: 11 additions & 2 deletions frontend/src/js/components/Groups/EditDialog/GroupDetailsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import { ARCHES } from '../../../utils/helpers';
export default function GroupDetailsForm(props: {
channels: Channel[];
values: { [key: string]: string };
setFieldValue: (formField: string, value: any) => any;
}) {
const { t } = useTranslation();
const { channels, values } = props;
const { channels, values, setFieldValue } = props;

return (
<div style={{ padding: '1rem' }}>
Expand All @@ -29,7 +30,15 @@ export default function GroupDetailsForm(props: {
<Grid item xs={4}>
<FormControl margin="dense" fullWidth>
<InputLabel shrink>{t('groups|Channel')}</InputLabel>
<Field name="channel" component={Select} displayEmpty defaultValue={values.channel}>
<Field
name="channel"
component={Select}
displayEmpty
defaultValue={values.channel}
onChange={(e: any) => {
setFieldValue('channel', e.target.value);
}}
>
<MenuItem value="" key="">
{t('groups|None yet')}
</MenuItem>
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/js/components/Groups/EditDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ function EditDialog(props: {
<TabPanel
index={0}
value={groupEditActiveTab}
render={() => <GroupDetailsForm channels={channels} values={values} />}
render={() => (
<GroupDetailsForm channels={channels} values={values} setFieldValue={setFieldValue} />
)}
/>
<TabPanel
index={1}
Expand Down

0 comments on commit 3201254

Please sign in to comment.