workfloworchestrator / orchestrator-ui-library

Component library for the orchestrator-ui (v2) which is published in npm
8 stars 4 forks source link

Parse search string to BE call and update using filter modals #478

Closed wouter1975 closed 9 months ago

wouter1975 commented 11 months ago

This ticket describes the generic behaviour needed to filter tables in a flexible way. Only 1 way sync is required, namely only from filter modal to search bar. In other words, the filter modal has no knowlegde of what is already being filtered for the selected column.

Implement query for tables:


Propose to address this ticket in two separate PRs:


The search string should comply with the specification as described in: https://github.com/workfloworchestrator/orchestrator-core/pull/412

Use cases:

Good to know

see comment from Daniel below

The following table describes the behavior on a subscription detail page:

Consecutive actions Resulting in search string
new search ""
filter column Description on KLM description:KLM
filter column Tag on LP description:KLM tag:LP
filter column Tag on LR description:KLM tag:(LP|LR)
filter column Description on DESIGN ACA description:(KLM|"DESIGN ACA") tag:(LP|LR)
add search term 1000 in search bar description:(KLM|"DESIGN ACA") tag:(LP|LR) 1000
~changes in searchtext to OR~ ~description:(KLM|"DESIGN ACA")|tag:(LP|LR) 1000~
add search term Asd001B in search bar description:(KLM|"DESIGN ACA") tag:(LP|LR) 1000 Asd001B
filter column Status on active description:(KLM|"DESIGN ACA") tag:(LP|LR) 1000 Asd001B status:active
filter column Description on AMPATH description:(KLM|"DESIGN ACA"|AMPATH) tag:(LP|LR) 1000 Asd001B status:active
new search ""
complex manual search string description:KLM tag:LP description:DESIGN tag:IP)
filter on AMPATH in description using filter modal description:(KLM|AMPATH) tag:LP description:DESIGN
new search ""
filter on exact match string description:"10 Gbit/s"
filter on prefix-search in search bar description:"10 Gbit/s" cd36*
filter on prefix-search test* (not yet supported in filter modal) description:"10 Gbit/s" cd36 customer:test
exclude tag = LP in search bar with negate description:"10 Gbit/s" cd36 customer:test -tag:LP

Possible function implementation

Use elastic search component if possible.

  1. user filters on column_id X with value Y
  2. search for column_id X in existing search string
  3. If column_id X not found, add the X:Y at the end of the existing search string
  4. If found: Find first occurrence of column_id X in search string
  5. Define the value of column_id X of the existing search string
  6. remove outer ( and ) of existing value if present
  7. Append | Y to the existing value, and add new outer ( and )
    • don't forget spaces!

Don't worry about cornercases:

Consecutive actions Resulting in search string Ideal solution not required for now
existing search -tag:LP --
filter column Tag is LR -tag:(LP|LR) -tag:LP tag:LR

Each change to the search string shall be reflected in the url, thus for example esQueryString=description%3A"%28KLM%7CDESIGN%29"

wouter1975 commented 11 months ago

From Daniel:

Het afhandelen van - en _ is een beetje apart door Postgres, maar ik denk dat je meestal wel de juiste match vind als je ze gebruikt. Zoeken op test_bed doet hetzelfde als zoeken op "test bed"
 en het woord test_bed wordt geindexeerd alsof het woorden zijn: test bed  , dus je vind een match als je zoekt op test_bed, maar ook als je zoekt op test, bed, test bed en test-bed bijv