Skip to content

feat(FR-2593): implement VFolder creation modal using V2 GraphQL mutation#6759

Open
ironAiken2 wants to merge 1 commit intomainfrom
04-16-feat_fr-2593_implement_vfolder_creation_modal_using_v2_graphql_mutation
Open

feat(FR-2593): implement VFolder creation modal using V2 GraphQL mutation#6759
ironAiken2 wants to merge 1 commit intomainfrom
04-16-feat_fr-2593_implement_vfolder_creation_modal_using_v2_graphql_mutation

Conversation

@ironAiken2
Copy link
Copy Markdown
Contributor

@ironAiken2 ironAiken2 commented Apr 16, 2026

Resolves #6755 (FR-2593)

Summary

Introduces FolderCreateModalV2, a rewrite of the VFolder creation modal on the V2 GraphQL createVfolderV2 mutation. 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-ended hiddenFormItems escape hatch with a typed folderType preset.

User / admin separation

Previously the original FolderCreateModal decided whether to expose the project-folder option purely by reading the current user's role:

{(userRole === 'admin' || userRole === 'superadmin') && _.includes(allowedTypes, 'group') && ...}

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.

FolderCreateModalV2 flips this: the page declares its context, and the modal honors it.

allowCreateProjectFolder?: boolean (default false)

Caller-controlled flag indicating the modal is being opened from an admin context where project folder creation should be exposed.

  • User-facing pages omit it → project option is never shown, even for superadmins.
  • Admin pages opt in by passing allowCreateProjectFolder → project option becomes available.
  • The user role check (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:

allowCreateProjectFolder && isAdmin && allowedTypes.includes('group')

folderType?: 'model_project'

Replaces the prior pattern of initialValues={...} + hiddenFormItems=[...] for "create a folder of a fixed shape" call sites. When set:

  • Pre-selects usage_mode='model', type='project', permission='ro', cloneable=true (cloneable remains user-editable).
  • Disables the structural radio groups so the user can see they are locked but cannot change them.
  • Suppresses the existing warning tooltips/icons on disabled options for a clean read-only appearance.
  • Caller still controls name and host.

folderType is 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 hiddenFormItems

The 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

Caller Before After
AdminModelCardSettingModal initialValues={{ usage_mode: 'model', type: 'project', permission: 'ro', cloneable: true }} + 4 hiddenFormItems entries folderType=\"model_project\"
ImportArtifactRevisionToFolderModal Same as above folderType=\"model_project\"
AdminVFolderNodeListPage Create Folder button was a TODO Wired with allowCreateProjectFolder
VFolderMountFormItem Used hiddenFormItems Currently unused component; hiddenFormItems block left as a TODO comment

Other callers (StartPage, VFolderNodeListPage, VFolderTable, VFolderSelect) only used initialValues and are unaffected.

V2 mutation

Folder creation now uses the createVfolderV2 mutation. The response is mapped back to the existing FolderCreationResponse shape so downstream code (notification, event dispatch, callers consuming result.id) is unchanged. The REST list_allowed_types call is retained as there is no V2 equivalent yet.

Checklist: (if applicable)

  • Documentation
  • Minimum required manager version — verify createVfolderV2 mutation availability
  • Specific setting for review (eg., KB link, endpoint or how to setup)
  • Minimum requirements to check during review
  • Test case(s) to demonstrate the difference of before/after
    • User-facing page (e.g. user Data page): superadmin should not see the project type option.
    • Admin page (AdminVFolderNodeListPage): admin should see the project type option via the new Create Folder button.
    • Admin Model Card / Import Artifact: opening the create-folder dialog should show the form locked to model+project+ro, with cloneable still toggleable.

Copy link
Copy Markdown
Contributor Author

ironAiken2 commented Apr 16, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • flow:merge-queue - adds this PR to the back of the merge queue
  • flow:hotfix - for urgent changes, fast-track this PR to the front of 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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 16, 2026

Coverage report for ./react

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

@ironAiken2 ironAiken2 marked this pull request as ready for review April 21, 2026 03:53
@ironAiken2 ironAiken2 force-pushed the 04-16-feat_fr-2593_implement_vfolder_creation_modal_using_v2_graphql_mutation branch from 090778a to fddd97a Compare April 21, 2026 03:53
Copilot AI review requested due to automatic review settings April 21, 2026 03:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 FolderCreateModal usages with FolderCreateModalV2 across user and admin pages/components.
  • Added “Create Folder” entry point to AdminVFolderNodeListPage and 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.

Comment thread react/src/components/FolderCreateModalV2.tsx
Comment thread react/src/components/FolderCreateModalV2.tsx
…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>
@ironAiken2 ironAiken2 force-pushed the 04-16-feat_fr-2593_implement_vfolder_creation_modal_using_v2_graphql_mutation branch from fddd97a to 336251a Compare April 21, 2026 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500~ LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement VFolder creation modal using Strawberry V2 GraphQL API

2 participants