Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const BAIVFolderSelect: React.FC<BAIVFolderSelectProps> = ({
valuePropName = 'id',
onResolvedNamesChange,
ref,
labelRender: userLabelRender,
...selectProps
}) => {
'use memo';
Expand Down Expand Up @@ -288,33 +289,36 @@ const BAIVFolderSelect: React.FC<BAIVFolderSelectProps> = ({
filterOption: false,
}
}
labelRender={({ label, value }) => {
return onClickVFolder ? (
<BAILink onClick={() => onClickVFolder(_.toString(value))}>
{label}
</BAILink>
) : (
<>
{label}
<BAIText type="secondary">
&nbsp; (
<BAIText
ellipsis
type="secondary"
style={{
width: 80,
}}
monospace
>
{valuePropName === 'id'
? toLocalId(_.toString(value))
: _.toString(value)}
labelRender={
userLabelRender ??
(({ label, value }) => {
return onClickVFolder ? (
<BAILink onClick={() => onClickVFolder(_.toString(value))}>
{label}
</BAILink>
) : (
<>
{label}
<BAIText type="secondary">
&nbsp; (
<BAIText
ellipsis
type="secondary"
style={{
width: 80,
}}
monospace
>
{valuePropName === 'id'
? toLocalId(_.toString(value))
: _.toString(value)}
</BAIText>
)
</BAIText>
)
</BAIText>
</>
);
}}
</>
);
})
}
optionRender={({ label, value }) => (
<>
{label}
Expand Down
45 changes: 21 additions & 24 deletions react/src/components/DeploymentAddRevisionModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
reverseMapExtraArgs,
} from '../helper/runtimeExtraArgsParser';
import { useBAISettingUserState } from '../hooks/useBAISetting';
import { useModelStoreProject } from '../hooks/useModelStoreProject';
import { useCurrentProjectValue } from '../hooks/useCurrentProject';
import {
buildArgsSchemaKeySet,
buildDefaultsMap,
Expand Down Expand Up @@ -71,8 +71,8 @@ import {
BAIFlex,
BAIModal,
BAIModalProps,
BAIProjectVfolderSelect,
BAIRuntimeVariantSelect,
BAIVFolderSelect,
convertToUUID,
safeDecodeUuid,
toLocalId,
Expand Down Expand Up @@ -180,10 +180,11 @@ const DeploymentAddRevisionModal: React.FC<DeploymentAddRevisionModalProps> = ({
const { token } = theme.useToken();
const { message } = App.useApp();
const relayEnvironment = useRelayEnvironment();
// The model folder picker scopes to the MODEL_STORE project, not the
// deployment's own project — model cards live in the domain-wide model
// store regardless of which project owns the deployment.
const { id: modelStoreProjectId } = useModelStoreProject();
// The model folder picker scopes to the user's current project so the
// listing matches what the user has access to in the active project
// context, consistent with the rest of the model-deployment UI
// (ServiceLauncherPageContent, ModelCardDeployModal).
const { id: currentProjectId } = useCurrentProjectValue();
const { logger } = useBAILogger();

// Defer `open` so the lazy query only fires once the modal has actually
Expand Down Expand Up @@ -263,7 +264,6 @@ const DeploymentAddRevisionModal: React.FC<DeploymentAddRevisionModalProps> = ({
query DeploymentAddRevisionModalQuery($deploymentId: ID!) {
deployment(id: $deploymentId) {
metadata {
projectId
resourceGroupName
}
currentRevision {
Expand Down Expand Up @@ -758,9 +758,10 @@ const DeploymentAddRevisionModal: React.FC<DeploymentAddRevisionModalProps> = ({
]),
),
runtimeVariantId: rev.modelRuntimeConfig?.runtimeVariantId ?? undefined,
// BAIProjectVfolderSelect returns the canonical dashed UUID, which
// matches `rev.modelMountConfig.vfolderId` directly. `convertToUUID`
// in the submit is idempotent on already-dashed values.
// BAIVFolderSelect with `valuePropName="row_id"` returns the
// canonical dashed UUID, which matches `rev.modelMountConfig.vfolderId`
// directly. `convertToUUID` in the submit is idempotent on already-
// dashed values.
modelFolderId: rev.modelMountConfig?.vfolderId ?? undefined,
mountDestination: rev.modelMountConfig?.mountDestination ?? '/models',
definitionPath: rev.modelMountConfig?.definitionPath ?? undefined,
Expand Down Expand Up @@ -1273,13 +1274,11 @@ const DeploymentAddRevisionModal: React.FC<DeploymentAddRevisionModalProps> = ({
tooltip={t('deployment.ModelFolderTooltip')}
rules={[{ required: true }]}
>
<BAIProjectVfolderSelect
projectId={modelStoreProjectId ?? ''}
disabled={!modelStoreProjectId}
filter={{
usageMode: { equals: 'MODEL' },
status: { equals: 'READY' },
}}
<BAIVFolderSelect
currentProjectId={currentProjectId ?? undefined}
excludeDeleted
filter='usage_mode == "model"'
valuePropName="row_id"
style={{ width: '100%' }}
/>
Comment on lines +1277 to 1283
</Form.Item>
Expand Down Expand Up @@ -1332,13 +1331,11 @@ const DeploymentAddRevisionModal: React.FC<DeploymentAddRevisionModalProps> = ({
tooltip={t('deployment.ModelFolderTooltip')}
rules={[{ required: true }]}
>
<BAIProjectVfolderSelect
projectId={modelStoreProjectId ?? ''}
disabled={!modelStoreProjectId}
filter={{
usageMode: { equals: 'MODEL' },
status: { equals: 'READY' },
}}
<BAIVFolderSelect
currentProjectId={currentProjectId ?? undefined}
excludeDeleted
filter='usage_mode == "model"'
valuePropName="row_id"
style={{ width: '100%' }}
/>
</Form.Item>
Expand Down
2 changes: 1 addition & 1 deletion react/src/components/VFolderNodes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import VFolderNodeIdenticon from './VFolderNodeIdenticon';
import VFolderPermissionCell from './VFolderPermissionCell';
import { DeleteFilled, DeleteOutlined, UserOutlined } from '@ant-design/icons';
import { useToggle } from 'ahooks';
import { Alert, App, theme, Typography } from 'antd';
import { App, theme, Typography } from 'antd';
import {
filterOutNullAndUndefined,
BAIEndpointsIcon,
Expand Down
Loading