Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(orchestrator): add column filters #2273

Merged
merged 8 commits into from
Oct 8, 2024

Conversation

gciavarrini
Copy link
Contributor

@gciavarrini gciavarrini commented Sep 30, 2024

The orchestrator UI needs to filter by any column.

At this time only in, like, equal, isnull operator for string are supported.
FieldFilters can be combined by LogicalFilters (and, or).
Filters are available for /v2/workflows/instances and /v2/workflows/overview endpoints.

Usage example

Overviews

Equal

curl --request POST \
  --url http://localhost:7007/api/orchestrator/v2/workflows/overview \
   -H "Authorization: $token" \
  --header 'Content-Type: application/json' \
  --data '{
  "filters": {
    "operator": "OR",
    "filters": [
      {
        "field": "name",
        "operator": "EQ",
        "value": "Hello World Workflow"
      },
      {
        "field": "id",
        "operator": "EQ",
        "value": "yamlgreet"
      }
    ]
  },
  "paginationInfo": {
    "offset": 0,
    "pageSize": 10
  }
}'

returns

{"items":[{"id":"9fa2a881-c932-468d-83a9-687b9f1e62a7","processId":"hello_world","processName":"Hello World Workflow","businessKey":null,"category":"infrastructure","start":"2024-10-03T10:23:32.654Z","end":"2024-10-03T10:23:32.645Z","duration":"a few seconds","workflowdata":{"myKey":"myValue","mantra":"Serverless Workflow is awesome!","greeting":"Hello World"},"status":"Completed","nodes":[{"id":"e298367d-cbfa-4af7-a454-b1a186cbe25e","__typename":"NodeInstance"},{"id":"36d5d322-b711-472f-9a3f-23f5a74d6904","__typename":"NodeInstance"},{"id":"1e7da447-c8c4-4918-9a31-539b1f1eba6b","__typename":"NodeInstance"},{"id":"22b8c488-7858-4c38-8d31-17cd500ed7eb","__typename":"NodeInstance"}]}],"paginationInfo":{"pageSize":10,"offset":0,"totalCount":1}}

Like

curl --request POST \
  --url http://localhost:7007/api/orchestrator/v2/workflows/instances \
  -H "Authorization: $token" \
  --header "Content-Type: application/json" \
  --data '{
    "filters": {
      "field": "processName",
      "operator": "LIKE",
      "value": "Hello%"
    },
    "paginationInfo": {
      "offset": 0,
      "pageSize": 10
    }
  }'

returns

{"items":[{"id":"9fa2a881-c932-468d-83a9-687b9f1e62a7","processId":"hello_world","processName":"Hello World Workflow","businessKey":null,"category":"infrastructure","start":"2024-10-03T10:23:32.654Z","end":"2024-10-03T10:23:32.645Z","duration":"a few seconds","workflowdata":{"myKey":"myValue","mantra":"Serverless Workflow is awesome!","greeting":"Hello World"},"status":"Completed","nodes":[{"id":"e298367d-cbfa-4af7-a454-b1a186cbe25e","__typename":"NodeInstance"},{"id":"36d5d322-b711-472f-9a3f-23f5a74d6904","__typename":"NodeInstance"},{"id":"1e7da447-c8c4-4918-9a31-539b1f1eba6b","__typename":"NodeInstance"},{"id":"22b8c488-7858-4c38-8d31-17cd500ed7eb","__typename":"NodeInstance"}]}],"paginationInfo":{"pageSize":10,"offset":0,"totalCount":1}}

Instances

Equal

curl --request POST \
  --url http://localhost:7007/api/orchestrator/v2/workflows/instances \
  -H "Authorization: $token" \
  --header "Content-Type: application/json" \
  --data '{
    "filters": {
      "field": "processName",
      "operator": "EQ",
      "value": "Hello World Workflow"
    },
    "paginationInfo": {
      "offset": 0,
      "pageSize": 10
    }
  }'

returns

