Bug 1258933

Summary: UI: Reports explorer rebuilds trees on every transaction after Queue Report button is pressed once in UI.
Product: Red Hat CloudForms Management Engine Reporter: Chris Pelland <cpelland>
Component: UI - OPSAssignee: Harpreet Kataria <hkataria>
Status: CLOSED ERRATA QA Contact: Pete Savage <psavage>
Severity: high Docs Contact:
Priority: high    
Version: 5.4.0CC: cpelland, dajohnso, dclarizi, hkataria, jhardy, jprause, mfeifer, mpovolny, obarenbo
Target Milestone: GAKeywords: ZStream
Target Release: 5.4.3Flags: cfme-bot: needinfo?
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.4.3.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1258927 Environment:
Last Closed: 2015-10-22 14:33:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1258927    
Bug Blocks:    

Description Chris Pelland 2015-09-01 14:29:23 UTC
+++ This bug was initially created as a clone of Bug #1258927 +++

Description of problem: Reports explorer rebuilds trees on every transaction after Queue Report button is pressed once in UI.


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


How reproducible: 100%


Steps to Reproduce:
1. Go to Reports Explorer
2. Press "Queue" button to run a report
3. After that Reports explorer rebuilds trees in Reports explorer on each transaction. 

Actual results: Trees are being rebuilt on each transaction


Expected results: Trees should only be rebuilt when there is a new report result record in the database that was created after the trees were built last time.


Additional info: This can be verified by the time each transaction took before/after the fix.

Comment 2 CFME Bot 2015-09-02 14:20:23 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/1137496321b6cf4d1c77c3d332e690609a7498ad

commit 1137496321b6cf4d1c77c3d332e690609a7498ad
Author:     Harpreet Kataria <hkataria>
AuthorDate: Tue Sep 1 11:05:19 2015 -0400
Commit:     Harpreet Kataria <hkataria>
CommitDate: Tue Sep 1 13:37:34 2015 -0400

    Fixed code to not rebuild trees on each transaction in reports explorer
    
    - Fixed code that was rebuilding reports trees on every transaction after user pressed Queue report to run button once in UI, code was not setting rep_tree_build_time correctly in some of the places, removed setting of rep_tree_build_time from other places in code and moved it into rebuild_trees method.
    - added spec tests around rebuild_trees method and replace_right_cell method to verify changes.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1258927
    https://bugzilla.redhat.com/show_bug.cgi?id=1258933

 app/controllers/report_controller.rb               |   8 +-
 app/controllers/report_controller/menus.rb         |   1 -
 app/controllers/report_controller/reports.rb       |   2 -
 .../report_controller/reports/editor.rb            |   1 -
 app/controllers/report_controller/saved_reports.rb |   1 -
 spec/controllers/report_controller_spec.rb         | 100 +++++++++++++++++++++
 6 files changed, 105 insertions(+), 8 deletions(-)

Comment 4 CFME Bot 2015-09-03 19:29:27 UTC
New commit detected on cfme/5.4.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=ae9fd1fd0104d0f87bc9d4b47e675c14c714d1ee

commit ae9fd1fd0104d0f87bc9d4b47e675c14c714d1ee
Author:     Harpreet Kataria <hkataria>
AuthorDate: Wed Sep 2 12:51:57 2015 -0400
Commit:     Harpreet Kataria <hkataria>
CommitDate: Thu Sep 3 14:19:52 2015 -0400

    Fixed code to not rebuild trees on each transaction in reports explorer
    
    - Fixed code that was rebuilding reports trees on every transaction after user pressed Queue report to run button once in UI, code was not setting rep_tree_build_time correctly in some of the places, removed setting of rep_tree_build_time from other places in code and moved it into rebuild_trees method.
    - added spec tests around rebuild_trees method and replace_right_cell method to verify changes.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1258927
    https://bugzilla.redhat.com/show_bug.cgi?id=1258933

 vmdb/app/controllers/report_controller.rb          |   8 +-
 vmdb/app/controllers/report_controller/menus.rb    |   1 -
 vmdb/app/controllers/report_controller/reports.rb  |   2 -
 .../report_controller/reports/editor.rb            |   1 -
 .../controllers/report_controller/saved_reports.rb |   1 -
 vmdb/spec/controllers/report_controller_spec.rb    | 100 +++++++++++++++++++++
 6 files changed, 105 insertions(+), 8 deletions(-)

Comment 5 CFME Bot 2015-09-03 19:29:33 UTC
New commit detected on cfme/5.4.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=ad38ad1a150c9fb4b2f89bce48571883a33c3212

