Skip to content

Commit bdb1ea9

Browse files
committed
fix(FR-2914): scope deployment add-revision model folder picker to current project
1 parent 908117b commit bdb1ea9

2 files changed

Lines changed: 22 additions & 25 deletions

File tree

react/src/components/DeploymentAddRevisionModal.tsx

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
reverseMapExtraArgs,
2222
} from '../helper/runtimeExtraArgsParser';
2323
import { useBAISettingUserState } from '../hooks/useBAISetting';
24-
import { useModelStoreProject } from '../hooks/useModelStoreProject';
24+
import { useCurrentProjectValue } from '../hooks/useCurrentProject';
2525
import {
2626
buildArgsSchemaKeySet,
2727
buildDefaultsMap,
@@ -71,8 +71,8 @@ import {
7171
BAIFlex,
7272
BAIModal,
7373
BAIModalProps,
74-
BAIProjectVfolderSelect,
7574
BAIRuntimeVariantSelect,
75+
BAIVFolderSelect,
7676
convertToUUID,
7777
safeDecodeUuid,
7878
toLocalId,
@@ -180,10 +180,11 @@ const DeploymentAddRevisionModal: React.FC<DeploymentAddRevisionModalProps> = ({
180180
const { token } = theme.useToken();
181181
const { message } = App.useApp();
182182
const relayEnvironment = useRelayEnvironment();
183-
// The model folder picker scopes to the MODEL_STORE project, not the
184-
// deployment's own project — model cards live in the domain-wide model
185-
// store regardless of which project owns the deployment.
186-
const { id: modelStoreProjectId } = useModelStoreProject();
183+
// The model folder picker scopes to the user's current project so the
184+
// listing matches what the user has access to in the active project
185+
// context, consistent with the rest of the model-deployment UI
186+
// (ServiceLauncherPageContent, ModelCardDeployModal).
187+
const { id: currentProjectId } = useCurrentProjectValue();
187188
const { logger } = useBAILogger();
188189

189190
// Defer `open` so the lazy query only fires once the modal has actually
@@ -263,7 +264,6 @@ const DeploymentAddRevisionModal: React.FC<DeploymentAddRevisionModalProps> = ({
263264
query DeploymentAddRevisionModalQuery($deploymentId: ID!) {
264265
deployment(id: $deploymentId) {
265266
metadata {
266-
projectId
267267
resourceGroupName
268268
}
269269
currentRevision {
@@ -758,9 +758,10 @@ const DeploymentAddRevisionModal: React.FC<DeploymentAddRevisionModalProps> = ({
758758
]),
759759
),
760760
runtimeVariantId: rev.modelRuntimeConfig?.runtimeVariantId ?? undefined,
761-
// BAIProjectVfolderSelect returns the canonical dashed UUID, which
762-
// matches `rev.modelMountConfig.vfolderId` directly. `convertToUUID`
763-
// in the submit is idempotent on already-dashed values.
761+
// BAIVFolderSelect with `valuePropName="row_id"` returns the
762+
// canonical dashed UUID, which matches `rev.modelMountConfig.vfolderId`
763+
// directly. `convertToUUID` in the submit is idempotent on already-
764+
// dashed values.
764765
modelFolderId: rev.modelMountConfig?.vfolderId ?? undefined,
765766
mountDestination: rev.modelMountConfig?.mountDestination ?? '/models',
766767
definitionPath: rev.modelMountConfig?.definitionPath ?? undefined,
@@ -1273,13 +1274,11 @@ const DeploymentAddRevisionModal: React.FC<DeploymentAddRevisionModalProps> = ({
12731274
tooltip={t('deployment.ModelFolderTooltip')}
12741275
rules={[{ required: true }]}
12751276
>
1276-
<BAIProjectVfolderSelect
1277-
projectId={modelStoreProjectId ?? ''}
1278-
disabled={!modelStoreProjectId}
1279-
filter={{
1280-
usageMode: { equals: 'MODEL' },
1281-
status: { equals: 'READY' },
1282-
}}
1277+
<BAIVFolderSelect
1278+
currentProjectId={currentProjectId ?? undefined}
1279+
excludeDeleted
1280+
filter='usage_mode == "model"'
1281+
valuePropName="row_id"
12831282
style={{ width: '100%' }}
12841283
/>
12851284
</Form.Item>
@@ -1332,13 +1331,11 @@ const DeploymentAddRevisionModal: React.FC<DeploymentAddRevisionModalProps> = ({
13321331
tooltip={t('deployment.ModelFolderTooltip')}
13331332
rules={[{ required: true }]}
13341333
>
1335-
<BAIProjectVfolderSelect
1336-
projectId={modelStoreProjectId ?? ''}
1337-
disabled={!modelStoreProjectId}
1338-
filter={{
1339-
usageMode: { equals: 'MODEL' },
1340-
status: { equals: 'READY' },
1341-
}}
1334+
<BAIVFolderSelect
1335+
currentProjectId={currentProjectId ?? undefined}
1336+
excludeDeleted
1337+
filter='usage_mode == "model"'
1338+
valuePropName="row_id"
13421339
style={{ width: '100%' }}
13431340
/>
13441341
</Form.Item>

react/src/components/VFolderNodes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import VFolderNodeIdenticon from './VFolderNodeIdenticon';
2121
import VFolderPermissionCell from './VFolderPermissionCell';
2222
import { DeleteFilled, DeleteOutlined, UserOutlined } from '@ant-design/icons';
2323
import { useToggle } from 'ahooks';
24-
import { Alert, App, theme, Typography } from 'antd';
24+
import { App, theme, Typography } from 'antd';
2525
import {
2626
filterOutNullAndUndefined,
2727
BAIEndpointsIcon,

0 commit comments

Comments
 (0)