PASTA-ELN / pasta-eln

PASTA-ELN with new frontend
https://pasta-eln.github.io/pasta-eln/
Other
8 stars 2 forks source link

Double-clicking on the "list" metadata field in Data Hierarchy #306

Closed HTsybenko closed 1 month ago

HTsybenko commented 3 months ago
  1. Open Data Hierarchy editor

  2. In the metadata table double click on any empty "list" field. (For example, in Projects Data Type, double click on the list for the "objective")

  3. Do not add any to the field, just save the hierarchy and wait until PASTA restarts.

  4. Add or open for editing any item of the changed Data Type. (for example, edit PASTAs Example Project)

The edited metadata field will show "-no link-" list, while the following error occurs simultaneously:

ERROR dgv01: Database / Network problem for path | viewDocType/ Traceback (most recent call last): File "/home/htsybenko/Temp/envir/lib/python3.10/site-packages/pasta_eln/database.py", line 559, in getView res = list(v.result) File "/home/htsybenko/Temp/envir/lib/python3.10/site-packages/cloudant/result.py", line 361, in iter response = self._call({k: v File "/home/htsybenko/Temp/envir/lib/python3.10/site-packages/cloudant/view.py", line 236, in call resp = get_docs(self._r_session, File "/home/htsybenko/Temp/envir/lib/python3.10/site-packages/cloudant/_common_util.py", line 268, in get_docs resp.raise_for_status() File "/home/htsybenko/Temp/envir/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 405 Client Error: Method Not Allowed method_not_allowed Only GET,POST,HEAD allowed for url: http://127.0.0.1:5984/research/_design/viewDocType/_view/?limit=101

Expected behavior If the list metadata field is not filled in the Data Hierarchy editor, the corresponding field in the form should act as a regular one, allowing unstructured text entries.

HTsybenko commented 2 months ago

In pasta_eln-2.6.0, the issue is fixed partially. Here is an example for recreating the remaining issue:

  1. Open Data Hierarchy editor

  2. In the metadata table double click on an empty "list" field of "Objective" in Projects.

  3. Do not add anything to the field, save the hierarchy and wait until PASTA restarts.

  4. Add a new project to open editor window.

The "Objective" metadata field will be displayed as list to select from. It cannot be edited, because no items were added to the list in the Data Hierarchy editor. Screenshot from 2024-07-15 09-23-43

Expected behavior: If a user interacts with a "list" field in metadata table of the Data Hierarchy editor, but the field is empty upon saving, the corresponding field in the form should act as a regular one, allowing unstructured text entries.

jmurugan-fzj commented 2 months ago

@HTsybenko Sorry, I haven't addressed the way how the UI form interprets the list items, could you detail the behavior in case of different scenarios? How do you enter the values in case of single or multiple list items- comma separated list? Do you expect the multiple list items to repopulated in a combo-box upon save? So when you already have a multiple list combo-box, don't you need any edit options in the form? I don't think enabling an editable text field in case of empty list is a consistent solution for the UI! I would keep the possibility of edits in one place, that's presently the data hierarchy tool and this will make the work flow consistent!

@SteffenBrinckmann What is your opinion on this artifact's expected behavior? Could you please see this part, since you are familiar with the UI forms which display various fields from data hierarchy?

HTsybenko commented 2 months ago

@jmurugan-fzj Based on my previous experiences, I expect the following behavior:

1) If there are no items in the "list" in the Data Hierarchy editor, the field should act as an editable text field. This is how it currently functions.

2) If a user adds items to the "list" in the Data Hierarchy editor, the field should act as a drop-down list. This is how it currently functions. A potential improvement is to add an empty item (same as -no link- item) to it.

3) If a user removes existing items in the "list" of the Data Hierarchy editor, the field should act as an editable text field again. Currently, this has not been implemented and, therefore, is posted as an issue here.

If there are other opinions on this, we can discuss them.

SteffenBrinckmann commented 2 months ago

@HTsybenko @jmurugan-fzj The data hierarchy editor is producing an invalid structure after the user did something 'strange'. Generally, that invalid structure creation should not happen. However-1: we are working on the next version of the data hierarchy editor: that big change should happen first before smaller changes are addressed: removing empty entries (list, unit, ...). Hence, lets focus an that next version. However-2: the sqlite version - to be released later - will not suffer that issue, is immune to to empty data hierarchy entries. -> Let's focus on the big changes and then we can address the small.

