-
Notifications
You must be signed in to change notification settings - Fork 138
feat(ui): new ux for run model settings #1386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| /** | ||
| * Copyright 2025 © BeeAI a Series of LF Projects, LLC | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import { Checkmark } from '@carbon/icons-react'; | ||
| import { RadioButton, RadioButtonGroup } from '@carbon/react'; | ||
| import clsx from 'clsx'; | ||
| import { useId } from 'react'; | ||
|
|
||
| import classes from './RadioSelect.module.scss'; | ||
|
|
||
| interface Props { | ||
| name: string; | ||
| label: string; | ||
| value?: string; | ||
| options: { value: string; label: string }[]; | ||
| onChange: (value: string) => void; | ||
| } | ||
|
|
||
| export function RadioSelect({ name, label, value, options, onChange }: Props) { | ||
| const htmlId = useId(); | ||
|
|
||
| return ( | ||
| <RadioButtonGroup | ||
| legendText={label} | ||
| name={name} | ||
| valueSelected={value} | ||
| orientation="vertical" | ||
| className={classes.root} | ||
| > | ||
| {options.map(({ value: optionValue, label }) => { | ||
| const isSelected = optionValue === value; | ||
| return ( | ||
| <div className={clsx(classes.option, { [classes.selected]: isSelected })} key={optionValue}> | ||
| <RadioButton | ||
| id={`${htmlId}:${optionValue}`} | ||
| value={optionValue} | ||
| labelText={label} | ||
| onClick={() => onChange(optionValue)} | ||
| /> | ||
| {optionValue === value && <Checkmark size={16} />} | ||
| </div> | ||
| ); | ||
| })} | ||
| </RadioButtonGroup> | ||
| ); | ||
| } |
22 changes: 22 additions & 0 deletions
22
apps/beeai-ui/src/modules/form/components/FormActionBar.module.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| /** | ||
| * Copyright 2025 © BeeAI a Series of LF Projects, LLC | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| .root { | ||
| display: grid; | ||
| grid-template-columns: 1fr max-content; | ||
| align-items: center; | ||
| } | ||
|
|
||
| .settings { | ||
| display: flex; | ||
| gap: $spacing-03; | ||
| } | ||
|
|
||
| .buttons { | ||
| display: flex; | ||
| justify-content: flex-end; | ||
| text-align: end; | ||
| gap: $spacing-04; | ||
| } | ||
48 changes: 48 additions & 0 deletions
48
apps/beeai-ui/src/modules/form/components/FormActionBar.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| /** | ||
| * Copyright 2025 © BeeAI a Series of LF Projects, LLC | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import { Button } from '@carbon/react'; | ||
| import { useMergeRefs } from '@floating-ui/react'; | ||
|
|
||
| import { useApp } from '#contexts/App/index.ts'; | ||
| import { RunModels } from '#modules/runs/settings/RunModels.tsx'; | ||
| import { RunSettings } from '#modules/runs/settings/RunSettings.tsx'; | ||
| import { useRunSettingsDialog } from '#modules/runs/settings/useRunSettingsDialog.ts'; | ||
|
|
||
| import classes from './FormActionBar.module.scss'; | ||
|
|
||
| interface Props { | ||
| showSubmitButton?: boolean; | ||
| submitLabel: string; | ||
| showRunSettings?: boolean; | ||
| } | ||
|
|
||
| export function FormActionBar({ showSubmitButton = true, submitLabel, showRunSettings }: Props) { | ||
| const { | ||
| config: { featureFlags }, | ||
| } = useApp(); | ||
|
|
||
| const modelsDialog = useRunSettingsDialog({ blockOffset: 8 }); | ||
| const settingsDialog = useRunSettingsDialog({ blockOffset: 8 }); | ||
| const formRefs = useMergeRefs([modelsDialog.refs.setPositionReference, settingsDialog.refs.setPositionReference]); | ||
kapetr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| return ( | ||
| <div className={classes.root} ref={formRefs}> | ||
| {showRunSettings && ( | ||
| <div className={classes.settings}> | ||
| <RunSettings dialog={settingsDialog} iconOnly={false} /> | ||
| {featureFlags.ModelProviders && <RunModels dialog={modelsDialog} iconOnly={false} />} | ||
| </div> | ||
| )} | ||
| {showSubmitButton && ( | ||
| <div className={classes.buttons}> | ||
kapetr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <Button type="submit" size="md"> | ||
| {submitLabel} | ||
| </Button> | ||
| </div> | ||
| )} | ||
| </div> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CSS rules for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 0 additions & 84 deletions
84
apps/beeai-ui/src/modules/runs/components/ModelProviders.tsx
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can simplify the styles here removing the "align-items: center" with "block-size: rem(40px)" from
.settings.