clevercanary / data-browser

Apache License 2.0
2 stars 0 forks source link

Entity specific filter config - part 1 #160

Open NoopDog opened 2 years ago

NoopDog commented 2 years ago

Need

Each configurable entity is filterable by one or more of its fields. The filter can be implemented on either the client or server. We need configuration to specify the set of filterable fields, the name of each filter, and if the entity will be filtered on the client or server.

Approach

We can modify the entity list configuration to specify a filter configuration.

The filter configuration will contain:

  1. An indicator for filterType e.g CLIENT or SERVER.
  2. A list of filters.

The filter list contains:

  1. The column key for the filter (name of the column as specified in the column config).
  2. The type of filter. This is an enum value that currently only has "INCLUDES_SOME" (other values will come). For example:
/**
 * Possible types of category filters, matches React Table's filter types.
 */
export enum CATEGORY_FILTER_TYPE {
  "INCLUDES_SOME" = "includesSome",
}

When drawing an entity list, iterate over the filter configs and use them to display the list of filters.

Definition of Done (Why this is called "Part 1")

  1. Filters don't work.
  2. Filters are not styled.
  3. Filters component is not styled and is, for now, just stacked on top of the list (instead of on the left side as in the mocks).
  4. For the title of the filer, we can use the configured column name from the linked column.
  5. For HCA, configure a filter config for the project entity using the project title, species, anatomical entity.
  6. If there are no filters config or an empty filter config is specified, no filters are listed.
NoopDog commented 2 years ago

@MillenniumFalconMechanic can you refine this and make sure this is up to par and buildable? Thanks! D