You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

The MimeType is a little thumbnail displayed next to the title that is usually related to the type of information contained in the article, or a logo for the page that we're addressing. If you make a search in google for example you can appreciate the Mime icon right here

In our case, we use this feature, for example, to differentiate between types of documents that we're displaying on data warehouses by using icons instead of displaying the whole category of the document in screen.

MimeField

PropertyTypeDefaultDescription
map_filestr-Path to the file that contains the mapping for this dynamic field.
altOptional[str]'default'Alt option for display in case the specified mimetype does not exist in the map.

_MimeFieldUI Class

PropertyTypeDefaultDescription
typeLiteral[DynamicFieldType.MIME_TYPE]DynamicFieldType.MIME_TYPEType of the field (Literal with value DynamicFieldType.MIME_TYPE).

Mapping

Since we have separated the front end from the backend, we made this field work with a map that maps the content of a field in the database (example Category) with it's corresponding Mime icon path in the UI. Our recommendation is to place the map at config/stages/fields/mimetype/ but you can give any path to the map_file property in the configuration.

The Map must be in json format so it can be read as a Python dictionary, here's an example of what a map should look like:

{
    "Documentary": "src/assets/Icons/documento.svg",
    "default": "src/assets/Icons/filas-de-la-tabla.svg"
}

Example Configuration

thumbnail=MimeField(field='metadata.genres[0].name', map_file='config/stages/fields/mimetype/mime_maps.json')
  • No labels