Skip to content
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

add: option to show/hide agent select option by launcher #2870

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions react/src/components/ResourceAllocationFormItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ type MergedResourceAllocationFormValue = ResourceAllocationFormValue &
ImageEnvironmentFormInput;

interface ResourceAllocationFormItemsProps {
enableAgentSelect?: boolean;
enableNumOfSessions?: boolean;
enableResourcePresets?: boolean;
showRemainingWarning?: boolean;
Expand All @@ -93,6 +94,7 @@ interface ResourceAllocationFormItemsProps {
const ResourceAllocationFormItems: React.FC<
ResourceAllocationFormItemsProps
> = ({
enableAgentSelect = false,
enableNumOfSessions,
enableResourcePresets,
forceImageMinValues = false,
Expand Down Expand Up @@ -1206,7 +1208,7 @@ const ResourceAllocationFormItems: React.FC<
</Card>
) : null}
{/* TODO: Support cluster mode */}
{!baiClient._config.hideAgents && (
{enableAgentSelect && (
<Form.Item
label={t('session.launcher.SelectAgent')}
required
lizable marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -1215,21 +1217,19 @@ const ResourceAllocationFormItems: React.FC<
<Flex gap={'xs'}>
<Suspense>
<Form.Item required noStyle style={{ flex: 1 }} name="agent">
{baiClient.supports('agent-select') && (
<AgentSelect
resourceGroup={currentResourceGroup}
fetchKey={agentFetchKey}
onChange={(value, option) => {
if (value !== 'auto') {
form.setFieldsValue({
cluster_mode: 'single-node',
cluster_size: 1,
});
}
// TODO: set cluster mode to single node and cluster size to 1 when agent value is not "auto"
}}
></AgentSelect>
)}
<AgentSelect
resourceGroup={currentResourceGroup}
fetchKey={agentFetchKey}
onChange={(value, option) => {
if (value !== 'auto') {
form.setFieldsValue({
cluster_mode: 'single-node',
cluster_size: 1,
});
}
// TODO: set cluster mode to single node and cluster size to 1 when agent value is not "auto"
}}
></AgentSelect>
</Form.Item>
</Suspense>
<Form.Item noStyle>
Expand Down
4 changes: 4 additions & 0 deletions react/src/pages/SessionLauncherPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1233,6 +1233,10 @@ const SessionLauncherPage = () => {
}}
>
<ResourceAllocationFormItems
enableAgentSelect={
!baiClient._config.hideAgents &&
baiClient.supports('agent-select')
}
enableNumOfSessions
enableResourcePresets
showRemainingWarning
Expand Down
Loading