Bug 1660460

Summary: Advanced Search Filter doesn't work when more than 1 different conditions[AND|OR|NOT] are used
Product: Red Hat CloudForms Management Engine Reporter: Parthvi Vala <pvala>
Component: UI - OPSAssignee: Harpreet Kataria <hkataria>
Status: CLOSED CURRENTRELEASE QA Contact: Angelina Vasileva <anikifor>
Severity: high Docs Contact: Red Hat CloudForms Documentation <cloudforms-docs>
Priority: high    
Version: 5.10.0CC: anikifor, bmidwood, cbolz, dmetzger, gekis, hkataria, jprause, lavenel, mpovolny, obarenbo, phoffmann, simaishi
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.11.0.10 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1720753 (view as bug list) Environment:
Last Closed: 2019-12-13 15:08:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1704905, 1720753    
Attachments:
Description Flags
bug demo on report filter tab
none
bug demo on infra provider page
none
Production log when faulty filter on infra provider page is loaded
none
error in 5.11.0.10 none

Description Parthvi Vala 2018-12-18 11:30:13 UTC
Created attachment 1515311 [details]
bug demo on report filter tab

Description of problem:
Advanced search filter fails when different conditions(AND|OR|NOT) are used.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Copy an existing report or create a new report.
2. Fill in required details and go to the Filters tab. 
3. Add filter in the following order: 
`condition1 AND condition2 AND condition3 OR condition4`

Actual results:
condition4 would not add and the form would render useless. Try clicking on `commit` or `discard, nothing would work.
Even if the report is saved with such filter, queuing the report would generate error.

Expected results:
User should be able to use as many conditions as they require.

Additional info:
- This problem is affecting all the areas where advanced search filter is used.
- This issue exists on 5.9 as well.

Comment 2 Parthvi Vala 2018-12-18 11:31:35 UTC
Created attachment 1515312 [details]
bug demo on infra provider page

Comment 3 Parthvi Vala 2018-12-18 11:33:10 UTC
Created attachment 1515313 [details]
Production log when faulty filter on infra provider page is loaded

Comment 8 drew uhlmann 2019-04-30 15:58:09 UTC
Because of the way the code at https://github.com/ManageIQ/manageiq-ui-classic/blob/master/app/controllers/application_controller/filter.rb#L549 is structured, I don't believe this is supported. I'm not sure what the correct procedure here is but I think it requires someone from the UI team to be involved in determining how we should handle this.

Comment 9 drew uhlmann 2019-04-30 18:28:19 UTC
The backend issue is fixed here: https://github.com/ManageIQ/manageiq/pull/18709
It'll still require UI work per comment 8

Comment 15 CFME Bot 2019-06-14 14:55:43 UTC
New commit detected on ManageIQ/manageiq/master:

https://github.com/ManageIQ/manageiq/commit/070d1436958f72c9b9694b17d93d4602c42016eb
commit 070d1436958f72c9b9694b17d93d4602c42016eb
Author:     Harpreet Kataria <hkataria>
AuthorDate: Thu Jun 13 17:58:54 2019 -0400
Commit:     Harpreet Kataria <hkataria>
CommitDate: Thu Jun 13 17:58:54 2019 -0400

    assign value to a variable and return at the end.

    Fixed `exp_find_by_token` method to return values correctly when finding token within an expression with mixed operators

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1660460

 lib/miq_expression/subst_mixin.rb | 14 +-
 spec/lib/miq_expression/subst_mixin_spec.rb | 34 +
 2 files changed, 43 insertions(+), 5 deletions(-)

Comment 17 Angelina Vasileva 2019-06-20 08:11:20 UTC
CFME 5.11.0.10.20190619171116_239686f

I am able to construct such filter but it still produces an error.


steps:
1. Go to VMs
2. Created advanced filter: ( Virtual Machine : Name = "linux" and ( Virtual Machine.My Company Tags : Environment CONTAINS 'Development' or Virtual Machine.My Company Tags : Environment CONTAINS 'Test' ) )
- it's good, now I am able to construct such filter
3. Save the filter with the name "bz"
4. Close the advanced search
5. Select your new advanced search from "My Filters"

Get the error as in the attachment (Data operator &#39;token&#39; is not supported [vm_infra/explorer]).

Comment 18 Angelina Vasileva 2019-06-20 08:12:09 UTC
Created attachment 1582548 [details]
error in 5.11.0.10

Comment 22 Angelina Vasileva 2019-06-24 06:36:30 UTC
Unfortunately, I don't have this appliance anymore and I couldn't reproduce it in a new one.

Therefore, marking as VERIFIED for 5.11.0.10.20190619171116_239686f.