Skip to content

Commit 8280c1d

Browse files
committed
feat(FR-2684): pre-fill launcher with all modal selections and jump to review step
When the user clicks the '...' dropdown item in VFolderDeployModal, openLauncher now forwards resourceGroup and resourcePresetId as URL params alongside the existing model param, and sets step=review so the launcher opens directly on the review page with all fields pre-filled. DeploymentLauncherCreateView parses the new params; preFilledModel prop is replaced by preFilledValues (Partial<DeploymentLauncherFormValue>) to accommodate the expanded field set cleanly.
1 parent 72a1b1e commit 8280c1d

4 files changed

Lines changed: 44 additions & 19 deletions

File tree

react/src/components/DeploymentLauncherPageContent.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,12 @@ export interface DeploymentLauncherPageContentProps {
8484
*/
8585
deploymentFrgmt?: DeploymentLauncherPageContent_deployment$key | null;
8686
/**
87-
* Only used when `mode === 'create'`. Populates the model folder
88-
* field when the user lands here from the FR-2684 split-button
89-
* `?model=<folderId>` link.
87+
* Only used when `mode === 'create'`. Partial form values to pre-fill
88+
* from the entry point (e.g. model store split button or VFolderDeployModal).
89+
* Merged on top of DEFAULT_FORM_VALUES so any unspecified field keeps its
90+
* default. Parsed from URL params by DeploymentLauncherCreateView.
9091
*/
91-
preFilledModel?: string;
92+
preFilledValues?: Partial<DeploymentLauncherFormValue>;
9293
/**
9394
* Optional change observer forwarded to the underlying antd `<Form>`.
9495
* Useful for parent pages that want to persist the draft state
@@ -143,7 +144,7 @@ const DEFAULT_FORM_VALUES: DeploymentLauncherFormValue = {
143144
*/
144145
const DeploymentLauncherPageContent: React.FC<
145146
DeploymentLauncherPageContentProps
146-
> = ({ mode, form, deploymentFrgmt, preFilledModel, onValuesChange }) => {
147+
> = ({ mode, form, deploymentFrgmt, preFilledValues, onValuesChange }) => {
147148
'use memo';
148149

149150
const { t } = useTranslation();
@@ -240,10 +241,8 @@ const DeploymentLauncherPageContent: React.FC<
240241
desiredReplicaCount: deployment.replicaState.desiredReplicaCount,
241242
} satisfies Partial<DeploymentLauncherFormValue>);
242243
}
243-
return _.merge({}, DEFAULT_FORM_VALUES, {
244-
modelFolderId: preFilledModel ?? '',
245-
} satisfies Partial<DeploymentLauncherFormValue>);
246-
}, [mode, deployment, preFilledModel]);
244+
return _.merge({}, DEFAULT_FORM_VALUES, preFilledValues ?? {});
245+
}, [mode, deployment, preFilledValues]);
247246

248247
// Apply initial values to the parent-owned form instance exactly once
249248
// per mount / deployment change. Using `useEffectEvent` keeps the
@@ -261,7 +260,12 @@ const DeploymentLauncherPageContent: React.FC<
261260

262261
useEffect(() => {
263262
applyInitialValues();
264-
}, [deployment?.id, preFilledModel]);
263+
}, [
264+
deployment?.id,
265+
preFilledValues?.modelFolderId,
266+
preFilledValues?.resourceGroup,
267+
preFilledValues?.resourcePresetId,
268+
]);
265269

