feat(FR-2593): implement VFolder creation modal using V2 GraphQL mutation#6759
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has required the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
|---|---|---|---|
| 🔴 | Statements | 8.55% (-0.04% 🔻) |
1757/20539 |
| 🔴 | Branches | 7.83% (-0.06% 🔻) |
1131/14449 |
| 🔴 | Functions | 5.11% (-0.03% 🔻) |
285/5574 |
| 🔴 | Lines | 8.27% (-0.04% 🔻) |
1649/19932 |
Show new covered files 🐣
St.❔ |
File | Statements | Branches | Functions | Lines |
|---|---|---|---|---|---|
| 🔴 | ... / FolderCreateModalV2.tsx |
0% | 0% | 0% | 0% |
Test suite run success
856 tests passing in 39 suites.
Report generated by 🧪jest coverage report action from 336251a
090778a to
fddd97a
Compare
There was a problem hiding this comment.
Pull request overview
Implements and wires up a new vfolder creation modal (FolderCreateModalV2) that uses the V2 GraphQL createVfolderV2 mutation, and replaces existing call sites that used the legacy FolderCreateModal.
Changes:
- Added
react/src/components/FolderCreateModalV2.tsx(GraphQL mutation-based folder creation modal). - Replaced
FolderCreateModalusages withFolderCreateModalV2across user and admin pages/components. - Added “Create Folder” entry point to
AdminVFolderNodeListPageand wired it to the new modal (with project-folder creation enabled only there).
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| react/src/pages/VFolderNodeListPage.tsx | Switches folder creation modal to V2 implementation. |
| react/src/pages/StartPage.tsx | Switches folder creation modal to V2 implementation. |
| react/src/pages/AdminVFolderNodeListPage.tsx | Adds create-folder button and uses V2 modal with project-folder creation enabled. |
| react/src/components/VFolderTable.tsx | Switches folder creation modal to V2 implementation. |
| react/src/components/VFolderSelect.tsx | Switches folder creation modal to V2 implementation. |
| react/src/components/VFolderMountFormItem.tsx | Updates import/usage to V2 modal and documents removed prop. |
| react/src/components/ImportArtifactRevisionToFolderModal.tsx | Migrates to V2 modal using folderType="model_project" preset. |
| react/src/components/FolderCreateModalV2.tsx | New modal: GraphQL mutation + form UI/validation + notifications/events. |
| react/src/components/AdminModelCardSettingModal.tsx | Migrates to V2 modal using folderType="model_project" preset. |
…tion Resolves #6755(FR-2593) - Create FolderCreateModalV2.tsx using Relay useMutation with createVfolderV2 - Map form values to CreateVFolderV2Input (usageMode, projectId, permission, cloneable) - Map V2 response (VFolder with nested metadata/accessControl/ownership) back to FolderCreationResponse for backward compatibility - Keep useTanQuery for list_allowed_types() since no V2 equivalent exists - Update all consumers to import FolderCreateModalV2 - Original FolderCreateModal.tsx left untouched per epic guidelines Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fddd97a to
336251a
Compare

Resolves #6755 (FR-2593)
Summary
Introduces
FolderCreateModalV2, a rewrite of the VFolder creation modal on the V2 GraphQLcreateVfolderV2mutation. The bigger structural change in this PR is moving caller-intent (user vs. admin context) from implicit role inference into explicit, declarative props, and replacing the open-endedhiddenFormItemsescape hatch with a typedfolderTypepreset.User / admin separation
Previously the original
FolderCreateModaldecided whether to expose the project-folder option purely by reading the current user's role:This leaks admin UI when a superadmin user opens the same modal from a user-facing page (e.g. their personal Data page) — they would see project folder creation that doesn't belong in that context.
FolderCreateModalV2flips this: the page declares its context, and the modal honors it.allowCreateProjectFolder?: boolean(defaultfalse)Caller-controlled flag indicating the modal is being opened from an admin context where project folder creation should be exposed.
allowCreateProjectFolder→ project option becomes available.admin/superadmin) is kept as defense-in-depth, so a non-admin who somehow lands on an admin context (route-level permission misconfig) still cannot see the option.Effective condition for showing the project option:
folderType?: 'model_project'Replaces the prior pattern of
initialValues={...} + hiddenFormItems=[...]for "create a folder of a fixed shape" call sites. When set:usage_mode='model',type='project',permission='ro',cloneable=true(cloneableremains user-editable).nameandhost.folderTypeis intentionally a single-value union for now — extend it (e.g.'model_user') when the next preset is needed instead of adding more boolean flags.Removal of
hiddenFormItemsThe previous
hiddenFormItems: HiddenFormItemsType[]prop is removed. It was a leaky abstraction: callers had to know the modal's internal field names and individually opt out of each option. All real uses were really one of two intents — "this is an admin context" or "this is a model_project preset" — both now expressed declaratively.Caller updates
AdminModelCardSettingModalinitialValues={{ usage_mode: 'model', type: 'project', permission: 'ro', cloneable: true }}+ 4hiddenFormItemsentriesfolderType=\"model_project\"ImportArtifactRevisionToFolderModalfolderType=\"model_project\"AdminVFolderNodeListPageallowCreateProjectFolderVFolderMountFormItemhiddenFormItemshiddenFormItemsblock left as a TODO commentOther callers (
StartPage,VFolderNodeListPage,VFolderTable,VFolderSelect) only usedinitialValuesand are unaffected.V2 mutation
Folder creation now uses the
createVfolderV2mutation. The response is mapped back to the existingFolderCreationResponseshape so downstream code (notification, event dispatch, callers consumingresult.id) is unchanged. The RESTlist_allowed_typescall is retained as there is no V2 equivalent yet.Checklist: (if applicable)
createVfolderV2mutation availabilityAdminVFolderNodeListPage): admin should see the project type option via the new Create Folder button.