Integration manager with Paperless & Papra integrations
Summary by CodeRabbit
-
New Features
- Introduced a modular integration system supporting external document management integrations (e.g., Paperless NGX, Papra, Home Assistant).
- Added settings UI for managing and configuring integrations, including dynamic schema-driven forms and connection testing.
- Enabled linking, searching, and attaching external documents to assets and sub-assets via a new modal interface.
- Integration badges now appear on asset file previews and in the UI.
- Enhanced file duplication logic to support external files.
-
UI/Style
- Added new stylesheets for integration settings, external document search modal, Home Assistant integration, demo mode, and responsive layouts.
- Updated file preview and upload UI to support integration badges and improved styling.
-
Documentation
- Added comprehensive guides and references for implementing and managing integrations, including schema conventions and development checklists.
-
Bug Fixes
- Improved handling and validation of sensitive integration credentials and external file paths.
-
Chores
- Refactored codebase to support new integration managers and modular architecture.
- Updated server endpoints and static asset handling for integration support.
The preview deployment is ready. 🟢
Open Preview | Open Build Logs
Last updated at: 2025-07-25 20:06:20 CET
Bugbot run
😱 Found 4 issues. Time to roll up your sleeves! 😱
⚠️ Only 5 files were analyzed due to processing limits.
Need help? Join our Discord for support!
https://discord.gg/qEjHQk64Z9
[!IMPORTANT]
Review skipped
Auto reviews are disabled on base/target branches other than the default branch.
Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.
Walkthrough
This update introduces a comprehensive, schema-driven integration system to the application, affecting both backend and frontend. It adds an Integration Manager for centralized integration handling, new integration modules (Paperless NGX, Papra, Home Assistant), dynamic UI generation for integration settings, external document linking in asset management, and extensive new CSS for responsive and integration-specific styling. Documentation is added to guide integration development.
Changes
| File(s) | Change Summary |
|---|---|
.github/copilot-instructions.md, integrations/INTEGRATION.md |
Added detailed documentation for the new schema-driven integration framework, including backend and frontend conventions, schema reference, error handling, and development checklist. |
integrations/homeassistant.js, integrations/paperless.js, integrations/papra.js |
Added new integration modules for Home Assistant, Paperless NGX, and Papra, each defining a schema, configuration validation, API interaction methods, and Express route registration for integration-specific endpoints. |
integrations/integrationManager.js |
Introduced an Integration Manager class to register, manage, validate, and expose integrations, handling sensitive data masking, config validation, and route registration. |
public/assets/css/styles.css, public/assets/css/demo-styles.css, |
Added and updated CSS for integration settings UI, file type hints, and removed demo mode styles. |
public/assets/css/homeassistant-styles.css, public/assets/css/integration-styles.css, |
Added new CSS files for Home Assistant and general integration UI, including modal, buttons, filter controls, results, badges, and responsive design. |
public/assets/css/responsive-styles.css |
Added responsive CSS rules for various breakpoints to optimize layout and usability across devices. |
public/index.html, public/login.html |
Updated HTML to use new CSS files, added external document linking buttons, a modal for external doc search, and an integrations section in settings. |
public/managers/externalDocManager.js |
Added a manager for searching and linking external documents from integrations, supporting dynamic integration filters, debounced search, pagination, and UI updates. |
public/managers/integrations.js |
Added a manager for loading, rendering, and managing integration settings in the UI, supporting schema-driven field generation, toggling, and connection testing. |
public/managers/modalManager.js |
Enhanced modal manager to support attaching, previewing, and removing external documents from integrations for assets and sub-assets, including badge rendering. |
public/managers/settings.js |
Updated settings manager to load and save integration settings dynamically, applying them to the form and reloading active integrations after save. |
public/script.js |
Refactored main initialization to instantiate and inject new managers (IntegrationsManager, ExternalDocManager) into relevant modules, enabling integration features throughout the app. |
server.js |
Added integration management to server: new API endpoints for integrations, configuration validation, secure token handling, registration of integration routes, and enhanced file duplication logic for external files. |
src/constants.js |
Introduced a constants file for integration categories, statuses, field types, token masking, and API endpoints. |
src/services/render/assetRenderer.js |
Added support for rendering integration badges on asset file previews by injecting integrationsManager and updating file grid HTML generation. |
src/services/render/previewRenderer.js, src/services/render/index.js |
Enhanced preview rendering to display integration badges, handle integration-specific previews, and inject integrationsManager. Added and exported an initialization function for preview rendering. |
Sequence Diagram(s)
sequenceDiagram
participant User
participant Frontend
participant IntegrationsManager (Frontend)
participant ExternalDocManager
participant ModalManager
participant Backend
participant IntegrationManager (Backend)
participant IntegrationModule
User->>Frontend: Opens Settings or clicks "Link External"
Frontend->>IntegrationsManager (Frontend): Load integrations (GET /api/integrations)
IntegrationsManager (Frontend)->>Backend: GET /api/integrations
Backend->>IntegrationManager (Backend): getIntegrationsForSettings()
IntegrationManager (Backend)-->>Backend: Return schemas (with sensitive fields masked)
Backend-->>IntegrationsManager (Frontend): Integration schemas
IntegrationsManager (Frontend)-->>Frontend: Render dynamic integration UI
User->>Frontend: Clicks "Test Connection"
Frontend->>Backend: POST /api/integrations/:id/test (with config)
Backend->>IntegrationManager (Backend): prepareConfigForTesting()
IntegrationManager (Backend)->>IntegrationModule: testConnection()
IntegrationModule-->>IntegrationManager (Backend): Status/result
IntegrationManager (Backend)-->>Backend: Status/result
Backend-->>Frontend: Success/error response
User->>Frontend: Clicks "Link External" for file attachment
Frontend->>ExternalDocManager: Open modal, load integrations (GET /api/integrations/enabled)
ExternalDocManager->>Backend: GET /api/integrations/enabled
Backend->>IntegrationManager (Backend): getEnabledIntegrations()
IntegrationManager (Backend)-->>Backend: Enabled integrations
Backend-->>ExternalDocManager: Enabled integrations
ExternalDocManager-->>Frontend: Render modal with filters
User->>ExternalDocManager: Search or browse documents
ExternalDocManager->>Backend: GET /api/{integration}/search
Backend->>IntegrationModule: searchDocuments()
IntegrationModule-->>Backend: Search results
Backend-->>ExternalDocManager: Results
ExternalDocManager-->>Frontend: Display results
User->>ExternalDocManager: Clicks "Link" on a document
ExternalDocManager->>ModalManager: Attach external document
ModalManager-->>Frontend: Show preview with integration badge
Poem
🐇
A hop, a leap, integrations bloom,
With badges bright, they chase the gloom.
Paperless, Papra, Home Assistant too,
Linking docs and settings—something new!
Modals shimmer, badges gleam,
Schema-driven magic, a rabbit’s dream.
Hooray for code that hops so far—
Now every system’s not so far!
✨ Finishing Touches
🧪 Generate unit tests
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
- [ ] Commit unit tests in branch
integration-manager-with-paperless
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Explain this complex logic.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai explain this code block.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and explain its main purpose.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR.@coderabbitai generate unit teststo generate unit tests for this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
@coderabbitai review
Review triggered. Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.✅ Actions performed
[!NOTE] Generated docstrings for this pull request at https://github.com/DumbWareio/DumbAssets/pull/114