Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

editor : multiple provision activity lost when editing a document #1003

Closed
zannkukai opened this issue May 22, 2020 · 2 comments · Fixed by rero/ng-core#207 or rero/ng-core#231
Closed
Assignees
Labels
bug (critical) Blocking issue, should be fixed ASAP f: editor Concerns editor based on JSON schema AND custom editor
Milestone

Comments

@zannkukai
Copy link
Contributor

zannkukai commented May 22, 2020

Describe the issue
When editing a document with multiple provision activity, only the last one will be appears into the editor; this cause a metadata lost.

To Reproduce
Steps to reproduce the behavior:

  1. Log as librarian
  2. Import or create a document with multiple provision activity (ex : import EAN 9782298133103)
  3. Correct editor (removing "place" part of provisionActivity[@type=Manufacture])
  4. Save it
  5. The created document should have 3 provisions activities : two "bf:Publication" parts and one "bf:Manufacture" part
  6. Edit this document : both "bf:Publication" parts are disappear.

Expected behavior
All existing provisionActivity parts should be displayed.

Software version
Tell us which version you're using:

  • rero-ils : fe0a8c3
  • rero-ils-ui : e3248a9
@iGormilhit iGormilhit added bug f: editor Concerns editor based on JSON schema AND custom editor labels May 25, 2020
@AoNoOokami
Copy link
Contributor

I saw the same with subjects while working on the UX of editor.

@iGormilhit iGormilhit added the bug (critical) Blocking issue, should be fixed ASAP label Jun 10, 2020
@iGormilhit iGormilhit added this to the v0.10.0 milestone Jun 10, 2020
@iGormilhit iGormilhit modified the milestones: v0.10.0, v0.11.0 Jun 16, 2020
@zannkukai
Copy link
Contributor Author

zannkukai commented Jun 29, 2020

Note to solve (to myself or anybody):

The problem seems to be present into the array_type.component.ts. When a "hidden" change is detected on a field, then all children of this field will be removed (except the lastOne if minItems=1 into JSON Schema).
https://github.com/rero/ng-core/blob/dev/projects/rero/ng-core/src/lib/record/editor/array-type/array-type.component.ts#L58
The question is now : "Why an 'hide' event is send for these elements"

30/6 -- 8:13
My feeling is that could be a javascript "sync/async" problem. First time, we build a form for a document with multiples subjects or provision activities, the array is empty. So the onPopulatehook is fired (https://github.com/rero/ng-core/blob/dev/projects/rero/ng-core/src/lib/record/editor/editor.component.ts#L283). As the array is empty, https://github.com/rero/ng-core/blob/dev/projects/rero/ng-core/src/lib/record/editor/array-type/array-type.component.ts#L42 is called. This function removes array elements until minItems limit was reached.
But before this code is execute, the form was filled/setted with document values. So I suspect that the remove function was execute after the form is filled and the result is that only the last array element is kept (because we define a minIems=1 limit in the JSON schema)

jma added a commit to jma/ng-core that referenced this issue Jul 14, 2020
* Closes rero/rero-ils#1003.
* Cleans the initialization sequence for the editor.

Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
sebdeleze pushed a commit to rero/ng-core that referenced this issue Jul 21, 2020
* Closes rero/rero-ils#1003.
* Cleans the initialization sequence for the editor.

Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
jma added a commit to jma/ng-core that referenced this issue Jul 22, 2020
* Closes rero/rero-ils#1003.
* Cleans the initialization sequence for the editor.

Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
jma added a commit to jma/ng-core that referenced this issue Jul 28, 2020
* Closes rero/rero-ils#1003.
* Cleans the initialization sequence for the editor.

Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
jma added a commit to jma/ng-core that referenced this issue Jul 30, 2020
* Uses ngx formly 5.9.
* Makes the autocomplete component asynchronous to allows hot language
switch.
* Tuncates long labels in the add field components.
* Fixes autocomplete translations.
* Fixes field dropdown menu translations.
* Removes useless function and code.
* Fixes cssClass for multischema object.
* Moves the indentation value into the css instead of using bootstrap
classes.
* Fixes scroll and focus action when a new field is added or when a link
in the navigation is clicked.
* Stores the untranslated label in the formly field.
* Removes extra border for multischema element.
* Uses bootstrap variables to define the editor card.
* Adds a global editor class.
* Makes the editor component style global.
* Closes rero/rero-ils#1003.
* Cleans the initialization sequence for the editor.
* Fixes the export urls by adding the search query parameter to filter
  the exported results.
* Disables export buttons when the list of result is empty.
* Updates translations catalogs.
* Adds missing translations in editor component.
* Adds ordered properties for JSONSchema definitions.
* Fixes ordered properties for JSONSchema oneOf, anyOf.
* Sets horizontal labels only for the long mode editor.
* Adds a new output to notify the parent component that the model and
  the JSONSchema is loaded. This allows to avoid concurrency problem.
* Adds a weblate badge to the README file.

Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
jma added a commit to rero/ng-core that referenced this issue Jul 30, 2020
* Uses ngx formly 5.9.
* Makes the autocomplete component asynchronous to allows hot language
switch.
* Tuncates long labels in the add field components.
* Fixes autocomplete translations.
* Fixes field dropdown menu translations.
* Removes useless function and code.
* Fixes cssClass for multischema object.
* Moves the indentation value into the css instead of using bootstrap
classes.
* Fixes scroll and focus action when a new field is added or when a link
in the navigation is clicked.
* Stores the untranslated label in the formly field.
* Removes extra border for multischema element.
* Uses bootstrap variables to define the editor card.
* Adds a global editor class.
* Makes the editor component style global.
* Closes rero/rero-ils#1003.
* Cleans the initialization sequence for the editor.
* Fixes the export urls by adding the search query parameter to filter
  the exported results.
* Disables export buttons when the list of result is empty.
* Updates translations catalogs.
* Adds missing translations in editor component.
* Adds ordered properties for JSONSchema definitions.
* Fixes ordered properties for JSONSchema oneOf, anyOf.
* Sets horizontal labels only for the long mode editor.
* Adds a new output to notify the parent component that the model and
  the JSONSchema is loaded. This allows to avoid concurrency problem.
* Adds a weblate badge to the README file.

Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug (critical) Blocking issue, should be fixed ASAP f: editor Concerns editor based on JSON schema AND custom editor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants