Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@laceysanderson
Copy link
Member

Tripal 4 Core Dev Task

No Linked Issue; Playing over weekend

Tripal Version: 4

Description

This PR adds two new widgets to the core property fields:

  • chado_property_string_widget_default: provides a simple textbox for a cleaner and more compact widget
  • chado_property_select_widget_default: provides a configurable select box

These were added to improve the experience of data entry for curators and to allow admin to control the entries accepted for various metadata.

Note: The select widget configuration UI specifically does not support a key => value mapping as we want to ensure the value entered for metadata matches what is displayed.

Testing?

  1. Start a fresh site on this branch or drush cr on an existing site.
  2. Create 1+ property fields on a content type of your choice. In this example we will create 2 fields on the organism content type: Category (Term: Group (NCIT:C43359)) only supports a single value; Breeding Techniques (Term: Methods (local:Methods)) which supports unlimited values.
  3. Go to Manage form display and confirm these property type fields have 3 options for widget (Long Text, Short Text, Select Drop-down) and the default is "Long Text". Do not change them yet Screenshot 2024-04-15 at 3 13 00 PM
  4. Go to the add content page to create an organism and confirm that the two property widgets match the old long text style. Screenshot 2024-04-15 at 3 07 04 PM
  5. Now go back to manage form display for organism and change one or both properties to use the short text widget. When you edit or create an organism these fields now use a textfield. They do not limit the length of text entered though! Screenshot 2024-04-15 at 3 09 41 PM
  6. Go back to manage form display for organism and change one or both properties to use the select drop-down widget. Right after selecting it you should see a configuration cog appear and the summary "There are no options yet configured."Screenshot 2024-04-15 at 3 28 54 PM
  7. Click on the cog and configure the options. Then click update and ensure the summary statement has been updated to indicate the number of options you configured. Click save at the bottom of the page. Screenshot 2024-04-15 at 3 31 22 PM
  8. Now check existing content:
  • If you edit an existing organism who had an entry typed in that matched an entry in the select list then it should be automatically chosen. Screenshot 2024-04-15 at 3 33 35 PM
  • If you edit an existing organism who had an entry NOT in the select list then - None - will be chosen and a warning will be shown to the curator. Screenshot 2024-04-15 at 4 01 14 PM
  1. Confirm that you can edit and save till your heart's content.

@laceysanderson laceysanderson self-assigned this Apr 15, 2024
@laceysanderson laceysanderson added Tripal 4 Group 1 - Tripal Content Types | Terms | Fields Any issue relating to Tripal Content including types, terms, and fields. labels Apr 15, 2024
@ruobinLiu
Copy link

I have tested the setting on a Tripal docker site. The drop downs all showed as expected after config 🎉

Copy link
Contributor

@dsenalik dsenalik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started out testing the select before I tried the others. This might trigger something, I am seeing this for my two properties (this is as I am first creating the project)
2024-04-17_bug
but it seems to be saving my selections just fine.

Otherwise this is awesome, I made a few minor code suggestions 🙈

@dsenalik
Copy link
Contributor

dsenalik commented Apr 17, 2024

One last note, if I set up the select list after data is present, and then convert to a select lacking one of the values, the warning appears as expected.
But if I go ahead and save anyway, the same warning appears a second time.
2024-04-17_message2x
I don't think it should appear the second time. By then, the data is gone anyway.

@laceysanderson
Copy link
Member Author

Thanks for the review @ruobinLiu and the suggestions @dsenalik! I just confirmed that I can still reproduce this and that the simple fix was not quite enough 🙈 I will look into this. I agree that it should not show 2X, especially after the data is already gone.

One last note, if I set up the select list after data is present, and then convert to a select lacking one of the values, the warning appears as expected. But if I go ahead and save anyway, the same warning appears a second time. I don't think it should appear the second time. By then, the data is gone anyway.

Screenshot 2024-04-18 at 9 57 03 AM

@laceysanderson
Copy link
Member Author

Thanks for all the suggestions @dsenalik, I've confirmed that it now works locally. Can you revise your review?

@laceysanderson laceysanderson merged commit 39bfccc into 4.x Apr 18, 2024
@laceysanderson laceysanderson deleted the tv4g1-0-propertyFieldWidgets branch April 18, 2024 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Group 1 - Tripal Content Types | Terms | Fields Any issue relating to Tripal Content including types, terms, and fields.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants