Skip to content

Commit f52353c

Browse files
committed
Adding MaaS details to summary page
1 parent a812eee commit f52353c

File tree

4 files changed

+415
-291
lines changed

4 files changed

+415
-291
lines changed

packages/maas/frontend/src/odh/modelServingExtensions/modelDeploymentWizard/MaaSEndpointCheckbox.tsx

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,27 @@ const getTierDropdownLabel = (key: TierDropdownOption): string => {
112112
return option?.label ?? 'All tiers';
113113
};
114114

115+
const getMaaSTierLabel = (
116+
value: MaaSTierValue,
117+
externalData?: { data: MaaSEndpointsExternalData; loaded: boolean; loadError?: Error },
118+
): string => {
119+
const availableTiers = externalData?.data.tiers ?? [];
120+
const selection = value.tiersDropdownSelection ?? 'all-tiers';
121+
if (selection === 'no-tiers') {
122+
return 'No tiers';
123+
}
124+
if (selection === 'specify-tiers') {
125+
// Matching the display name of the selected tiers
126+
return (
127+
availableTiers
128+
.filter((tier: Tier) => value.selectedTierNames?.includes(tier.name ?? ''))
129+
.map((tier: Tier) => tier.displayName ?? tier.name ?? '')
130+
.join(', ') || 'Tiers selected'
131+
);
132+
}
133+
return 'All tiers';
134+
};
135+
115136
//// Component ////
116137

117138
type MaasEndpointFieldProps = {
@@ -310,4 +331,28 @@ export const MaaSEndpointFieldWizardField: MaaSEndpointsFieldType = {
310331
},
311332
component: MaasEndpointField,
312333
externalDataHook: useMaaSEndpointsExternalData,
334+
getReviewSections: (value, _wizardState, externalData) => [
335+
{
336+
title: 'Advanced settings',
337+
items: [
338+
{
339+
key: 'maas-endpoint-enabled',
340+
label: 'Add as MaaS endpoint',
341+
value: () => (value.isChecked ? 'Yes' : 'No'),
342+
},
343+
{
344+
key: 'maas-tier-access',
345+
label: 'MaaS tier',
346+
value: () =>
347+
getMaaSTierLabel(value, {
348+
data: externalData ?? { tiers: [], hasViewTiersPermission: false },
349+
loaded: true,
350+
loadError: undefined,
351+
}),
352+
optional: true,
353+
isVisible: () => value.isChecked,
354+
},
355+
],
356+
},
357+
],
313358
};

packages/model-serving/src/components/deploymentWizard/ModelDeploymentWizard.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { ModelDeploymentStepContent } from './steps/ModelDeploymentStep';
1818
import { ReviewStepContent } from './steps/ReviewStep';
1919
import { useDeployMethod } from './useDeployMethod';
2020
import { useWizardFieldApply } from './useWizardFieldApply';
21-
import type { InitialWizardFormData } from './types';
21+
import { InitialWizardFormData, WizardStepTitle } from './types';
2222
import { ExitDeploymentModal } from './exitModal/ExitDeploymentModal';
2323
import { useRefreshWizardPage } from './useRefreshWizardPage';
2424
import { useExitDeploymentWizard } from './exitModal/useExitDeploymentWizard';
@@ -209,7 +209,7 @@ const ModelDeploymentWizard: React.FC<ModelDeploymentWizardProps> = ({
209209
footer={wizardFooter}
210210
startIndex={wizardState.initialData?.wizardStartIndex ?? 1}
211211
>
212-
<WizardStep name="Model details" id="source-model-step">
212+
<WizardStep name={WizardStepTitle.MODEL_DETAILS} id="source-model-step">
213213
{wizardState.loaded.modelSourceLoaded ? (
214214
<ModelSourceStepContent
215215
wizardState={wizardState}
@@ -220,7 +220,7 @@ const ModelDeploymentWizard: React.FC<ModelDeploymentWizardProps> = ({
220220
)}
221221
</WizardStep>
222222
<WizardStep
223-
name="Model deployment"
223+
name={WizardStepTitle.MODEL_DEPLOYMENT}
224224
id="model-deployment-step"
225225
isDisabled={!validation.isModelSourceStepValid}
226226
>
@@ -234,7 +234,7 @@ const ModelDeploymentWizard: React.FC<ModelDeploymentWizardProps> = ({
234234
)}
235235
</WizardStep>
236236
<WizardStep
237-
name="Advanced settings"
237+
name={WizardStepTitle.ADVANCED_SETTINGS}
238238
id="advanced-options-step"
239239
isDisabled={
240240
!validation.isModelSourceStepValid || !validation.isModelDeploymentStepValid
@@ -251,7 +251,7 @@ const ModelDeploymentWizard: React.FC<ModelDeploymentWizardProps> = ({
251251
)}
252252
</WizardStep>
253253
<WizardStep
254-
name="Review"
254+
name={WizardStepTitle.REVIEW}
255255
id="summary-step"
256256
isDisabled={
257257
!validation.isModelSourceStepValid ||
@@ -260,7 +260,11 @@ const ModelDeploymentWizard: React.FC<ModelDeploymentWizardProps> = ({
260260
}
261261
>
262262
{wizardState.loaded.summaryLoaded ? (
263-
<ReviewStepContent wizardState={wizardState} projectName={currentProjectName} />
263+
<ReviewStepContent
264+
wizardState={wizardState}
265+
projectName={currentProjectName}
266+
externalData={externalData}
267+
/>
264268
) : (
265269
<Spinner data-testid="spinner" />
266270
)}

0 commit comments

Comments
 (0)