Bug 1129063

Summary: Custom time range, if set with invalid wrong range, cannot set back
Product: [JBoss] JBoss Operations Network Reporter: Heiko W. Rupp <hrupp>
Component: UIAssignee: Jirka Kremser <jkremser>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: high Docs Contact:
Priority: medium    
Version: JON 3.2CC: genman, hrupp, jkremser, loleary, mfoley, mithomps, mmahoney
Target Milestone: ER01   
Target Release: JON 3.3.0   
Hardware: Unspecified   
OS: Mac OS   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1128276 Environment:
Last Closed: 2014-12-11 14:00:22 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: 1128276, 1141796    
Bug Blocks:    

Description Heiko W. Rupp 2014-08-12 07:58:33 UTC
[ Fix is already in master ]


+++ This bug was initially created as a clone of Bug #1128276 +++

Description of problem:

Monitoring -> Metrics tab, if you enter a time range with the wrong time, where start time is NOT before end time, usually by mistake, then UI will show an info warning, then "Cannot load metrics", then throw an exception in the log:

Caused by: java.lang.IllegalArgumentException: Start date 1412876100000 is not before 1407522900000
        at org.rhq.enterprise.server.measurement.MeasurementDataManagerBean.getMeasurementAggregate(MeasurementDataManagerBean.java:664) [rhq-server.jar:4.12.0]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0]

Then, you cannot seem to reset the time range. The predefined ranges (1h, 4h, etc.) don't seem to do anything.


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


How reproducible:


Steps to Reproduce:
0. Custom date range select
1. Enter start date in future, like Oct 12, 2014 (I wanted 2013)
2. Enter end date as current time
3. Save

Actual results: 
Three errors, one helpful, the next saying cannot load metrics, then an exception in the logs.

Expected results:
Probably should just prevent the user from entering bad data?

Additional info:
Chrome browser

--- Additional comment from Elias Ross on 2014-08-08 15:22:29 EDT ---

Also I noticed the time range is saved in the database and cannot be fixed through the UI.

    ".resource.common.monitor.visibility.metricRange": "1412876100000|1407522900000",
    ".resource.common.monitor.visibility.metricRange.ro": "true",

This is stored in my user's configuration. The work-around is to use the RHQ cli to modify the config stuff.

... find Subject s
        var conf = s.getUserConfiguration()
        conf.getProperties().clear()
        SubjectManager.updateSubject(s);

--- Additional comment from Jirka Kremser on 2014-08-11 11:43:46 EDT ---

Nice catch, Elias.

branch:  master
link:    https://github.com/rhq-project/rhq/commit/67c7f3f02
time:    2014-08-11 17:40:18 +0200
commit:  67c7f3f024e99b90b8412d0da8c4d0cc4971c492
author:  Jirka Kremser - jkremser
message: [BZ 1128276] - Custom time range, if set with invalid wrong range,
         cannot set back - Adding a client side validation in web UI

Comment 1 Mike Thompson 2014-08-12 13:55:52 UTC
Committed to release/jon3.3.x

commit bb8778f0fe3d2ca38d4f9af8b8f01408ab22e704
Author: Jirka Kremser <jkremser>
Date:   Mon Aug 11 17:40:18 2014 +0200

    [BZ 1128276] - Custom time range, if set with invalid wrong range, cannot set back - Adding a client side validation in web UI

    (cherry picked from commit 67c7f3f024e99b90b8412d0da8c4d0cc4971c492)
    Signed-off-by: Mike Thompson <mithomps>

Comment 2 Simeon Pinder 2014-08-19 23:50:37 UTC
Moving to ON_QA as available to test in the following brew build:

https://brewweb.devel.redhat.com//buildinfo?buildID=379025