Skip to content

Commit

Permalink
fix: show agent select section only if agent select feature is enable…
Browse files Browse the repository at this point in the history
…d both UI and serverside
  • Loading branch information
lizable committed Nov 25, 2024
1 parent 7df9546 commit c897bb1
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions react/src/components/ResourceAllocationFormItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,7 @@ const ResourceAllocationFormItems: React.FC<
</Card>
) : null}
{/* TODO: Support cluster mode */}
{enableAgentSelect && (
{enableAgentSelect && baiClient.supports('agent-select') && (
<Form.Item
label={t('session.launcher.SelectAgent')}
required
Expand All @@ -1217,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

0 comments on commit c897bb1

Please sign in to comment.