commit ad38ad1a150c9fb4b2f89bce48571883a33c3212
Merge: 43eda55 ae9fd1f
Author:     Dan Clarizio <dclarizi>
AuthorDate: Thu Sep 3 15:26:27 2015 -0400
Commit:     Dan Clarizio <dclarizi>
CommitDate: Thu Sep 3 15:26:27 2015 -0400

    Merge branch '54z_bz_1258933' into '5.4.z'
    
    Fixed code to not rebuild trees on each transaction in reports explorer
    
    - Fixed code that was rebuilding reports trees on every transaction after user pressed Queue report to run button once in UI, code was not setting rep_tree_build_time correctly in some of the places, removed setting of rep_tree_build_time from other places in code and moved it into rebuild_trees method.
    - added spec tests around rebuild_trees method and replace_right_cell method to verify changes.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1258927
    https://bugzilla.redhat.com/show_bug.cgi?id=1258933
    
    @dclarizio please review, clean patch was applied.
    Original PR: https://github.com/ManageIQ/manageiq/pull/4149
    
    See merge request !242

 vmdb/app/controllers/report_controller.rb          |   8 +-
 vmdb/app/controllers/report_controller/menus.rb    |   1 -
 vmdb/app/controllers/report_controller/reports.rb  |   2 -
 .../report_controller/reports/editor.rb            |   1 -
 .../controllers/report_controller/saved_reports.rb |   1 -
 vmdb/spec/controllers/report_controller_spec.rb    | 100 +++++++++++++++++++++
 6 files changed, 105 insertions(+), 8 deletions(-)

Comment 7 CFME Bot 2015-09-08 22:02:37 UTC
Detected commit referencing this ticket while ticket status is MODIFIED.

Comment 9 CFME Bot 2015-09-08 22:04:02 UTC
Detected commit referencing this ticket while ticket status is MODIFIED.

Comment 11 CFME Bot 2015-09-08 22:04:58 UTC
Detected commit referencing this ticket while ticket status is MODIFIED.

Comment 13 Pete Savage 2015-10-09 08:35:10 UTC
Verified that transaction times for report tree usage is for a vanilla appliance is 10x less in 5.4.3.0

[----] I, [2015-10-09T04:31:07.215118 #2460:d83eac]  INFO -- : Started POST "/report/tree_select/?id=xx-0_xx-0-4" for 127.0.0.1 at 2015-10-09 04:31:07 -0400
[----] I, [2015-10-09T04:31:07.220885 #2460:d83eac]  INFO -- : Processing by ReportController#tree_select as JS
[----] I, [2015-10-09T04:31:07.221009 #2460:d83eac]  INFO -- :   Parameters: {"id"=>"xx-0_xx-0-4"}
[----] I, [2015-10-09T04:31:07.685275 #2460:d83eac]  INFO -- :   Rendered layouts/_flash_msg.html.haml (0.2ms)
[----] I, [2015-10-09T04:31:07.685897 #2460:d83eac]  INFO -- :   Rendered report/_report_list.html.haml (1.1ms)
[----] I, [2015-10-09T04:31:07.694145 #2460:d83eac]  INFO -- : Completed 200 OK in 473.0ms (Views: 0.2ms | ActiveRecord: 25.5ms)

compared to

[----] I, [2015-10-09T04:31:06.585785 #2519:587e9c]  INFO -- : Started POST "/report/tree_select/?id=xx-0_xx-0-4" for 127.0.0.1 at 2015-10-09 04:31:06 -0400
[----] I, [2015-10-09T04:31:06.589373 #2519:587e9c]  INFO -- : Processing by ReportController#tree_select as JS
[----] I, [2015-10-09T04:31:06.589479 #2519:587e9c]  INFO -- :   Parameters: {"id"=>"xx-0_xx-0-4"}
[----] I, [2015-10-09T04:31:06.628079 #2519:587e9c]  INFO -- :   Rendered layouts/_flash_msg.html.haml (0.2ms)
[----] I, [2015-10-09T04:31:06.628690 #2519:587e9c]  INFO -- :   Rendered report/_report_list.html.haml (1.1ms)
[----] I, [2015-10-09T04:31:06.637642 #2519:587e9c]  INFO -- : Completed 200 OK in 48.0ms (Views: 0.2ms | ActiveRecord: 3.1ms)

for the same click operation.

Comment 15 errata-xmlrpc 2015-10-22 14:33:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1916.html