Skip to content

feat(assets): add folder-based Assets view with move and bulk actions - #238

Merged
artempartos merged 3 commits into
developfrom
feat/assets-folder-view
Sep 17, 2026
Merged

artempartos merged 3 commits into
developfrom
feat/assets-folder-view

Conversation

@dvislov

@dvislov dvislov commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implements palad-ai/palad-app#564 — a Google Drive-style folder view for Project/Company Assets, plus a folder-aware asset picker for workflow/session creation, plus (by request) Drive-parity move and bulk actions beyond the mockup.

Project Assets used to dump every file into one flat table, with folder as just a path label on the row — finding a file meant scanning the whole list, and a folder wasn't a navigable object. Folder navigation is now the default view; the old flat table is kept as a secondary All files toggle.

What changed

Folders (backend)

  • New Folder model, polymorphic-scoped to Project/Company like Asset, with nested paths (dashboard/specs)
  • FolderService: create, relocate! (one cascade primitive powering both rename and move, with collision guards against the DB unique index), destroy! (empty-only by default, or recursive: true which soft-deletes nested files)
  • Asset#folder now allows /-nested paths (was single-segment only)
  • New POST/PATCH/DELETE folder endpoints (project + company), policies, FolderResource

Folders (frontend)

  • AssetsContent.tsx reworked: Folders/All-files toggle (Folders default), breadcrumbs, New folder / Rename / Delete (with a non-empty-folder "Delete anyway" path), empty states — matching the reference mockup
  • Search flattens across the whole tree regardless of view
  • Company-owned folders/files show read-only when viewed from a project (mirrors the existing asset-delete rule)

Asset picker

  • New AssetPicker.tsx: a folder-grouped, searchable combobox replacing the plain MultiSelect everywhere assets are attached to a workflow/step/session (5 call sites). A folder's header bulk-toggles every file under it — storage stays a plain array of asset ids, no backend resolution change. Empty folders don't appear (nothing to select).

Drive parity beyond the mockup (requested)

  • "Move to folder" — a row action (file and folder) and drag-and-drop (via @dnd-kit) onto a folder row
  • Bulk select: a "Select" toolbar button arms checkboxes; a selection bar offers Move/Delete
  • New PATCH assets/:id (single move) and POST assets/bulk_actions (bulk move/delete) endpoints, AssetBulkService, mirroring the Board's existing bulk-action pattern

Out of scope

Column sorting, grid/thumbnail view, right-click context menu — deliberately left out; can follow separately if wanted.

Testing

  • docker compose exec -T web make check_all green: rails-test, rubocop, brakeman, system-test, eslint, typescript, fsd, fe-test, vite-build
  • New/updated tests at every layer: model, service, policy, request/integration, FE pure-lib, FE component — folder CRUD, nested-path validation, rename-cascade collision guards, recursive delete, the asset picker's folder bulk-select, move (row action + drag-and-drop resolver), bulk select/move/delete

Docs

Updated the in-app "Using Flow" Assets guide (app/frontend/pages/Docs/data/pages/assets.md) for folders, moving files, and the picker.

🤖 Generated with Claude Code

https://claude.ai/code/session_017LnXH16Mk6wcHU631ZG8Yi

@dvislov dvislov self-assigned this Sep 11, 2026
@dvislov
dvislov marked this pull request as draft September 11, 2026 10:49
@dvislov
dvislov force-pushed the feat/assets-folder-view branch 2 times, most recently from 9ee8957 to 218a138 Compare September 14, 2026 11:43
@dvislov
dvislov requested a review from artempartos September 15, 2026 08:37
@dvislov
dvislov marked this pull request as ready for review September 15, 2026 08:38
@dvislov
dvislov force-pushed the feat/assets-folder-view branch from 218a138 to c205cde Compare September 15, 2026 11:10
@artempartos

Copy link
Copy Markdown
Contributor

need rebase

@dvislov
dvislov force-pushed the feat/assets-folder-view branch from c205cde to 413466e Compare September 17, 2026 07:54
dvislov and others added 2 commits September 17, 2026 19:14
Project Assets dumped every file into one flat table — folder was only a path
label on the row, so finding a file meant scanning the whole list. Folder
navigation is now the default: folders are first-class, clickable, and
support nested paths, with the flat table kept as a secondary "All files"
view. The workflow/session asset pickers group by folder too, with a folder
header selecting its whole subtree at once.

Folders are a persisted model (`Folder`), scoped like `Asset` to a Project or
Company, with `FolderService` driving create / relocate (rename and move,
sharing one cascade) / destroy (empty-only, or recursive with nested files
going to trash). `Asset#folder` now allows nested `a/b/c` paths.

