Skip to content
Closed
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
212 changes: 93 additions & 119 deletions react/src/components/DeploymentPresetDetailContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Copyright (c) 2015-2026 Lablup Inc. All rights reserved.
*/
import type { DeploymentPresetDetailContentFragment$key } from '../__generated__/DeploymentPresetDetailContentFragment.graphql';
import { Descriptions, Divider, Typography } from 'antd';
import { BAIFlex } from 'backend.ai-ui';
import { Descriptions, Typography } from 'antd';
import { BAICard, BAIFlex } from 'backend.ai-ui';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { graphql, useFragment } from 'react-relay';
Expand Down Expand Up @@ -77,131 +77,105 @@ const DeploymentPresetDetailContent: React.FC<
{preset.description && (
<Typography.Text type="secondary">{preset.description}</Typography.Text>
)}
<Descriptions
<BAICard
size="small"
column={2}
items={[
{
label: t('adminDeploymentPreset.Rank'),
children: preset.rank,
},
{
label: t('adminDeploymentPreset.Runtime'),
children: preset.runtimeVariant?.name ?? preset.runtimeVariantId,
},
]}
/>

<Divider
style={{ margin: '4px 0' }}
titlePlacement="left"
orientationMargin={0}
title={t('adminDeploymentPreset.SectionImage')}
styles={{ body: { paddingTop: 0 } }}
>
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
{t('adminDeploymentPreset.SectionImage')}
</Typography.Text>
</Divider>
<Descriptions
<Descriptions
size="small"
column={1}
items={[
{
label: t('adminDeploymentPreset.Image'),
children: preset.execution?.image || '-',
},
{
label: t('adminDeploymentPreset.Runtime'),
children: preset.runtimeVariant?.name ?? preset.runtimeVariantId,
},
]}
/>
</BAICard>
<BAICard
size="small"
column={1}
items={[
{
label: t('adminDeploymentPreset.Image'),
children: preset.execution?.image || '-',
},
]}
/>

<Divider
style={{ margin: '4px 0' }}
titlePlacement="left"
orientationMargin={0}
title={t('adminDeploymentPreset.SectionCluster')}
styles={{ body: { paddingTop: 0 } }}
>
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
{t('adminDeploymentPreset.SectionCluster')}
</Typography.Text>
</Divider>
<Descriptions
<Descriptions
size="small"
column={2}
items={[
{
label: t('adminDeploymentPreset.ClusterMode'),
children: preset.cluster?.clusterMode || '-',
},
{
label: t('adminDeploymentPreset.ClusterSize'),
children: preset.cluster?.clusterSize ?? '-',
},
]}
/>
</BAICard>
<BAICard
size="small"
column={2}
items={[
{
label: t('adminDeploymentPreset.ClusterMode'),
children: preset.cluster?.clusterMode || '-',
},
{
label: t('adminDeploymentPreset.ClusterSize'),
children: preset.cluster?.clusterSize ?? '-',
},
]}
/>

<Divider
style={{ margin: '4px 0' }}
titlePlacement="left"
orientationMargin={0}
title={t('adminDeploymentPreset.SectionResources')}
styles={{ body: { paddingTop: 0 } }}
>
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
{t('adminDeploymentPreset.SectionResources')}
</Typography.Text>
</Divider>
<Descriptions
<Descriptions
size="small"
column={2}
items={[
...(shmem
? [
{
label: t('adminDeploymentPreset.Shmem'),
children: `${shmem} GiB`,
},
]
: []),
...(preset.resource?.resourceOpts
?.filter((opt) => opt.name !== 'shmem')
.map((opt) => ({
label: opt.name,
children: opt.value,
})) ?? []),
]}
/>
</BAICard>
<BAICard
size="small"
column={2}
items={[
...(shmem
? [
{
label: t('adminDeploymentPreset.Shmem'),
children: `${shmem} GiB`,
},
]
: []),
...(preset.resource?.resourceOpts
?.filter((opt) => opt.name !== 'shmem')
.map((opt) => ({
label: opt.name,
children: opt.value,
})) ?? []),
]}
/>

