28 Jun 2022
09:28 AM
- last edited on
29 Jun 2022
03:16 PM
by
MaciejNeumann
Use case: Enabling filtering and filter bars to entity lists of screens created from an Extension 2.0 YAML.
Example context: I have an entity type "my:interface" that has a RUNS_ON relationship to an entity type "my:device". I have an Entities List card which already lists all "my:interface" entities I want to filter.
All definitions are given based on schema version 1.239 and may or may not change in the future.
Example 1: I want to filter my list by the interface names.
YAML definition:
filtering:
entityFilters:
- displayName: Interface
filters:
- type: entityName
displayName: Name
freeText: true
modifier: contains
defaultSearch: true
distinct: false
entityTypes:
- my:interface
YAML explanation:
Example 2: Given example 1, I also want to filter by the device these interfaces are running on
YAML definition:
filtering:
relationships:
- type(my:device),toRelationships.runsOn($(entityConditions))
entityFilters:
- displayName: Interface
filters:
- type: entityName
displayName: Name
freeText: true
modifier: contains
defaultSearch: true
distinct: false
entityTypes:
- my:interface
- displayName: Related entity
filters:
- type: entityName
displayName: Device name
freeText: false
defaultSearch: false
distinct: true
entityTypes:
- my:device
YAML Explanation:
Most of the definition is the same as above. Changes include:
16 May 2023
09:51 AM
- last edited on
16 May 2023
09:52 AM
by
AgataWlodarczyk
Thanks @Radu for the infos, especially about ommiting the freeText field for equals modifiers is valueable, since I couldn't figure out the reason for the error message
dtcli.utils.ExtensionValidationError: {"error":{"code":400,"message":"Validation errors for asset node:host:\nGiven property 'modifier' with value: 'equals' should not be set as its precondition is not satisfied\n","constraintViolations":[]}}
However with Schema version 1.263 I now receive following error, indicating that freeText is mandory:
dtcli.utils.ExtensionValidationError: {"error":{"code":400,"message":"Extension validation error","constraintViolations":[{"path":"$.screens[1].entitiesListCards[0].filtering.entityFilters[0].filters[4]","message":"$.screens[1].entitiesListCards[0].filtering.entityFilters[0].filters[4].freeText: is missing but it is required","parameterLocation":"PAYLOAD_BODY","location":null}]}
So it seems that this is a chicken/egg problem do you have an idea how to solve this?
Something I also recognized is that the contains modifier is only suitable for entity names, other attributes can not make use of it.
I believe freeText must always be present with either true or false value. It cannot be omitted. With relation to modifiers, this still is the case - if freeText = false, then you should not specify modifier.
As for the attributes, it is only the special - entityName, ipAddress (a.k.a. dt.ip_addresses), listenPort (a.k.a. dt.listen_ports), and dnsName (dt.dns_names) - that support suggestions in the UI.
Another remark, it would be great to have the possibility to filter by health state, so that you can focus on not healthy entities.
Do you know if it is possible to not only use attributes, but also tags for filtering?
Only attributes are supported currently. Any other suggestions you can post as product ideas on the dedicated forum.