Skip to content

Badges on Search Cards Inaccurate #6064

@cody-seibert-gsa

Description

@cody-seibert-gsa

In datagov-catalog, the search result cards will display badges for the file types, but they all seem to fallback to HTML. Additionally, the label inside those badges is determined by the metadata, not the title. So in the scenario a user uploads a file with the name my-file.xlsx but they change the format to be something custom, such as

How to reproduce

Navigate to dev and look at this dataset https://catalog-dev.data.gov/dataset/fy21-federal-real-property-profile?from_hint=eyJxIjoiZnkyMSIsInNvcnQiOiJyZWxldmFuY2UifQ%3D%3D see the two records, FILE and the long xlm record, the look at the UI and notice it says HTML and XML. These are technically both wrong, but we also don't want to support infinite amount of badges and colors.

Expected behavior

Not sure, we need to determine what exactly we should be showing in the badge, should it show XML or XLSX? Should we determine it based on the filename or the metadata or do some type of tiered approach to determine the badge text.

From @FuhuXia :

I assume the final result is

  • no discrepancy such as XML label on the dataset card but xlsx in the dataset page. It is total coinsidence I found one example on the dev.
  • color code the format label. and to do that, we need no more than 20 possible labels.

Additional Context:

The APPLICATION/VND.OPENXMLFORMATS-OFFICEDOCUMENT.SPREADSHEETML.SHEET is probably computed somehow during upload (maybe from CKAN?). Understanding that logic might be useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSoftware defect or bugcomponent/catalogRelated to catalog component playbooks/roles

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions