Skip to content

[Refactor] Notes#11971

Draft
SchrodingersGat wants to merge 24 commits into
inventree:masterfrom
SchrodingersGat:block-notes
Draft

[Refactor] Notes#11971
SchrodingersGat wants to merge 24 commits into
inventree:masterfrom
SchrodingersGat:block-notes

Conversation

@SchrodingersGat
Copy link
Copy Markdown
Member

@SchrodingersGat SchrodingersGat commented May 20, 2026

Generic Notes Table

The major item here is to move all notes into a new table, which has generic FK links to other items. This brings it into line with how we handle attachments, parameters, etc.

Multiple Notes

We can now specify multiple, separate notes per item. This is useful for keeping different types of notes separate - e.g. shipping instructions vs inspection instructions (for e.g.)

Editor Updates

Also introduces the possibility of a more intuitive notes editor. At this stage, I am trialing BlockNote - which provides navite mantine support, and provides a "notion style" editing interface.

Pros:

  • Intuitive, "modern" editing interface
  • Supports more content layout features
  • Resizable images

Cons:

  • Requires HTML formatting
  • Current notes use markdown

Tasks

  • Implementation
  • Display note information (title / description / last updated by)
  • Allow delete notes (if user has permission)
  • Client side sanitize of notes
  • Server side sanitize of notes
  • Support direct image upload (drag and drop / copy-paste)
  • Add plugin to link directly to attachments
  • Documentation
  • Render notes in PDF reports
  • Export notes?
  • Data migration for existing notes
  • Handle legacy "NotesImage" concept - how to detect and embed these images?
  • prevent navigation away when notes are dirty
  • Allow note selection from query params
  • Update demo dataset
  • Unit tests
  • Playwright tests
  • Remove "notes" field from any models which use the new approach
  • Delete the old "notes" mixin class

@SchrodingersGat SchrodingersGat added this to the 1.4.0 milestone May 20, 2026
@SchrodingersGat SchrodingersGat added api Relates to the API refactor feature migration Data or schema migrations User Interface Related to the frontend / User Interface full-run Always do a full QC CI run labels May 20, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented May 20, 2026

Deploy Preview for inventree-web-pui-preview ready!

Name Link
🔨 Latest commit 7315c34
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/6a0ef17d99828e00084d9355
😎 Deploy Preview https://deploy-preview-11971--inventree-web-pui-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 92 (🟢 up 1 from production)
Accessibility: 82 (no change from production)
Best Practices: 100 (no change from production)
SEO: 78 (no change from production)
PWA: -
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@SchrodingersGat SchrodingersGat marked this pull request as draft May 20, 2026 12:41
@SchrodingersGat
Copy link
Copy Markdown
Member Author

@matmair @wolflu05 before I go too far with this I'd be interested in your feedback around two major points:

Data Structure Refactor: Are we on board with the idea of supporting multiple notes per item?

Editor: Do you have any objections to moving to a new editor, and move to HTML notes? We will obviously have to tackle any data sanitizing required here

@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

❌ Patch coverage is 81.39535% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.70%. Comparing base (3f34336) to head (7315c34).

❌ Your patch check has failed because the patch coverage (86.89%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11971      +/-   ##
==========================================
- Coverage   91.44%   90.70%   -0.75%     
==========================================
  Files         974      968       -6     
  Lines       50704    50056     -648     
==========================================
- Hits        46365    45401     -964     
- Misses       4339     4655     +316     
Flag Coverage Δ
backend 89.72% <81.39%> (+0.45%) ⬆️
migrations 40.62% <42.44%> (-1.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Backend Apps 90.81% <ø> (-0.96%) ⬇️
Backend General 93.14% <86.89%> (-0.35%) ⬇️
Frontend ∅ <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@matmair
Copy link
Copy Markdown
Member

matmair commented May 20, 2026

I think the general idea is very good; a few points/ideas:

  • I would like to see some tests in the final PR to ensure we do not leak data due to this migration
  • if we already build a new model we might as well add created, updated and created_by, updated_by fields
  • does a note owner make sense?
  • should we add user customizable types?
  • should we addnote states?
  • having a special "primary" note that still renders to the api seems like a good idea; i have seen a bunch of ppl use notes fields for all kind of plugins; this change would be pretty breaking

I like blocknote as a choice, the OpenProject and a bunch of other EU sovereign gov cloud products use it.
How we save/provide notes data in the future is still a bit of a question; there is markdown support from what I can tell. And if we are already switching data model why not use the native document format and just save a html (or markdown) representation on the side? That seems safer and better for future customizations of the editor capabilities.

Things i am unsure about:

  • what does rendering to reports look like? are existing reports breaking?
  • possible security problems?

@wolflu05
Copy link
Copy Markdown
Member

I also like the general idea, the current notes editor seems very limited. But I would appreciate if there would be some easy migration path from markdown based notes to the new format, and a method to render the new notes format to reports.

@SchrodingersGat SchrodingersGat added the breaking Indicates a major update or change which breaks compatibility label May 21, 2026
@SchrodingersGat
Copy link
Copy Markdown
Member Author

But I would appreciate if there would be some easy migration path from markdown based notes to the new format

All markdown features should be forward-compatible. This will be fully tested. I don't want to lose any of my notes, either.

and a method to render the new notes format to reports.

100% will be supported and tested too.

The back-end storage of the notes will be editor-agnostic HTML. So rendering to reports will be easier (ideally) than markdown.

@SchrodingersGat SchrodingersGat modified the milestones: 1.4.0, 2.0.0 May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Relates to the API breaking Indicates a major update or change which breaks compatibility feature full-run Always do a full QC CI run migration Data or schema migrations refactor User Interface Related to the frontend / User Interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Notes Improvements

3 participants