diff --git a/frontend/cypress/integration/visualization/filter.e2e.js b/frontend/cypress/integration/visualization/filter.e2e.js index 59905f9d..e5f45e31 100644 --- a/frontend/cypress/integration/visualization/filter.e2e.js +++ b/frontend/cypress/integration/visualization/filter.e2e.js @@ -129,7 +129,7 @@ context('Filter', () => { cy.get('.FilterSelect').first().click(); // Assert - cy.contains('Error: No string').click(); + cy.contains('[Trinity]').click(); }); it('applies filter', () => { @@ -141,7 +141,7 @@ context('Filter', () => { cy.get('.FilterSelect').first().click(); // Assert - cy.contains('Error: No string').click(); + cy.contains('[Trinity]').click(); cy.get('body').click(0, 0); cy.get('.ApplyFilter').click(); @@ -156,7 +156,7 @@ context('Filter', () => { cy.get('.FilterSelect').first().click(); // Assert - cy.contains('Error: No string').click(); + cy.contains('[Trinity]').click(); cy.get('body').click(0, 0); cy.get('.ApplyFilter').click(); diff --git a/frontend/src/visualization/filtering/FilterLineProperty.tsx b/frontend/src/visualization/filtering/FilterLineProperty.tsx index 9bf4f983..0052ff0a 100644 --- a/frontend/src/visualization/filtering/FilterLineProperty.tsx +++ b/frontend/src/visualization/filtering/FilterLineProperty.tsx @@ -74,6 +74,27 @@ const FilterLineProperty = (props: { setSelectedValues(event.target.value as string[]); }; + /** + * Returns the property as string or returns an error string. + * Does return the 'real' value if the property is of type string, boolean, + * number or array. + * @param property value + */ + const asString = (property: unknown): string => { + if (Array.isArray(property)) { + return `[${property.map(asString).join(', ')}]`; + } + + switch (typeof property) { + case 'string': + case 'boolean': + case 'number': + return `${property}`; + default: + return 'Error: No string'; + } + }; + return (