jmurugan-fzj commented 2 months ago

@SteffenBrinckmann What do you mean by invalid structure? Since this is a list field, data hierarchy tool is creating an empty list in this case when the user did not enter any value. This empty list is populated in UI as an empty combo-box!! Isn't this the expected way of doing or do you expect a different behavior from the tool?

The main point is that: now @HTsybenko wants the editing functionality of the data hierarchy editor tool in PASTA GUI also, in my opinion this is kind of mixing the responsibilities of different components. My understanding was that the data hierarchy tool was solely implemented for editing the data hierarchy structure and the UI simply consumes it!

HTsybenko commented 2 months ago

@jmurugan-fzj Just a side comment to omit confusion:

@SteffenBrinckmann What do you mean by invalid structure? Since this is a list field, data hierarchy tool is creating an empty list in this case when the user did not enter any value. This empty list is populated in UI as an empty combo-box!! Isn't this the expected way of doing or do you expect a different behavior from the tool?

The empty list does not translate into the combo-box in the UI that can be populated. I cannot enter a new value into the field, as I can with "tags", for instance.

The main point is that: now @HTsybenko wants the editing functionality of the data hierarchy editor tool in PASTA GUI also, in my opinion this is kind of mixing the responsibilities of different components. My understanding was that the data hierarchy tool was solely implemented for editing the data hierarchy structure and the UI simply consumes it!

Editing the "list" in the Data hierarchy editor already affects the field functionality in the GUI, transforming the editable text field into a drop-down (or a combo-box; I could not confirm this yet). My suggestion was to make these changes reversible.

jmurugan-fzj commented 2 months ago

@jmurugan-fzj Just a side comment to omit confusion:

@SteffenBrinckmann What do you mean by invalid structure? Since this is a list field, data hierarchy tool is creating an empty list in this case when the user did not enter any value. This empty list is populated in UI as an empty combo-box!! Isn't this the expected way of doing or do you expect a different behavior from the tool?

The empty list does not translate into the combo-box in the UI that can be populated. I cannot enter a new value into the field, as I can with "tags", for instance.

If you want to populate the UI with the needed values, why don't you enter the values in data hierarchy tool and select the appropriate value from the populated combo list? Isn't this the right way, how you have to do it? Like the case for the "status" field? Why do you keep the list empty and want to enter the values from UI? :) image image

By the way, I quickly checked the "tags" field and it does not populate the list using the values which I have set (test1, test). It displays completely different list (Important, WAIT, TODO, v1..) Is this a bug or my concept understanding is fully wrong? image image

The main point is that: now @HTsybenko wants the editing functionality of the data hierarchy editor tool in PASTA GUI also, in my opinion this is kind of mixing the responsibilities of different components. My understanding was that the data hierarchy tool was solely implemented for editing the data hierarchy structure and the UI simply consumes it!

Editing the "list" in the Data hierarchy editor already affects the field functionality in the GUI, transforming the editable text field into a drop-down (or a combo-box; I could not confirm this yet). My suggestion was to make these changes reversible.

Not sure if I understood this correctly, shouldn't it affect the UI? That's the idea right, as in the case of "status" field? If you want to revert, go to data hierarchy tool and revert the changes there?

jmurugan-fzj commented 2 months ago

@HTsybenko I quickly checked if this empty list can be fully removed via a data hierarchy tool, but as per the implementation the data model is responsible for populating the fields and respective values upon the mouse click and date-entered events. Hence it's a valid scenario that the user can simply click the text field in the table and not enter anything. For such cases, values can be set accordingly but cannot remove the field fully within these table row click events. So I had modified the UI to handle the empty list scenario accordingly in the newly created PR: #326

@SteffenBrinckmann Please see the PR and let me know if this fix is fine and can be taken as a general solution?

SteffenBrinckmann commented 2 months ago

@jmurugan-fzj as I stated, things (including the form) change massively when SQLite is used. Why do we fix minor things, if very big things need to be implemented first?

jmurugan-fzj commented 2 months ago

@SteffenBrinckmann @HTsybenko Okay fine for me, we can postpone these changes also until then too! I can move the PR to draft state, and Hanna can suspend this issue or keep this in blocked state until then!