<Divider
style={{ margin: '4px 0' }}
titlePlacement="left"
orientationMargin={0}
title={t('adminDeploymentPreset.SectionDeploymentDefaults')}
styles={{ body: { paddingTop: 0 } }}
>
<Typography.Text type="secondary" style={{ fontSize: 12 }}>
{t('adminDeploymentPreset.SectionDeploymentDefaults')}
</Typography.Text>
</Divider>
<Descriptions
size="small"
column={2}
items={[
{
label: t('adminDeploymentPreset.Replicas'),
children: preset.deploymentDefaults?.replicaCount ?? '-',
},
{
label: t('adminDeploymentPreset.RevisionHistoryLimit'),
children: preset.deploymentDefaults?.revisionHistoryLimit ?? '-',
},
{
label: t('adminDeploymentPreset.Strategy'),
children: preset.deploymentDefaults?.deploymentStrategy ?? '-',
},
{
label: t('adminDeploymentPreset.OpenToPublic'),
children:
preset.deploymentDefaults?.openToPublic != null
? preset.deploymentDefaults.openToPublic
? t('button.Yes')
: t('button.No')
: '-',
},
]}
/>
<Descriptions
size="small"
column={2}
items={[
{
label: t('adminDeploymentPreset.Replicas'),
children: preset.deploymentDefaults?.replicaCount ?? '-',
},
{
label: t('adminDeploymentPreset.RevisionHistoryLimit'),
children: preset.deploymentDefaults?.revisionHistoryLimit ?? '-',
},
{
label: t('adminDeploymentPreset.Strategy'),
children: preset.deploymentDefaults?.deploymentStrategy ?? '-',
},
{
label: t('adminDeploymentPreset.OpenToPublic'),
children:
preset.deploymentDefaults?.openToPublic != null
? preset.deploymentDefaults.openToPublic
? t('button.Yes')
: t('button.No')
: '-',
},
]}
/>
</BAICard>
</BAIFlex>
);
};
Expand Down
65 changes: 18 additions & 47 deletions react/src/components/ServiceLauncherPageContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import {
} from '../hooks/useRuntimeParameterSchema';
import { useValidateServiceName } from '../hooks/useValidateServiceName';
import { useRuntimeEnvVarConfigs } from '../hooks/useVariantConfigs';
import DeploymentPresetDetailModal from './DeploymentPresetDetailModal';
import EnvVarFormList, {
sanitizeSensitiveEnv,
EnvVarFormListValue,
Expand All @@ -65,7 +64,6 @@ import SwitchToProjectButton from './SwitchToProjectButton';
import VFolderLazyViewV2 from './VFolderLazyViewV2';
import VFolderSelect from './VFolderSelect';
import VFolderTableFormItem from './VFolderTableFormItem';
import { InfoCircleOutlined } from '@ant-design/icons';
import { useDebounceFn } from 'ahooks';
import {
App,
Expand All @@ -79,7 +77,6 @@ import {
Segmented,
Skeleton,
Select,
Space,
theme,
Tooltip,
Tag,
Expand Down Expand Up @@ -251,8 +248,6 @@ const ServiceLauncherPageContent: React.FC<ServiceLauncherPageContentProps> = ({
const [selectedPresetId, setSelectedPresetId] = useState<
string | null | undefined
>(null);
const [isPresetDetailOpen, setIsPresetDetailOpen] = useState(false);

const [form] = Form.useForm<ServiceLauncherFormValue>();
const [wantToChangeResource, setWantToChangeResource] = useState(false);
const [currentGlobalResourceGroup, setCurrentGlobalResourceGroup] =
Expand Down Expand Up @@ -1710,41 +1705,24 @@ const ServiceLauncherPageContent: React.FC<ServiceLauncherPageContentProps> = ({
<Form.Item
label={t('modelService.SelectDeploymentPreset')}
>
<BAIFlex direction="row" gap="xs">
<Select
allowClear
options={
deploymentRevisionPresets?.edges?.map(
(edge) => ({
value: edge.node.id,
label: edge.node.name,
}),
) ?? []
}
value={selectedPresetId}
onChange={(value) => {
setSelectedPresetId(value ?? null);
}}
placeholder={t(
'modelService.SelectDeploymentPreset',
)}
/>
<Space.Compact>
<Tooltip
title={t(
'modelService.DeploymentPresetDetail',
)}
>
<Button
icon={<InfoCircleOutlined />}
disabled={!selectedPresetId}
onClick={() => {
setIsPresetDetailOpen(true);
}}
/>
</Tooltip>
</Space.Compact>
</BAIFlex>
<Select
allowClear
options={
deploymentRevisionPresets?.edges?.map(
(edge) => ({
value: edge.node.id,
label: edge.node.name,
}),
) ?? []
}
value={selectedPresetId}
onChange={(value) => {
setSelectedPresetId(value ?? null);
}}
placeholder={t(
'modelService.SelectDeploymentPreset',
)}
/>
</Form.Item>
)}
<ImageEnvironmentSelectFormItems
Expand Down Expand Up @@ -2279,13 +2257,6 @@ const ServiceLauncherPageContent: React.FC<ServiceLauncherPageContentProps> = ({
>
<ServiceValidationView serviceData={validateServiceData} />
</BAIModal>
<DeploymentPresetDetailModal
open={isPresetDetailOpen}
presetId={selectedPresetId}
onRequestClose={() => {
setIsPresetDetailOpen(false);
}}
/>
</>
);
};
Expand Down
20 changes: 11 additions & 9 deletions react/src/components/VFolderDeployModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ const VFolderDeployModalContent: React.FC<VFolderDeployModalContentProps> = ({
tooltip={t('modelStore.PresetTooltip')}
required
>
<Space.Compact style={{ width: '100%' }}>
<BAIFlex direction="row" gap="xs">
<BAISelect
value={effectivePresetId}
onChange={(value: string) => setUserSelectedPresetId(value)}
Expand All @@ -403,14 +403,16 @@ const VFolderDeployModalContent: React.FC<VFolderDeployModalContentProps> = ({
)}
style={{ flex: 1 }}
/>
<Tooltip title={t('modelService.DeploymentPresetDetail')}>
<Button
icon={<InfoCircleOutlined />}
disabled={!effectivePresetId}
onClick={() => setPresetDetailId(effectivePresetId)}
/>
</Tooltip>
</Space.Compact>
<Space.Compact>
<Tooltip title={t('modelService.DeploymentPresetDetail')}>
<Button
icon={<InfoCircleOutlined />}
disabled={!effectivePresetId}
onClick={() => setPresetDetailId(effectivePresetId)}
/>
</Tooltip>
</Space.Compact>
</BAIFlex>
<DeploymentPresetDetailModal
open={!!presetDetailId}
presetId={presetDetailId}
Expand Down
Loading