266270
const setCurrentStep = (nextKey: StepKey) => {
267271
setQuery({ step: nextKey }, { history: 'push' });

react/src/components/VFolderDeployModal.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,11 @@ const VFolderDeployModalContent: React.FC<VFolderDeployModalContentProps> = ({
404404
key: 'configure',
405405
label: t('modelStore.QuickDeployDetailed'),
406406
onClick: () => {
407-
openLauncher({ modelFolderId: vfolderId });
407+
openLauncher({
408+
modelFolderId: vfolderId,
409+
resourceGroup: effectiveResourceGroup,
410+
resourcePreset: effectivePresetId,
411+
});
408412
},
409413
},
410414
],

react/src/hooks/useDeploymentLauncher.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,15 @@ export const useDeploymentLauncher = (): {
227227

228228
const openLauncher = (input: QuickDeployInput): void => {
229229
const params = new URLSearchParams({ model: input.modelFolderId });
230+
if (input.resourceGroup) params.set('resourceGroup', input.resourceGroup);
231+
if (input.resourcePreset)
232+
params.set('resourcePresetId', input.resourcePreset);
233+
// Jump straight to the review step when the caller provides enough
234+
// pre-filled data (model + resource group + preset) so the user only
235+
// needs to confirm rather than re-enter fields they already selected.
236+
if (input.resourceGroup && input.resourcePreset) {
237+
params.set('step', 'review');
238+
}
230239
navigate(`/deployments/new?${params.toString()}`);
231240
};
232241

react/src/pages/DeploymentLauncherPage.tsx

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,29 @@ const DeploymentLauncherPage: React.FC = () => {
6363
};
6464

6565
/**
66-
* Create-mode view — no deployment fragment to pre-fill from. Reads the
67-
* optional `?model=<folderId>` query param for Quick Deploy / model store
68-
* entry points and forwards it to the content component.
66+
* Create-mode view — no deployment fragment to pre-fill from. Reads URL
67+
* params forwarded by entry points (model store split button, VFolderDeployModal)
68+
* and builds a preFilledValues object passed down to the content component.
69+
* Supported params: `model`, `resourceGroup`, `resourcePresetId`.
6970
*/
7071
const DeploymentLauncherCreateView: React.FC = () => {
7172
'use memo';
7273
const [searchParams] = useSearchParams();
73-
const preFilledModel = searchParams.get('model') ?? undefined;
7474
const [form] = Form.useForm<DeploymentLauncherFormValue>();
7575

76+
const preFilledValues: Partial<DeploymentLauncherFormValue> = {};
77+
const model = searchParams.get('model');
78+
const resourceGroup = searchParams.get('resourceGroup');
79+
const resourcePresetId = searchParams.get('resourcePresetId');
80+
if (model) preFilledValues.modelFolderId = model;
81+
if (resourceGroup) preFilledValues.resourceGroup = resourceGroup;
82+
if (resourcePresetId) preFilledValues.resourcePresetId = resourcePresetId;
83+
7684
return (
7785
<DeploymentLauncherPageLayout
7886
mode="create"
7987
form={form}
80-
preFilledModel={preFilledModel}
88+
preFilledValues={preFilledValues}
8189
/>
8290
);
8391
};
@@ -131,7 +139,7 @@ interface DeploymentLauncherPageLayoutProps {
131139
deploymentFrgmt?: React.ComponentProps<
132140
typeof DeploymentLauncherPageContent
133141
>['deploymentFrgmt'];
134-
preFilledModel?: string;
142+
preFilledValues?: Partial<DeploymentLauncherFormValue>;
135143
}
136144

137145
/**
@@ -141,7 +149,7 @@ interface DeploymentLauncherPageLayoutProps {
141149
*/
142150
const DeploymentLauncherPageLayout: React.FC<
143151
DeploymentLauncherPageLayoutProps
144-
> = ({ mode, form, deploymentId, deploymentFrgmt, preFilledModel }) => {
152+
> = ({ mode, form, deploymentId, deploymentFrgmt, preFilledValues }) => {
145153
'use memo';
146154

147155
const { t } = useTranslation();
@@ -388,7 +396,7 @@ const DeploymentLauncherPageLayout: React.FC<
388396
mode={mode}
389397
form={form}
390398
deploymentFrgmt={deploymentFrgmt}
391-
preFilledModel={preFilledModel}
399+
preFilledValues={preFilledValues}
392400
onValuesChange={() => setIsDirty(true)}
393401
/>
394402

0 commit comments

Comments
 (0)