Description of problem: If user selects more than one chart using <ctrl> or <shift> key on Monitoring->Metrics tab of a resource and clicks on Add button for 'Add to Dashboard', the default dashboard displays only one metric chart. Please refer the attached screenshots. Version-Release number of selected component (if applicable): Version : 3.2.0.ER7 Build Number : e8e6401:ff0061d Browsers used: FF17 and IE9 How reproducible: always Steps to Reproduce: 1. Navigate to Monitoring->Metrics tab of a resource (Ex: CPU 0 ) 2. Select more than oe charts using <ctrl> or <shift> key. ( Ex: I selected all the three charts 'system Load, 'User Load' and 'Wait Load' ) 3. The Total rows at the bottom right shows 'selected: 3' . 4. Click on Add button for 'Add to Dashboard'. 5. Navigate to the default dashboard. 6. The default dashboard displays only one chart. Actual results: Add to dashboard does not add multiple charts. Only one chart is added. Expected results: All the selected charts should appear on the default dashboard. Additional info:
Created attachment 827838 [details] Charts Selected
Created attachment 827839 [details] Default Dashboard
TCMS testrun https://tcms.engineering.redhat.com/run/99835/ on ER6 the buttone was disabled...and that changed in ER7
Additionally, "Add" button should be disabled when no metric is selected. Right now, if you don't select any metric and push the button, nothing happens.
This is actually a dup of BZ 988581.
Additional context from the logs relevant to issue: Root Cause : org.hibernate.StaleStateException:Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1 Detail : java.lang.RuntimeException:[1374788639526] javax.ejb.EJBTransactionRolledbackException:Transaction rolled back -> javax.transaction.RollbackException:ARJUNA016053: Could not commit transaction. -> javax.persistence.OptimisticLockException:org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1 -> org.hibernate.StaleStateException:Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1 --- STACK TRACE FOLLOWS --- [1374788639526] javax.ejb.EJBTransactionRolledbackException:Transaction rolled back -> javax.transaction.RollbackException:ARJUNA016053: Could not commit transaction. -> javax.persistence.OptimisticLockException:org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1 -> org.hibernate.StaleStateException:Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1 at Unknown.anonymous(Unknown Source) at Unknown.anonymous(Unknown Source)
Mike, I think we should just disable this ability and add one at a time. Just change the button enablement, unless you really want to fix it to allow multiple.
I added the ability to add one at a time. This was more difficult than it should have been because the listgrid selection policy was already set to SINGLE and yet it acts like MULTIPLE. So now I just take the last selected row if multiple rows are selected and use that to add to the dashboard. I also fixed Libor's comment: "Add" button should be disabled when no metric is selected. It is now not possible to add if there is no selection. Committed to Master: commit 50f3dad8c8a813d76b22a67cb6a423c84d3d0a60 Author: Mike Thompson <mithomps> Date: Wed Sep 10 11:06:29 2014 -0700 [Bug 1033665] Add to dashboard does not add multiple charts to default dashboard.
Mike, here is the cherry pick. release/jon3.3.x commit 99fd48185da1e71fcb775493d761f3522913b23a Author: Mike Thompson <mithomps> Date: Wed Sep 10 11:06:29 2014 -0700 (cherry picked from commit 50f3dad8c8a813d76b22a67cb6a423c84d3d0a60) Signed-off-by: Jay Shaughnessy <jshaughn> It looks like what made this difficult was that the relevant class, MetricsTableView, doesn't make use of any of the table action (i.e. button) support that we use pretty much everywhere for the list views deriving from Table. Not sure why not. If it did it could have just set SelectionPolict to SINGLE and I think we'd be good, that seems to work everywhere else.
Jay, this table for the metrics view is more complicated than a regular table action as it a hierarchical listgrid with special refreshing for the both the graphs, sparkline graphs and it must remember what graphs are opened during a refresh. So it really a different beast than Table. Regardless, the selectionPolicy should work and when you inspect it it shows the SelectionPolicy as SINGLE (but behaves as MULTIPLE).
OK, cool, thanks for the explanation, I should have looked more closely.
Moving to ON_QA as available for test with the following brew build: https://brewweb.devel.redhat.com//buildinfo?buildID=385149
Verified on version : 3.3.0.ER03 build number : 4aefe39:44e33a4 Verified that 'Add' button is disabled when no metric is selected. If multiple rows are selected, then Add to dashboard adds last selected row to the default dashboard. Multiple charts are added to the default dashboard if selected and added one by one.
Cleaning up needinfo flag.