Draft: F fix get parents
Summary
This is a fix for #157 .
The other functions in caosdb.js need to be checked for similar problems.
This was implemented by @salexan a while ago.
Test Environment
How to set up a test environment for manual testing?
Check List for the Author
Please, prepare your MR for a review. Be sure to write a summary and a focus and create gitlab comments for the reviewer. They should guide the reviewer through the changes, explain your changes and also point out open questions. For further good practices have a look at our review guidelines
-
All automated tests pass -
Reference related Issues -
Up-to-date CHANGELOG.md -
Annotations in code (Gitlab comments) - Intent of new code
- Problems with old code
- Why this implementation?
Check List for the Reviewer
-
I understand the intent of this MR -
All automated tests pass -
Up-to-date CHANGELOG.md -
The test environment setup works and the intended behavior is reproducible in the test environment -
In-code documentation and comments are up-to-date. -
Check: Are there spezifications? Are they satisfied?
For further good practices have a look at our review guidelines.
Merge request reports
Activity
added 234 commits
-
5b3b7c5c...35af6e04 - 66 commits from branch
dev
- 1626b055 - add install script for the annotation module's data model
- 6a624658 - try
- 7efc337e - Merge branch 'dev' into f-tour-menu
- 70271e65 - tourmenu
- eebce8cf - up
- fc1ac230 - up
- dec00fbd - Merge branch 'f-tour-menu-tmp' into 'f-tour-menu'
- 3642f4d4 - up
- 99d84516 - WIP: prev/next buttons open pages immediately
- e338938d - Merge branch 'dev' into f-fix-annotation-module
- 85d20828 - WIP
- f761d813 - WIP
- 81c8d90b - MAINT: update bootstrap to version 5
- 5eccdfc8 - Comment annotation datamodel and fix for versioning
- 2eb0a336 - Merge branch 'f-tour-tmp' into f-bootstrap
- a77fc97f - fix functions
- 0fa78d20 - fixes
- 5e2d6073 - up
- adbbf4a1 - up
- a95962b7 - styling
- 346dfad5 - add install script for the annotation module's data model
- 45c470b1 - Comment annotation datamodel and fix for versioning
- 19e39861 - Merge branch 'f-fix-annotation-module' of...
- 731bac47 - popovers
- d30f2342 - style
- 1e7da8d2 - no post cb without instance
- c82f3196 - up
- 469b9f5f - WIP: popover initialization
- 6b64c256 - Merge branch 'f-boot-tour' of gitlab.indiscale.com:caosdb/src/caosdb-webui into f-boot-tour
- 8527e274 - fix merge bugs
- d8e8bef6 - move tour menu to special panel
- e269a9f6 - WIP: tour sidebar
- 2633ac2e - style
- f94150e6 - remove tmp file
- d530865f - Merge branch 'f-boot-tour' of gitlab.indiscale.com:caosdb/src/caosdb-webui into f-boot-tour
- ceec4ae4 - remove text in buttons
- 7c263a80 - z-index of popovers
- 7df63eff - new default width
- 2bf3d903 - WIP: navbar
- d54fd6fa - Merge branch 'f-boot-tour' of gitlab.indiscale.com:caosdb/src/caosdb-webui into f-boot-tour
- 53c3e9ab - change default id; less complex
- a9b88053 - FIX: autocompletion
- 70198898 - deactivate other butthons than the current
- ddda26b5 - btn styling
- 3c1d918e - reduce spacing above buttons'
- 1815ae6f - there is not yet support for bs 5, 4 works though
- 26f80599 - another symbol for files; margin for fs symbols
- 8a0f0b53 - fix formelements row; data-bs-dismiss
- 66bd69ff - bsselect
- 4a872751 - up
- 23d143b4 - fix
- 3d459b77 - Merge branch 'dev' into f-boot-tour
- cd370615 - state badge styling
- 890b98e8 - better fsm modal styling
- ada0d04d - dark style for references
- 3a71f165 - trial
- 3489b9e4 - WIP: overall layout
- 1fb636a4 - Merge branch 'f-boot-tour' into f-reload
- 8a82b0b5 - up
- 5a846ffa - fix
- deb6485d - remove instanceOf and add id for filesystem
- 6de91a77 - inactive by default
- 77460754 - open on first visit
- 3e08cfe9 - do not use 'fade in'
- 93651e12 - fix
- e1dbb5c4 - test
- 01a3c123 - up
- 999c1f4f - fix
- 611f6c19 - fix boundaries for next/prev
- 8b35b0b8 - simultaneous init and activate
- ac9e0e13 - remove auto activation again
- 7f2a5368 - fix open on same page
- f32130af - Merge branch 'f-reload' into f-direct-popover
- cc30b251 - up
- 8176703a - WIP
- 113fd198 - Merge branch 'f-boot-tour' into local-boot-tour
- ee60bf2c - Merge branch 'f-boot-tour' into f-reload
- 74e5a2dc - Merge branch 'f-reload' into local-boot-tour
- c3119b85 - label -> badge
- 4e2fca94 - make bookmark counter visible
- 7adb756d - Merge branch 'f-reload' into f-direct-popover
- 1cd59f64 - Merge branch 'f-boot-tour' into f-direct-popover
- aac58c18 - Merge branch 'f-boot-tour' into f-reload
- 54c481dd - Style Export Modal for SELECT
- 37f51592 - Merge branch 'f-boot-tour' into f-reload
- 8915d1d3 - Merge branch 'f-reload' into f-direct-popover
- 4675d357 - WIP
- 1a07db17 - Merge branch 'f-boot-tour' into local-boot-tour
- c82fd07e - EHN: tour page close button
- de9e0036 - Merge branch 'f-boot-tour' into f-reload
- 54fb3fe4 - Merge branch 'f-reload' into local-boot-tour
- 7f9ccea5 - STY: code formatting
- 36e92505 - Merge branch 'f-reload' into 'f-boot-tour'
- c8e0dbda - Merge branch 'f-boot-tour' into f-direct-popover
- 71d36782 - up
- 9ea45e7c - up
- 66891f43 - up
- 9d324ad8 - up
- 0c10828a - up
- ee2ace7a - Merge branch 'local-boot-tour' into local-fix-annotation-module
- b0e94449 - fix paths
- ac9093c6 - WIP
- 18a290d9 - Merge branch 'local-fix-annotation-module' into f-boot-tour-styling-misc
- dbe4c296 - fix tour.css
- 549af674 - fix map opens query panel
- 00783676 - start
- 8f62309e - Merge branch 'f-boot-tour' into f-detour
- d07e401b - working
- 24f78fba - up
- a8bdb717 - Merge branch 'f-boot-tour' into f-boot-tour-styling-misc
- 668fae03 - Merge branch 'f-direct-popover' into local-fix-annotation-module
- 292762aa - Merge branch 'f-detour' into local-fix-annotation-module
- 282695de - data-detour links
- 162c3eef - F deinit
- 3a14b2ad - Merge branch 'f-deinit' into 'f-boot-tour'
- ca734e2c - fix bookmarks menu
- fd101214 - force manual
- 8106d1ab - remove x
- 642ad303 - comment
- 2031312a - automatic reset of tour
- 48a8604b - Merge branch 'f-boot-tour' of gitlab.indiscale.com:caosdb/src/caosdb-webui into f-boot-tour
- a618324b - Install bootstrap icons
- b1f62b30 - add fonts to makefile
- 0def4935 - fix Makefile for fonts
- 118871d0 - fix bottom_line
- cf0b331c - styling of detour toc
- ab605d46 - fix some tests
- 20884903 - reinit preview and ext_references after state transition
- c27eb493 - fix: tour doesn't activate itself anymore
- 6452df8c - FIX: Re-enable `do_not_show_in_toc`
- 48fd1d64 - styling 1
- 8600c2c9 - fix styling 'create property' form
- 99a05efa - update query.xsl
- eba89c77 - Merge branch 'f-boot-tour' of gitlab.indiscale.com:caosdb/src/caosdb-webui into f-boot-tour
- f2554885 - wip
- 1fa8cdfc - WIP
- 74e131e4 - WIP
- dcdb96e2 - wip
- c31db747 - style file details
- b4205942 - update tour popover position
- 6fe46b68 - fix tour load first page
- 6f71c95f - Revert "fix tour load first page"
- 28734731 - WIP: tour toc show current
- 97b07519 - ENH: Show min-width warning in tour and edit mode
- 7f9ef2ac - Merge branch 'f-min-width-warning' into 'f-boot-tour'
- 2594ca88 - ENH: Reset the cursor to text cursor in the tour.
- 0d42cf84 - Merge branch 'dev' into f-boot-tour
- f006d97c - Merge branch 'dev' into f-boot-tour
- 3dc4e543 - fix welcome page
- 55782a95 - fix welcome background
- 201663b9 - Tour Changes
- 038b7bc8 - Merge branch 'f-tour-changes' into 'f-boot-tour'
- 5a2abfd4 - MAINT: move code from edit_mode.init to edit_moe._init
- f4780918 - ENH: Merge JS files during make
- 48933d81 - Merge branch 'f-combine-js-files' into 'f-boot-tour'
- bfda77b9 - Merge branch 'dev' into f-boot-tour
- 70a1491c - Merge branch 'dev' into f-boot-tour
- 5ca8e59a - DOC: Extend changelog
- b9d3be2a - FIX: Prevent line breaks if property values are too long
- e83c0d35 - Revert "FIX: Prevent line breaks if property values are too long"
- e11ec910 - FIX: Repair entity sizing with long property values
- 6ecfe67c - Merge branch 'f-bs5-awi' into 'f-boot-tour'
- def4c3bc - DOC: Add a tutorial for the edit mode
- b6181e19 - Merge branch 'f-doc-edit-mode' into 'f-boot-tour'
- 2bf70978 - MAINT: update documentation only in main
- e890ec3e - FIX: paging was not initialized correctly
- 0754db9b - Merge branch 'f-fix-paging2' into 'f-boot-tour'
- 296319d9 - Merge remote-tracking branch 'origin/f-boot-tour' into f-fix-get-parents
Toggle commit list-
5b3b7c5c...35af6e04 - 66 commits from branch
marked this merge request as draft from 99d84516
assigned to @salexan
added 38 commits
-
296319d9...5e879294 - 37 commits from branch
dev
- 340a9ed5 - Merge branch 'dev' into f-fix-get-parents
-
296319d9...5e879294 - 37 commits from branch
added 4 commits
-
340a9ed5...aa280573 - 3 commits from branch
dev
- 41274920 - Merge branch 'dev' into f-fix-get-parents
-
340a9ed5...aa280573 - 3 commits from branch
Here is a small script to setup a test environment for testing the fix:
#!/bin/python # Setup a small environment for testing the bug behavior. # A. Schlemmer, 06/2021 import caosdb as db rt1 = db.RecordType(name="TypeA") rt2 = db.RecordType(name="TypeB") r1 = db.Record(name="Test_R_1") r1.add_parent(rt1) r2 = db.Record(name="Test_R_2") r2.add_parent(rt2) r2.add_property(rt1, value=r1) c = db.Container().extend([rt1, rt2, r1, r2]) c.insert()
Checklist of possibly affected functions in caosdb.js:
- getParents <- affected
- getEntityDescription <- unaffected
- getEntitySize <- unaffected
- getEntityChecksum <- unaffected
- getEntityPath <- unaffected
- getEntityName <- affected
- getEntityDatatype <- affected
- getEntityUnit <- unaffected
- getEntityRole <- affected
A check mark means: Either it is not affected or it was fixed.
Edited by Alexander SchlemmerHere is an expanded script, to test variants of the problem:
#!/bin/python # Setup a small environment for testing the bug behavior. # A. Schlemmer, 06/2021 import caosdb as db rt1 = db.RecordType(name="TypeA", description="11 The first type") rt2 = db.RecordType(name="TypeB", description="22 The second type") r1 = db.Record(name="Test_R_1", description="33 A record for the first type") r1.add_parent(rt1) f1 = db.File(name="Test A cool file", path="/test.txt", file="test.txt") f2 = db.File(name="Test Another cool file", path="/testfile2.txt", file="testfile2.txt") p1 = db.Property(name="TestFileProperty", datatype=db.FILE) p2 = db.Property(name="TestDoubleProperty", datatype=db.DOUBLE, unit="m") p3 = db.Property(name="TestIntegerProperty", datatype=db.INTEGER, unit="s") p4 = db.Property(name="TestReferenceProperty", datatype=rt2) r2 = db.Record(name="Test_R_2", description="44 A second record for the second type") r2.add_parent(rt2) r2.add_property(rt1, value=r1) r2.add_property(p1, value=f1) r2.add_property(p2, value=24.8) r2.add_property(p3, value=1) f2.add_property(p1, value=f1) p2.add_property(p3, value=27) p2.add_property(p4, value=r2) c = db.Container().extend([rt1, rt2, r1, r2, f1, p1, p2, p3, f2, p4]) c.insert() b = input("Press any key to cleanup.") c.delete()
@henrik @florian I checked whether other functions in
caosdb.js
are affected from similar issues. See above. I suggest creating three new issues for the remaining problems and merging this merge request, as it resolves many problems related to parents already. What do you think?I furthermore recommend a review of the functions in
caosdb.js
as I noticed some inconsistencies that should be repaired and also reflect recent changes in the webui layout and design.mentioned in issue #226
mentioned in issue #227
mentioned in issue #228
mentioned in issue #229
@timm Could you provide an example for me, how I can write a unit test for testing preview related functions?
I don't know the details by heart but the idea is the following:
- Copy an html string of an entity with an open preview (which has a parent you want to "miss") from a caosdb webui (e.g. locally started linkahead with your test data).
- Strip away any unnecessary stuff (The more you can strip away from the string the better you can read that example later on, obviously).
- Create a document in the test with
test_entity = xml2str(example_str);
, - then throw your function under test on that html document
getParents(test_entity)
and - check the results.
unassigned @salexan
@timm Yes, that sounds reasonable. But the hard part is: How to generate the preview for the generated container on-the-fly without having to use the full preview.js module including retrieval of referenced entities. Do you have a simple idea how to do that?