From f90e9c88eac896e5bb01580d905c5afeec07517c Mon Sep 17 00:00:00 2001 From: Priyanshu-u07 Date: Wed, 14 Oct 2026 21:46:38 +0530 Subject: [PATCH] Show the engine AMI field only where an AMI is required Signed-off-by: Priyanshu-u07 --- .../__tests__/vllmConfigAmi.test.tsx | 51 +++++++++++++++++++ .../components/deployment/configSections.tsx | 6 ++- apps/dashboard/src/pages/NewDeployment.tsx | 1 + 3 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 apps/dashboard/src/components/deployment/__tests__/vllmConfigAmi.test.tsx diff --git a/apps/dashboard/src/components/deployment/__tests__/vllmConfigAmi.test.tsx b/apps/dashboard/src/components/deployment/__tests__/vllmConfigAmi.test.tsx new file mode 100644 index 00000000..ba26988c --- /dev/null +++ b/apps/dashboard/src/components/deployment/__tests__/vllmConfigAmi.test.tsx @@ -0,0 +1,51 @@ +import { describe, it, expect, vi } from "vitest"; +import { render, screen } from "@testing-library/react"; + +import { VllmConfig } from "../configSections"; + +function renderVllm(amiRequired: boolean) { + const state = { + selectedEngine: "vllm", + dtype: "auto", + quantization: "", + maxModelLen: "", + gpuUtil: "0.9", + enforceEager: false, + selectedAmiId: "", + selectedHfTokenName: "", + prefillReplicas: 1, + decodeReplicas: 1, + prefillGpuIndices: "", + decodeGpuIndices: "", + isDisaggOpen: false, + }; + return render( + + ); +} + +// The label carries the required asterisk, so it is the thing that must not +// appear where no AMI is needed. +const amiLabel = () => document.querySelector('label[for="engineAmi"]'); + +describe("the engine AMI field follows requiresAmi", () => { + it("is not shown for vLLM on a pool that needs no AMI, such as Kubernetes", () => { + renderVllm(false); + expect(amiLabel()).toBeNull(); + expect(screen.queryByText(/engine ami/i)).toBeNull(); + }); + + it("is shown, marked required, for vLLM on an AWS pool", () => { + renderVllm(true); + expect(amiLabel()).not.toBeNull(); + expect(amiLabel()?.textContent).toContain("*"); + }); +}); diff --git a/apps/dashboard/src/components/deployment/configSections.tsx b/apps/dashboard/src/components/deployment/configSections.tsx index 138ff9e6..fa689772 100644 --- a/apps/dashboard/src/components/deployment/configSections.tsx +++ b/apps/dashboard/src/components/deployment/configSections.tsx @@ -358,11 +358,13 @@ export function VllmConfig({ engineAmis, amisLoading, amiRegion, + amiRequired, hfTokenNames, }: SectionProps & { engineAmis: EngineAmi[] amisLoading: boolean amiRegion: string + amiRequired: boolean hfTokenNames: string[] }) { const { @@ -375,8 +377,8 @@ export function VllmConfig({

{selectedEngine === "sglang" ? "SGLang" : "vLLM"} Configuration

- {/* Engine AMI dropdown (required for vLLM only) */} - {selectedEngine === "vllm" && ( + {/* Engine AMI dropdown: vLLM on an AWS pool only */} + {amiRequired && ( )}