Beyond the mockup, this also adds Drive-style file organizing: a "Move to
folder" action (row-level and drag-and-drop) and a multi-select bar for
bulk move/delete, backed by new `assets#update` / `assets#bulk_actions`
endpoints and `AssetBulkService`.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017LnXH16Mk6wcHU631ZG8Yi
Signed-off-by: Dmitry Vislov <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
Permanent (hard) user deletion (#262) landed on develop in parallel with
this branch. It relies on every authorship foreign key being ON DELETE
:nullify so Postgres anonymises history rows instead of refusing the
DELETE — EnablePermanentUserDeletion flipped all fourteen of them.

`folders` was created on this branch with a NOT NULL `created_by_id`
behind an ON DELETE RESTRICT foreign key, so it is the one table that
migration could not know about. Permanently deleting anyone who has ever
created a folder would raise ActiveRecord::InvalidForeignKey. No test
caught it: the deletion suite predates folders, and the folder suite
never deletes a user.

Give the column the same treatment assets already get — nullable,
ON DELETE :nullify, `optional: true` — and cover it from both sides.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
@artempartos
artempartos force-pushed the feat/assets-folder-view branch from 413466e to 663a853 Compare September 17, 2026 15:24
The folder view narrowed `Asset#folder` from "any label without a
separator or control character" to `[a-zA-Z0-9_-]` segments. The PR
describes that as widening — paths may now nest — but it also drops
spaces and every non-Latin script, which asset folders have accepted
since they were introduced.

Nothing migrates the rows already named that way. Reads are unaffected,
but every write path runs validations, including Asset#soft_delete!,
which is a plain `update!`. A folder named "Отчёты" or "notes (draft)"
could therefore no longer be moved, promoted, or deleted, and
AssetBulkService would report the format error as a per-row skip reason.

So a segment is free-form again — everything except `/`, `\` and control
characters, the exact set Asset::FOLDER_FORMAT allowed — and nesting is
layered on top rather than paid for. Two things come with that:

- Asset::RESERVED_FOLDERS was lost in the rewrite. Without it a segment
  may be "..", which walks the path out of /workspace/assets entirely.
  It returns as Folder::RESERVED_SEGMENTS, now checked per segment, so
  "docs/.." is rejected too. The permissive charset is safe because
  every consumer shell-escapes the path (SessionContextService#
  download_file_to_container).
- Allowing spaces again means "docs" and "docs " are two folders that
  render identically. A single outer strip used to prevent that, but
  nesting puts segments where it cannot reach, so Folder.normalize_path
  trims each segment instead and Asset.normalize_folder delegates to it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
@artempartos
artempartos merged commit 9475d55 into develop Sep 17, 2026
7 checks passed
NOX73 added a commit that referenced this pull request Nov 14, 2026
* feat(integrations): agents act as the user on GitLab (#238)

Adds a gitlab provider to the unified OAuth engine over the deployment's GitLab OAuth app, act-as consent for gitlab, and the gitlab_user_token and gitlab_user_token_for tools sharing one concern with the GitHub pair. The profile's Connected accounts page shows both providers.

Signed-off-by: Alex <[email protected]>

* fix(integrations): resolve the shared Refusal error and update tests for gitlab as a known provider

Signed-off-by: Alex <[email protected]>

* test(integrations): use the implicit association style for the gitlab credential factory

Signed-off-by: Alex <[email protected]>

* chore(types): regenerate the ActAsConsent type digest

Signed-off-by: Alex <[email protected]>

* fix(profile): repair the Connected accounts page test and formatting

Signed-off-by: Alex <[email protected]>

* fix(profile): restore the Connected accounts page test

Signed-off-by: Alex <[email protected]>

* test(integrations): cover gitlab in UserConnections

Signed-off-by: Alex <[email protected]>

* fix(integrations): address review of the GitLab user token

Revoke only current-host grants on disconnect, leave old-host grants to lapse,
dispatch the latest connection through PROVIDERS, move identity onto
OauthCredential, name the OAuth app and endpoints explicitly, stop refreshing
early (R2), name the provider in accessible names, warn at the GitLab consent
switches, and fix the GitLab guide.

Signed-off-by: Alex <[email protected]>

* refactor(integrations): the credential model owns the identity metadata key

Github/Gitlab::UserConnection read the key from OauthCredential::IDENTITY_FIELDS; move this PR's changelog entry to Unreleased.

Signed-off-by: Alex <[email protected]>

* refactor(integrations): GitLab user calls use the gitlab gem; the OAuth engine revokes the grant

Signed-off-by: Alex <[email protected]>

* test(integrations): stub the GitLab revocation request in the disconnect test

Signed-off-by: Alex <[email protected]>

---------

Signed-off-by: Alex <[email protected]>
Co-authored-by: Alex <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants