visual-framework / vf-wp

WordPress theme and plugins for Visual Framework integration
3 stars 6 forks source link

Enhancements to data-resources block in WP #1337

Open sandykadam opened 4 months ago

sandykadam commented 4 months ago

Hi @kasprzyk-sz

We need to make following modifications to data-resources block to make it flexible for editors.

Option to

@kasprzyk-sz please also add documentation & steps on https://stable.visual-framework.dev/wordpress/blocks/

@mshujamalik-ebi please note this and accordingly make necessary changes to CH API and provide examples to Szymon so he will implement the changes accordingly.

FYI @Adedoyinebi

kasprzyk-sz commented 2 months ago

Hi @mshujamalik-ebi, could you please provide the relevant CH queries for this one?

mshujamalik-ebi commented 2 months ago

Hello @kasprzyk-sz ,

Please find the apis below : search by display title : https://www.embl.org/api/v1/pattern.html?source=contenthub&filter-content-type=data_resource&pattern=vf-summary-image&filter-field-contains%5Btitle%5D=EBI search by team : https://www.embl.org/api/v1/pattern.html?source=contenthub&filter-content-type=data_resource&pattern=vf-summary-image&filter-field-contains%5Bfield_resource_primary_team.entity.title%5D=ITS search by keywords : https://www.embl.org/api/v1/pattern.html?source=contenthub&filter-content-type=data_resource&pattern=vf-summary-image&filter-field-contains%5Bfield_resource_keywords%5D=a option to use long description or short description (default is short description) : https://www.embl.org/api/v1/pattern.html?source=contenthub&filter-content-type=data_resource&pattern=vf-summary-image&filter-field-contains%5Bfield_short_description%5D=GWAS https://www.embl.org/api/v1/pattern.html?source=contenthub&filter-content-type=data_resource&pattern=vf-summary-image&filter-field-contains%5Bfield_long_description%5D=GWAS

Thanks, Shuja

kasprzyk-sz commented 2 months ago

Hi @mshujamalik-ebi, thanks for the examples!

Search by keywords doesn't seem to work. For example:

https://www.embl.org/api/v1/pattern.html?source=contenthub&filter-content-type=data_resource&pattern=vf-summary-image&filter-field-contains%5Bfield_resource_keywords%5D=search

Also can't see any difference between long and short description:

https://www.embl.org/api/v1/pattern.html?source=contenthub&filter-content-type=data_resource&pattern=vf-summary-image&filter-field-contains%5Bfield_long_description%5D=search

https://www.embl.org/api/v1/pattern.html?source=contenthub&filter-content-type=data_resource&pattern=vf-summary-image&filter-field-contains%5Bfield_short_description%5D=search

The above output diffferent results but the description doesn't seem to be affected. Or is it supposed to work like this?

kasprzyk-sz commented 2 months ago

also it seems that sorting sort-field-value[changed]=DESC doesn't work as well

https://www.embl.org/api/v1/pattern.html?source=contenthub&filter-content-type=data_resource&pattern=vf-summary-image&sort-field-value[changed]=DESC

sandykadam commented 2 months ago

@mshujamalik-ebi @kasprzyk-sz I guess there is confusion with the long/short description requirement - We don't need any search option for description, the requirement is to show or hide long/short descriptions in the block or which description to use for display they can use long or they can use short description for display. E.g below screenshot - by default currently it takes long description, so we need to give option in block to choose.

Screenshot 2024-09-03 at 12 32 42
kasprzyk-sz commented 2 months ago

Thanks for clarifying @sandykadam . Shouldn't the query be then something like filter-field-contains[field_description]=short/long?

sandykadam commented 2 months ago

You can hide the field by hide flag, @mshujamalik-ebi give him example of show/hide field for description. @kasprzyk-sz similar to how we do for profile block where we can show hide position/phone etc

mshujamalik-ebi commented 2 months ago

@kasprzyk-sz To hide the description we have this : https://www.embl.org/api/v1/pattern.html?hide[body]&source=contenthub&filter-content-type=data_resource&pattern=vf-summary-image&filter-field-contains%5Bfield_long_description%5D=GWAS

Thanks Shuja

kasprzyk-sz commented 2 months ago

Thanks!

@mshujamalik-ebi could you look into keyword search and sorting?

@sandykadam should it be possible to combine the parameters like search by title AND team or search by title OR team?

mshujamalik-ebi commented 2 months ago

@kasprzyk-sz The sorting is done on changed DESC by default,if you try ASC then it changes the result. https://www.embl.org/api/v1/pattern.html?source=contenthub&filter-content-type=data_resource&pattern=vf-summary-image&sort-field-value[changed]=ASC For keywords,there is a field for keywords and it seems empty for all contents. Also the description field is the default result displays long description ,for short description the url is below. https://dev.content.embl.org/api/v1/pattern.html?hide[body]&source=contenthub&filter-content-type=data_resource&pattern=vf-summary-image Currently present on dev only,need to move on prod.

kasprzyk-sz commented 2 months ago

Many thanks @mshujamalik-ebi!

For the sorting, is it supposed to be sorted alphabetically based on the title? In this example, the results seem to be still a bit random: https://www.embl.org/api/v1/pattern.html?source=contenthub&filter-content-type=data_resource&pattern=vf-summary-image&sort-field-value[changed]=ASC

@sandykadam does it make sense to keep the keyword search then?

sandykadam commented 2 months ago

Thanks!

@mshujamalik-ebi could you look into keyword search and sorting?

@sandykadam should it be possible to combine the parameters like search by title AND team or search by title OR team?

search by title, keyword should be OR like dropdown and team should be separate

@kasprzyk-sz also use "EMBL Teams" taxonomy to populate teams dropdown, so user can select team from dropdown and you can pass the team ID to API, @mshujamalik-ebi will give you example on how to use BDR ID to be used in pattern html of data-resources

Below is screenshot of ID which we already storing in "EMBL Teams" taxonomy.

Screenshot 2024-09-04 at 15 29 13
mshujamalik-ebi commented 2 months ago

@kasprzyk-sz Please find the apis: For sorting title in ascending : https://www.embl.org/api/v1/pattern.html?source=contenthub&filter-content-type=data_resource&pattern=vf-summary-image&sort-field-value[title]=ASC

For teams content : https://www.embl.org/api/v1/pattern.html?source=contenthub&filter-content-type=data_resource&pattern=vf-summary-image&filter-field-contains[field_resource_primary_team.entity.field_foreignid]=518 For filtering content with team : https://www.embl.org/api/v1/pattern.html?source=contenthub&filter-content-type=data_resource&pattern=vf-summary-image&filter-field-contains[field_resource_primary_team.entity.field_foreignid]=518&filter-field-contains[title]=simple

Thanks, Shuja