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

Add itemProperties, itemPropertiesByType and itemPropertiesByIds #6218

Merged
merged 19 commits into from
Apr 5, 2022
Merged

Conversation

nf-s
Copy link
Contributor

@nf-s nf-s commented Mar 29, 2022

Add itemProperties, itemPropertiesByType and itemPropertiesByIds

Fixes #1052 #5631 #5155 #1408 TerriaJS/nationalmap#1129

  • Add itemProperties, itemPropertiesByType and itemPropertiesByIds to GroupTraits and ReferenceTraits.
    • Properties set override strata
    • Item properties will be set in the following order (highest to lowest priority) itemPropertiesByIds, itemPropertiesByType, itemProperties.
    • If a parent group has itemProperties, itemPropertiesByType or itemPropertiesByIds - then child groups will have these values copied to underride when the parent group is loaded
    • Similarly with references.
  • All dynamic groups (eg WebMapServiceCatalogGroup) will create members and set definition strata (instead of underride)

New docs

These are a bit rough

Background

For the SIP dataset styling issue (in NationalMap) - I’ve been looking into fleshing out itemProperties so I can attach custom styling to each dataset.
The SIP datasets are harvested from CKAN (data.gov.au) - so we can’t use itemProperties in its current form.

Test me

A bunch of CSVs loaded from CKAN - with overridden styles

http://ci.terria.io/item-props/#clean&https://gist.githubusercontent.com/nf-s/67a545b72eef135a9d4903e2a65b9d9b/raw/02fcfcabfc37ad6eedb2908aa0c52ee39bcf6c0c/item-props-by-id.json&share=s-aAu23kmvBQxDNGwoVU3zQxjiGry

Example

https://gist.githubusercontent.com/nf-s/67a545b72eef135a9d4903e2a65b9d9b/raw/02fcfcabfc37ad6eedb2908aa0c52ee39bcf6c0c/item-props-by-id.json

"catalog": [
    {
      "type": "ckan-group",
      "name": "Data.gov.au",
      "url": "https://data.gov.au",
      "itemPropertiesByIds": [
        {
          "ids": ["6TbYz2Jj/01809262-b20a-4fa2-96d2-73114722f364/aa8d7eea-9eed-42e5-a322-1abee690c49a"],
          "itemProperties": {
            "activeStyle": "",
            "defaultStyle": {
              "color": {
                "nullColor": "#F2F3F4"
              }
            }
          }
        }

Checklist

  • There are unit tests to verify my changes are correct or unit tests aren't applicable (if so, write quick reason why unit tests don't exist)
  • I've updated relevant documentation in doc/.
  • I've updated CHANGES.md with what I changed.
  • I've provided instructions in the PR description on how to test this PR.

@nf-s nf-s marked this pull request as draft March 29, 2022 10:23
@tephenavies tephenavies self-assigned this Mar 30, 2022
@nf-s nf-s marked this pull request as ready for review March 31, 2022 11:24
@nf-s nf-s changed the title Add itemProperties, itemPropertiesByType and itemPropertiesById Add itemProperties, itemPropertiesByType and itemPropertiesByIds Apr 4, 2022
Copy link
Member

@tephenavies tephenavies left a comment

Choose a reason for hiding this comment

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

This is really good! I've wanted something like this for a while.

@AnaBelgun AnaBelgun mentioned this pull request Apr 5, 2022
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

itemProperties is not applied to groups inside a CkanCatalogGroup
3 participants