{"items":[{"id":"9fa2a881-c932-468d-83a9-687b9f1e62a7","processId":"hello_world","processName":"Hello World Workflow","businessKey":null,"category":"infrastructure","start":"2024-10-03T10:23:32.654Z","end":"2024-10-03T10:23:32.645Z","duration":"a few seconds","workflowdata":{"myKey":"myValue","mantra":"Serverless Workflow is awesome!","greeting":"Hello World"},"status":"Completed","nodes":[{"id":"e298367d-cbfa-4af7-a454-b1a186cbe25e","__typename":"NodeInstance"},{"id":"36d5d322-b711-472f-9a3f-23f5a74d6904","__typename":"NodeInstance"},{"id":"1e7da447-c8c4-4918-9a31-539b1f1eba6b","__typename":"NodeInstance"},{"id":"22b8c488-7858-4c38-8d31-17cd500ed7eb","__typename":"NodeInstance"}]}],"paginationInfo":{"pageSize":10,"offset":0,"totalCount":1}}

Jira issue

Fix FLPATH-1757

@gciavarrini gciavarrini requested review from a team as code owners September 30, 2024 15:58
@gciavarrini gciavarrini changed the title feat(orchestrator) - add column filters feat(orchestrator) : add column filters Sep 30, 2024
@gciavarrini gciavarrini changed the title feat(orchestrator) : add column filters feat(orchestrator): add column filters Sep 30, 2024
@gciavarrini gciavarrini force-pushed the FLPATH-1653-any-column-filter branch from 406a04c to fae4d29 Compare September 30, 2024 17:46
@batzionb
Copy link
Contributor

batzionb commented Sep 30, 2024

hi,
I tried this post request and got error

  curl --request POST \
  --url http://localhost:7007/api/orchestrator/v2/workflows/instances \
  -H "Authorization: Bearer $token" \
  --header "Content-Type: application/json" \
  --data '{
    "filters": {
      "field": "processName",
      "operator": "EQ",
      "value": "Wait or Error"
    },
    "paginationInfo": {
      "offset": 0,
      "pageSize": 10
    }
  }'

what am I missing?

@gciavarrini gciavarrini force-pushed the FLPATH-1653-any-column-filter branch from fae4d29 to 2601b1a Compare October 1, 2024 08:07
@gciavarrini
Copy link
Contributor Author

hi, I tried this post request and got error

@batzionb there was a bug. Can you retry? I also added another example in the PR description.

@batzionb
Copy link
Contributor

batzionb commented Oct 1, 2024

That post command works now

Now I tried the LIKE operator and I get an empty list in the items field, altghough I do get the correct totalCount

curl --request POST \
 --url http://localhost:7007/api/orchestrator/v2/workflows/instances \
 -H "Authorization: Bearer $token" \
 --header "Content-Type: application/json" \
 --data '{
   "filters": {
     "field": "processName",
     "operator": "LIKE",
     "value": "Wait"
   },
   "paginationInfo": {
     "offset": 0,
     "pageSize": 10
   }
 }'


@gciavarrini gciavarrini force-pushed the FLPATH-1653-any-column-filter branch 3 times, most recently from 4328c3c to 1d069d9 Compare October 3, 2024 10:31
@gciavarrini gciavarrini force-pushed the FLPATH-1653-any-column-filter branch from 1d069d9 to ec32cf4 Compare October 7, 2024 16:30
Signed-off-by: Gloria Ciavarrini <gciavarrini@redhat.com>
Signed-off-by: Gloria Ciavarrini <gciavarrini@redhat.com>
Signed-off-by: Gloria Ciavarrini <gciavarrini@redhat.com>
Signed-off-by: Gloria Ciavarrini <gciavarrini@redhat.com>
@gciavarrini gciavarrini force-pushed the FLPATH-1653-any-column-filter branch 3 times, most recently from 5429499 to f4a12ec Compare October 7, 2024 17:24
@gciavarrini
Copy link
Contributor Author

@batzionb @ydayagi PTAL

@gciavarrini gciavarrini force-pushed the FLPATH-1653-any-column-filter branch from f4a12ec to 9ba1934 Compare October 7, 2024 17:41
Copy link

sonarqubecloud bot commented Oct 7, 2024

@batzionb
Copy link
Contributor

batzionb commented Oct 8, 2024

/lgtm

@batzionb batzionb merged commit 544c2c7 into janus-idp:main Oct 8, 2024
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants