Skip to content

Conversation

Ahalya-ni
Copy link
Collaborator

@Ahalya-ni Ahalya-ni commented Oct 10, 2025

Pull Request

🤨 Rationale

User Story 3283281: FE | Handle filter transformation in Query builder
Task 3249469: Add source filter support to alarms query builder

This PR adds support for source filtering in the alarms query builder component.

👩‍💻 Implementation

  • Added a source constant to AlarmsQueryBuilderFields, including its data field, label, and supported filtering operators.
  • To support filtering, since source must be accessed within the properties object, any filter using source is transformed to the format: properties.system <operator> <value> || properties.minionId <operator> <value>.
  • Created a file called SourceProperties.constant to store the custom properties for reusability.
  • Exported the method from utils.ts previously named getLogicalOperator to be used for combining system and minionId expressions.
  • Moved getLogicalOperator below multipleValuesQuery since it is now a public method; this file is organized with public methods at the top and private methods below.
  • Renamed getLogicalOperator to getFilterConcatOperator to better reflect its purpose, as it is used for combining multi-value expressions (e.g., {value1, value2}) as well as conditions like those used for source (system and minionId expressions).
  • Updated the getFilterConcatOperator to return logical OR for isnotblank operator as its transformation logic is already in place.
image

Another approach

Another approach I considered was introducing separate query builder operators to handle source-related transformations directly within the expression builder callback of the query builder. This alternative did work, but it has a drawback: the resulting source expressions (such as (properties.system = "test-source" || properties.minionId = "test-source")) are not parsed by the query builder, which leads to an empty expression in the reader callback. For more details, refer to the prototype and the relevant branch.

🧪 Testing

Added unit tests

✅ Checklist

@Ahalya-ni Ahalya-ni changed the base branch from main to users/ahalya/refactor/ahalya/move-reusable-to-utils October 10, 2025 10:49
@Ahalya-ni Ahalya-ni force-pushed the users/ahalya/feat/alarms/source-filter-final-2.0 branch from 8a0c1e1 to 0825cd9 Compare October 10, 2025 12:36
@Ahalya-ni Ahalya-ni requested a review from manisha-ni October 10, 2025 12:49
@Ahalya-ni Ahalya-ni force-pushed the users/ahalya/feat/alarms/source-filter-final-2.0 branch from b285e8d to 6781f63 Compare October 13, 2025 06:45
@Ahalya-ni Ahalya-ni force-pushed the users/ahalya/feat/alarms/source-filter-final-2.0 branch from 6781f63 to 471fba2 Compare October 14, 2025 06:24
@Ahalya-ni Ahalya-ni requested a review from manisha-ni October 14, 2025 06:27
@Ahalya-ni Ahalya-ni marked this pull request as ready for review October 14, 2025 10:18
@Ahalya-ni Ahalya-ni marked this pull request as draft October 14, 2025 11:36
@Ahalya-ni Ahalya-ni force-pushed the users/ahalya/feat/alarms/source-filter-final-2.0 branch from 9420e47 to 78647b7 Compare October 14, 2025 11:43
@Ahalya-ni Ahalya-ni force-pushed the users/ahalya/feat/alarms/source-filter-final-2.0 branch from 78647b7 to 4965de4 Compare October 14, 2025 13:31
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
Signed-off-by: Ahalya Radhakrishnan <[email protected]>
@Ahalya-ni Ahalya-ni force-pushed the users/ahalya/feat/alarms/source-filter-final-2.0 branch from 4965de4 to 6630743 Compare October 14, 2025 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants