mirror of
https://github.com/inventree/InvenTree.git
synced 2026-11-21 23:45:16 +00:00
[Refactor] Notes (#11971)
* Display note info
* Support user locale
* Add unit testing for HTML content
* Observe color mode
* Add link between Note and NotesImage
* Ensure image file is deleted when NotesImage is deleted
* Add support for image upload in editor
* Skeleton for data migration
* Updates
* Update data migration
- Find any NoteImage items which do not link to a model
- Try to associate them with an existing note
* Remove validator
* Updated API endpoints for NotesImage model
* Update server side sanitizing
* Specify max field length
* Remove old fields from NotesImage model
* Refactor clean_string
* Remove obsolete task
* Remove legacy "notes" field from older models
* Adjust search params when switching notes
* Remove NotesFieldMixin
* Change editor
* Resizable image support
* Support tables
* Add table style
* Adjust header actions
* Add data migration for SalesOrderShipment notes
* Adjust back-end sanitizing
* Adjust
* Use subtle editor variant
* Move undo/redo
* Enhance editing logic
* Add report tags for notes
* Add unit test for note image cleanup
* Render note to HTML
- Automatically replace images
* Fix migration order
* Adjust migration text
* Fix "dirty" trigger on notes
* Prevent navigate from dirty notes
* Add documentation
* Prevent image clicking if not in editing mode
* Update API
* Update migration files
* Fix migrations
* remove notes from test fixtures
* remove notes field that does not exsist anymore
* add missing ruleset
* fix assertation
* fix assertation
* Update docs/docs/concepts/notes.md
Co-authored-by: Matthias Mair <code@mjmair.com>
* Remove blocknote deps
* Move old helper functions
- Only used for this migration
- Will potentially be removed at some point in the future?
* Revert change
* Fix note image URL
* Fix migration conflicts
* Fix migrations
* Fix delete call
* Fix content mixin
* Fix note duplication
* Make save method atomic
* Fix double-save
* Add "template" field to Note model
* Adjust migrations
* Frontend updates
* Fix for NotesEditor
* Render Note instance in forms
* Fix button-within-button
* Fix migrations
* Fix missing import
* add docs
* docs for rendering notes in reports
* Restrict queryset based on user view permissions
* APi unit tests for note permissions
* Duplicate embedded images when copying notes
* Add unit test for note duplication
* Add CHANGELOG
* Add 'copy_note' option to duplicate serializer
* Add unit tests for data migrations
* implement note duplication serializers
* frontend UI elements
* Fix migration conflicts
* Use branch for playwrigh testing
* Implement duplicate action for stock item
* Fix import
* Updated playwright tests
* Bug fix for receiving stock items
* Add screenshot
* Fix api_version
* Update unit tests
* Fix docs
* Remove defunct tests
* Fix migration order
* Adjust import/export workflow
* Manual cleaning update
* Fix migrations
* Fix migration files
* Fix for note save
* Adjust save ordering
* Skip constraint checking in NoteSerializer
* Custom validate_constraints on Note model
* Revert "Skip constraint checking in NoteSerializer"
This reverts commit b42bc955c1.
* Fix for note search
* Fix for receive_line_items
* Shim model renderer for NoteTemplate
* Fix playwright tests
* Adjust frontend CI
* Fix import/export CI job
* Fix for data migration test
* Fix migration test
* Adjust unit test
* Fix conflicting migration
* Fix unit test
* Run migration tests in parallel
* Robustify migration test
* Disable parallel options
* Fix conflicting migration
* Remove extraneous unit test
* Fix conflicting migrations
* Additional regression tests
* Check permissions before deleting Note instance
* Updated docs
* Validate note model type
* Prevent discard of unsaved changes in note editor
* Clean up dead code
* Fix migration conflict
* Improved data migration
* Prefetch role groups
* UI refactoring
* Refactor permission checking code
* Further code refactoring
* use DuplicateField helper
* Refactoring
* Add prefetch
* Throw exception rather than assert
* Logic fix for notes editor
* reimplement old background task
* Adjust data migration
* Fix notes field when receiving items
* Fix existing report templates
* Fix save action for notes editor
* Refactoring: Add "instance-info" API endpoint for common model properties
* Fix indicator dots
* Tweak nav alert msg
* Adjust layout of buttons
* Sanitize notes during migration
* Fix for NotesImage delete cascade
* Fix caching
* Fix race condition in notes editor
* Fix distinct issue when searching notse
* Fix race condition when saving new note instance
* Fix improper error
* Refactor StockItem duplication
* Refactoring
* Increase query time
* Fix api_version.py
* Additional migration tests
* Fix CI workflow
---------
Co-authored-by: Matthias Mair <code@mjmair.com>
This commit is contained in:
1 parent
d39d0262e6
commit
02da01dfec
108 files changed
+6902
-1643
No files matched your search
@@ -1058,23 +1058,61 @@ test('Parts - Test Results', async ({ browser }) => {
|
||||
});
|
||||
|
||||
test('Parts - Notes', async ({ browser }) => {
|
||||
const page = await doCachedLogin(browser, { url: 'part/69/notes' });
|
||||
const page = await doCachedLogin(browser, { url: 'part/71/details' });
|
||||
|
||||
// Enable editing
|
||||
await page.getByLabel('Enable Editing').waitFor();
|
||||
await loadTab(page, 'Notes');
|
||||
|
||||
// Use keyboard shortcut to "edit" the part
|
||||
await page.keyboard.press('Control+E');
|
||||
await page.getByLabel('text-field-name', { exact: true }).waitFor();
|
||||
await page.getByLabel('text-field-description', { exact: true }).waitFor();
|
||||
await page.getByLabel('tree-field-category').waitFor();
|
||||
// Expect to see notes rendered for this part
|
||||
await page.getByRole('cell', { name: 'Red Widget' }).waitFor();
|
||||
await page.getByRole('cell', { name: 'Blue Widget' }).waitFor();
|
||||
await page.getByRole('cell', { name: 'Green Widget' }).waitFor();
|
||||
await page
|
||||
.getByRole('link', { name: 'Read more in the documentation' })
|
||||
.waitFor();
|
||||
|
||||
// Let's try to create a new note, but cancel before submitting
|
||||
await page.getByRole('button', { name: 'Add Note' }).click();
|
||||
await page.getByLabel('related-field-template').fill('instructions');
|
||||
await page
|
||||
.getByRole('option', { name: 'Manufacturing Instructions' })
|
||||
.click();
|
||||
await page.getByText('Manufacturing Instructions').waitFor();
|
||||
await page.getByText('How to build this part').waitFor();
|
||||
await page.getByRole('button', { name: 'Cancel' }).click();
|
||||
|
||||
// Enable notes editing
|
||||
await page.getByLabel('Enable Editing').click();
|
||||
// Enable editing for this note
|
||||
await page.getByRole('button', { name: 'edit-note' }).click();
|
||||
|
||||
await page.getByLabel('Save Notes').waitFor();
|
||||
await page.getByLabel('Close Editor').waitFor();
|
||||
await page.getByRole('button', { name: 'Bold' }).waitFor();
|
||||
await page.getByRole('button', { name: 'Italic' }).waitFor();
|
||||
await page.getByRole('button', { name: 'Underline' }).waitFor();
|
||||
await page.getByRole('button', { name: 'Heading 1' }).waitFor();
|
||||
await page.getByRole('button', { name: 'Heading 2' }).waitFor();
|
||||
await page.getByRole('button', { name: 'Heading 3' }).waitFor();
|
||||
|
||||
await page.getByRole('button', { name: 'finish-editing-note' }).click();
|
||||
|
||||
// Duplicate this part - should show options for copying notes
|
||||
await page.getByRole('button', { name: 'action-menu-part-actions' }).click();
|
||||
await page
|
||||
.getByRole('menuitem', { name: 'action-menu-part-actions-duplicate' })
|
||||
.click();
|
||||
await page
|
||||
.getByRole('switch', { name: 'boolean-field-duplicate.copy_notes' })
|
||||
.waitFor();
|
||||
|
||||
// Generate random IPN for copying
|
||||
const ipn = `IPN-${Math.floor(Math.random() * 100000)}`;
|
||||
await page.getByRole('textbox', { name: 'text-field-IPN' }).fill(ipn);
|
||||
await page.getByRole('button', { name: 'Submit' }).click();
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.getByText(`Part: ${ipn}`).waitFor();
|
||||
|
||||
// Check that the notes have been duplicated to this new part
|
||||
await loadTab(page, 'Notes');
|
||||
await page
|
||||
.getByRole('heading', { name: 'On Widgets (And Variants Thereof)' })
|
||||
.waitFor();
|
||||
});
|
||||
|
||||
test('Parts - 404', async ({ browser }) => {
|
||||
|
||||
Reference in new issue
Block a user