Skip to content

[PUI] Notes editor - #7284

Merged
SchrodingersGat merged 42 commits into
inventree:masterfrom
SchrodingersGat:notes-editor
Jun 4, 2024
Merged

SchrodingersGat merged 42 commits into
inventree:masterfrom
SchrodingersGat:notes-editor

Conversation

@SchrodingersGat

@SchrodingersGat SchrodingersGat commented May 21, 2024 •

Copy link
Copy Markdown
Member

TODO

  • Update unit tests for API endpoints
  • Playwright tests for notes components
  • OR prevent image resizing (for now)?
  • Allow uploaded images to be linked to specific model instances
  • Auto-delete related notes when the linked instance is removed
  • Update demo dataset with notes, uploaded image data, etc

Future Work

  • Allow image resizing (requires that we accept a subset of HTML tags on the server)
  • Consider moving "notes" to own API endpoint (like "metadata") - as potentially quite data heavy

@SchrodingersGat SchrodingersGat added refactor user interface User Interface Related to the frontend / User Interface labels May 21, 2024
@netlify

netlify Bot commented May 21, 2024 •

Copy link
Copy Markdown

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

Name Link
🔨 Latest commit 9e483ab
🔍 Latest deploy log https://app.netlify.com/sites/inventree-web-pui-preview/deploys/665ee6a48c7347000874890a
😎 Deploy Preview https://deploy-preview-7284--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: 100 (no change from production)
Accessibility: 89 (no change from production)
Best Practices: 92 (no change from production)
SEO: 70 (no change from production)
PWA: -
View the detailed breakdown and full score reports

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

@codecov

codecov Bot commented May 21, 2024 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 77.47748% with 25 lines in your changes missing coverage. Please review.

Project coverage is 83.36%. Comparing base (a5fa5f8) to head (9e483ab).
Report is 328 commits behind head on master.

Files with missing lines Patch % Lines
...rc/frontend/src/components/editors/NotesEditor.tsx 76.78% 12 Missing and 1 partial ⚠️
src/backend/InvenTree/common/validators.py 30.00% 7 Missing ⚠️
src/backend/InvenTree/InvenTree/models.py 71.42% 2 Missing ⚠️
...nTree/common/migrations/0023_auto_20240602_1332.py 0.00% 2 Missing ⚠️
src/frontend/src/pages/company/CompanyDetail.tsx 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7284      +/-   ##
==========================================
- Coverage   83.84%   83.36%   -0.48%     
==========================================
  Files        1055     1056       +1     
  Lines       46276    47007     +731     
  Branches     1390     1390              
==========================================
+ Hits        38799    39187     +388     
- Misses       7113     7454     +341     
- Partials      364      366       +2     
Flag Coverage Δ
backend 85.14% <78.84%> (-0.01%) ⬇️
pui 65.72% <76.27%> (+0.19%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@matmair

matmair commented May 21, 2024

Copy link
Copy Markdown
Member

@SchrodingersGat what is the difference between MDXEditor and the editor we are currently using?

@SchrodingersGat SchrodingersGat added this to the 0.16.0 milestone May 23, 2024
@wolflu05

Copy link
Copy Markdown
Member

@SchrodingersGat what is the difference between MDXEditor and the editor we are currently using?

I would be really interested on the answer as well.

@SchrodingersGat

SchrodingersGat commented May 27, 2024 •

Copy link
Copy Markdown
Member Author
  • This new editor has a few additional features (in particular the ability to resize images) which I found appealing, and it much more in line with the visual look and feel of the new interface.
  • It is also actively developed.
  • Due to the "/platform/" (or any other) prefix it is hard to display uploaded images in the older editor. There is a nice workaround in MDXEditor

However diving into "image resize" a bit more, that requires custom <img> tags (currently we disallow any html tags) and so would require a back-end change anyhow

@SchrodingersGat

Copy link
Copy Markdown
Member Author

As a separate issue I would like to explore removing the "notes" from the API endpoints where they currently reside, and put them into separate endpoints (like "metadata"). The "notes" fields can potentially house a lot of data and I do not see the benefit of serializing each notes field for every item when we are generating a list of items...

SchrodingersGat added a commit to inventree/inventree-python that referenced this pull request Jun 4, 2024
SchrodingersGat added a commit to inventree/inventree-python that referenced this pull request Jun 4, 2024
* Update API level for "modern" report templates

* Update unit tests

Ref: inventree/InvenTree#7284
@SchrodingersGat
SchrodingersGat merged commit 2b8e8e5 into inventree:master Jun 4, 2024
@SchrodingersGat
SchrodingersGat deleted the notes-editor branch June 4, 2024 11:53
martonmiklos pushed a commit to martonmiklos/InvenTree that referenced this pull request Jun 24, 2024
* Install mdxeditor

* Setup basic toolbar

* Refactoring

* Add placeholder for image upload

* Add fields to link uploaded notes to model instances

* Add custom delete method for InvenTreeNotesMixin

* Refactor CUI notes editor

- Upload model type and model ID information

* Enable image uplaod for PUI editor

* Update <NotesEditor> component

* Fix import

* Add button to save notes

* Prepend the host name to relative image URLs

* Disable image resize

* Add notifications

* Add playwright tests

* Enable "read-only" mode for notes

* Typo fix

* Styling updates to the editor

* Update yarn.lock

* Bump API version

* Update migration

* Remove duplicated value

* Improve toggling between edit mode

* Fix migration

* Fix migration

* Unit test updates

- Click on the right buttons
- Add 'key' properties

* Remove extraneous key prop

* fix api version

* Add custom serializer mixin for 'notes' field

- Pop the field for 'list' endpoints
- Keep for detail

* Update to NotesEditor

* Add unit test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor User Interface Related to the frontend / User Interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[React] New markdown editor

3 participants