[PR #29753] feat: add view mode toggle for online documents and implement tree view structure #32538

Open
opened 2026-02-21 20:51:36 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/29753

State: open
Merged: No


Fixes #29685

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

This PR adds a new tree view mode for online documents and online drive data sources, allowing users to toggle between list and tree view for better file organization visualization.

Key Changes:

  • View Mode Toggle: Added a UI toggle component to switch between list and tree view modes
  • Tree View Implementation: Implemented a hierarchical tree structure for displaying files and folders
  • Tree Utilities: Created tree-utils.ts with utility functions for:
    • Building tree structures from flat file lists
    • Handling expand/collapse states
    • Path-based node finding and manipulation
  • State Management: Updated store slices to manage view mode preferences and tree state
  • Internationalization: Added i18n support for view mode labels in English and Japanese
  • Type Definitions: Extended pipeline models with tree view related types

Technical Details:

  • 15 files changed: 813 insertions(+), 31 deletions(-)
  • Frontend-only changes in the /web directory
  • Follows React 19 and Next.js 15 best practices
  • Maintains type safety with TypeScript strict mode

Screenshots

Before After
List view only Toggle between list view and tree view with hierarchical file structure

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
**Original Pull Request:** https://github.com/langgenius/dify/pull/29753 **State:** open **Merged:** No --- Fixes #29685 > [!IMPORTANT] > > 1. Make sure you have read our [contribution guidelines](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) > 1. Ensure there is an associated issue and you have been assigned to it > 1. Use the correct syntax to link this PR: `Fixes #<issue number>`. ## Summary This PR adds a new tree view mode for online documents and online drive data sources, allowing users to toggle between list and tree view for better file organization visualization. ### Key Changes: - **View Mode Toggle**: Added a UI toggle component to switch between list and tree view modes - **Tree View Implementation**: Implemented a hierarchical tree structure for displaying files and folders - **Tree Utilities**: Created `tree-utils.ts` with utility functions for: - Building tree structures from flat file lists - Handling expand/collapse states - Path-based node finding and manipulation - **State Management**: Updated store slices to manage view mode preferences and tree state - **Internationalization**: Added i18n support for view mode labels in English and Japanese - **Type Definitions**: Extended pipeline models with tree view related types ### Technical Details: - **15 files changed**: 813 insertions(+), 31 deletions(-) - Frontend-only changes in the `/web` directory - Follows React 19 and Next.js 15 best practices - Maintains type safety with TypeScript strict mode ## Screenshots | Before | After | |--------|-------| | List view only | Toggle between list view and tree view with hierarchical file structure | ## Checklist - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [x] I've updated the documentation accordingly. - [x] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:51:36 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#32538