geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ecr...@apache.org
Subject svn commit: r606930 - in /geronimo/server/trunk/applications/monitoring/mconsole-war/src/main: java/org/apache/geronimo/monitoring/console/ webapp/WEB-INF/view/
Date Wed, 26 Dec 2007 18:35:38 GMT
Author: ecraig
Date: Wed Dec 26 10:35:36 2007
New Revision: 606930

URL: http://svn.apache.org/viewvc?rev=606930&view=rev
Log:
GERONIMO-3714
Monitoring console does no error checking on add/edit graph timeframe

Patch by Viet Nguyen

Modified:
    geronimo/server/trunk/applications/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/GraphsBuilder.java
    geronimo/server/trunk/applications/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnector.java
    geronimo/server/trunk/applications/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp
    geronimo/server/trunk/applications/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditGraph.jsp

Modified: geronimo/server/trunk/applications/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/GraphsBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/GraphsBuilder.java?rev=606930&r1=606929&r2=606930&view=diff
==============================================================================
--- geronimo/server/trunk/applications/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/GraphsBuilder.java (original)
+++ geronimo/server/trunk/applications/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/GraphsBuilder.java Wed Dec 26 10:35:36 2007
@@ -134,6 +134,10 @@
 
                 int skipCount = (int) ((timeFrame / (mrc.getSnapshotDuration() / 60000)))
                         / (snapCount - 2);
+                // ensure that we are at least looking at each snapshot (i.e. skipCount <- 1)
+                if(skipCount == 0) {
+                    skipCount = 1;
+                }
                 snapCount = snapCount + 2;
                 TreeMap<Long, Long> snapshotList1 = mrc
                         .getSpecificStatistics(mBeanName, dataName1, snapCount,

Modified: geronimo/server/trunk/applications/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnector.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnector.java?rev=606930&r1=606929&r2=606930&view=diff
==============================================================================
--- geronimo/server/trunk/applications/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnector.java (original)
+++ geronimo/server/trunk/applications/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnector.java Wed Dec 26 10:35:36 2007
@@ -37,65 +37,67 @@
 
 import org.apache.geronimo.util.EncryptionManager;
 
-public class MRCConnector
-{
+public class MRCConnector {
 
-    private MasterRemoteControlRemote mrc              = null;
+    private MasterRemoteControlRemote mrc = null;
 
-    MRCConnector()
-    {
+    MRCConnector() {
 
     }
 
     /**
      * @param ip -
-     *            IP address of mrc-server to connect to
+     *                IP address of mrc-server to connect to
      * @param userName -
-     *            Username for JMX connection to the host
+     *                Username for JMX connection to the host
      * @param password -
-     *            Password for JMX connection to the host
+     *                Password for JMX connection to the host
      * @throws Exception -
-     *             If the connection to mrc-server fails
+     *                 If the connection to mrc-server fails
      */
     public MRCConnector(String ip, String userName, String password, int port)
-            throws Exception
-    {
+            throws Exception {
         // decrypt the password
-        password = (String)EncryptionManager.decrypt(password);
+        password = (String) EncryptionManager.decrypt(password);
         try {
             Properties props = new Properties();
             props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
                     "org.apache.openejb.client.RemoteInitialContextFactory");
-            props.setProperty(Context.PROVIDER_URL, "ejbd://" + ip + ":" + port);
+            props
+                    .setProperty(Context.PROVIDER_URL, "ejbd://" + ip + ":"
+                            + port);
             props.setProperty(Context.SECURITY_PRINCIPAL, userName);
             props.setProperty(Context.SECURITY_CREDENTIALS, password);
-            props.setProperty("openejb.authentication.realmName", "geronimo-admin");
+            props.setProperty("openejb.authentication.realmName",
+                    "geronimo-admin");
             Context ic = new InitialContext(props);
             mrc = (MasterRemoteControlRemote) ic.lookup("ejb/mgmt/MRCRemote");
             mrc.setUpMEJB(userName, password);
-        } catch(Exception e) {
+        } catch (Exception e) {
             throw e;
         }
-        // when the code has reach this point, a connection was successfully established
+        // when the code has reach this point, a connection was successfully
+        // established
         // so we need to update the last_seen attribute for the server
         Format formatter = null;
         formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         Date date = new Date(System.currentTimeMillis());
         String currentTime = formatter.format(date);
-        
+
         Connection conn = DBManager.createConnection();
         try {
             Statement stmt = conn.createStatement();
-            stmt.executeUpdate("UPDATE SERVERS SET LAST_SEEN = '" + currentTime + "' WHERE IP='" + ip + "'");
-        } catch(Exception e) {
+            stmt.executeUpdate("UPDATE SERVERS SET LAST_SEEN = '" + currentTime
+                    + "' WHERE IP='" + ip + "'");
+        } catch (Exception e) {
             throw e;
         } finally {
             try {
-                if(conn != null){
+                if (conn != null) {
                     conn.close();
                 }
-            } catch(Exception e) {
-                
+            } catch (Exception e) {
+
             }
         }
     }
@@ -104,10 +106,9 @@
      * @return - Returns an Long representing the current snapshot duration set
      *         on the server side
      * @throws Exception -
-     *             If the connection to the MRC-Server fails
+     *                 If the connection to the MRC-Server fails
      */
-    public Long getSnapshotDuration() throws Exception
-    {
+    public Long getSnapshotDuration() throws Exception {
         return mrc.getSnapshotDuration();
     }
 
@@ -115,27 +116,22 @@
      * @return - Returns an ArrayList of String objects containing a listing of
      *         all statistics values being collected
      * @throws Exception -
-     *             If the connection to the MRC-Server fails
+     *                 If the connection to the MRC-Server fails
      */
     @SuppressWarnings("unchecked")
     public HashMap<String, ArrayList<String>> getDataNameList()
-            throws Exception
-    {
+            throws Exception {
 
         HashMap<String, ArrayList<String>> DataNameList = new HashMap<String, ArrayList<String>>();
 
-        try
-        {
+        try {
             DataNameList = mrc.getAllSnapshotStatAttributes();
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             e.printStackTrace();
         }
         // Strip out snapshot_date and snapshot_time, we know these exist
         for (Iterator<String> it = DataNameList.keySet().iterator(); it
-                .hasNext();)
-        {
+                .hasNext();) {
             String mbeanName = it.next();
             DataNameList.get(mbeanName).remove("snapshot_date");
             DataNameList.get(mbeanName).remove("snapshot_time");
@@ -145,31 +141,28 @@
 
     /**
      * @param snapCount -
-     *            Number of snapshots to request from the server
+     *                Number of snapshots to request from the server
      * @param skipCount -
-     *            Every nth snapshot. A value of 1 will be every 1. A value of 2
-     *            will be every other.
+     *                Every nth snapshot. A value of 1 will be every 1. A value
+     *                of 2 will be every other.
      * @return - Returns an ArrayList of Map objects.
      * @throws Exception -
-     *             If the connection to the MRC-Server fails
+     *                 If the connection to the MRC-Server fails
      */
     @SuppressWarnings("unchecked")
     public ArrayList<HashMap<String, HashMap<String, Object>>> getSnapshots(
-            int snapCount, int skipCount) throws Exception
-    {
+            int snapCount, int skipCount) throws Exception {
         ArrayList<HashMap<String, HashMap<String, Object>>> snapshotList = mrc
                 .fetchSnapshotData(snapCount, skipCount);
         // Check if snapshotList is empty
-        if (snapshotList.size() == 0)
-        {
+        if (snapshotList.size() == 0) {
             return snapshotList;
         }
         /*
          * If there are not enough snapshots available to fill the requested
          * number, insert some with values of 0 and the proper times.
          */
-        while (snapshotList.size() < snapCount)
-        {
+        while (snapshotList.size() < snapCount) {
             // Temporary, always is first element (oldest)
             HashMap<String, HashMap<String, Object>> mapTimeFix = snapshotList
                     .get(0);
@@ -187,9 +180,8 @@
             // Calculate appropriate time, add it to the submap, then
             // add
             // that to the tempMap
-            subMap
-                    .put("snapshot_time", ((Long) mapTimeFix.get("times").get(
-                            "snapshot_time") - (getSnapshotDuration() * skipCount)));
+            subMap.put("snapshot_time", ((Long) mapTimeFix.get("times").get(
+                    "snapshot_time") - (getSnapshotDuration() * skipCount)));
             Format formatter = null;
             formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
             Date date = new Date((Long) subMap.get("snapshot_time"));
@@ -205,25 +197,20 @@
 
             // Run through the mbeans
             for (Iterator<String> it = mapTimeFix.keySet().iterator(); it
-                    .hasNext();)
-            {
+                    .hasNext();) {
                 // get the mbean name
                 String mbeanName = it.next();
                 HashMap<String, Object> stats = null;
                 // Verify that it's not times
 
-                if (mbeanName.equals(new String("times")))
-                {
+                if (mbeanName.equals(new String("times"))) {
 
-                }
-                else
-                {
+                } else {
                     stats = mapTimeFix.get(mbeanName);
                     // Run through the stats elements for the particular
                     // mbean
                     for (Iterator<String> itt = stats.keySet().iterator(); itt
-                            .hasNext();)
-                    {
+                            .hasNext();) {
                         String key = itt.next();
                         // Place faux data into the submap
                         subMap.put(key, new Long(0));
@@ -239,13 +226,11 @@
         /*
          * This is where we will be inserting data to fill 'gaps' in the
          * snapshots The initial for-loop will travel from the most recent
-         * snapshot to the oldest, checking that the snapshot_time along the
-         * way all align with what they should be
+         * snapshot to the oldest, checking that the snapshot_time along the way
+         * all align with what they should be
          */
-        for (int i = snapshotList.size() - 1; i > 0; i--)
-        {
-            if (i > 0)
-            {
+        for (int i = snapshotList.size() - 1; i > 0; i--) {
+            if (i > 0) {
                 HashMap<String, HashMap<String, Object>> mapTimeFix = snapshotList
                         .get(i);
                 HashMap<String, HashMap<String, Object>> mapTimeFix2 = snapshotList
@@ -253,27 +238,23 @@
                 // here is where we will in missing data
                 while (((((Long) mapTimeFix.get("times").get("snapshot_time") / 1000) / 60)
                         - (((Long) mapTimeFix2.get("times")
-                                .get("snapshot_time") / 1000) / 60) > (((getSnapshotDuration() / 1000) / 60) * skipCount)))
-                {
+                                .get("snapshot_time") / 1000) / 60) > (((getSnapshotDuration() / 1000) / 60) * skipCount))) {
                     HashMap<String, HashMap<String, Object>> tempMap = new HashMap<String, HashMap<String, Object>>();
                     HashMap<String, Object> subMap = new HashMap<String, Object>();
 
                     for (Iterator<String> it = mapTimeFix.keySet().iterator(); it
-                            .hasNext();)
-                    {
+                            .hasNext();) {
                         // get the mbean name
                         String mbeanName = it.next();
                         HashMap<String, Object> stats = null;
                         // Verify that it's not times
-                        if (!mbeanName.equals("times"))
-                        {
+                        if (!mbeanName.equals("times")) {
                             stats = mapTimeFix.get(mbeanName);
                             // Run through the stats elements for the
                             // particular
                             // mbean
                             for (Iterator<String> itt = stats.keySet()
-                                    .iterator(); itt.hasNext();)
-                            {
+                                    .iterator(); itt.hasNext();) {
                                 String key = itt.next();
                                 // Place faux data into the submap
                                 subMap.put(key, new Long(0));
@@ -285,13 +266,9 @@
                         }
                     }
 
-                    subMap
-                            .put(
-                                    "snapshot_time",
-                                    new Long(
-                                            (Long) mapTimeFix.get("times").get(
-                                                    "snapshot_time")
-                                                    - (getSnapshotDuration() * skipCount)));
+                    subMap.put("snapshot_time", new Long((Long) mapTimeFix.get(
+                            "times").get("snapshot_time")
+                            - (getSnapshotDuration() * skipCount)));
                     Format formatter = null;
                     formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                     Date date = new Date((Long) subMap.get("snapshot_time"));
@@ -312,52 +289,44 @@
 
     @SuppressWarnings("unchecked")
     public TreeMap<Long, Long> getSpecificStatistics(String mbeanName,
-            String statsName, int snapCount, int skipCount, boolean showArchive) throws Exception
-    {
+            String statsName, int snapCount, int skipCount, boolean showArchive)
+            throws Exception {
         TreeMap<Long, Long> snapshotList = mrc.getSpecificStatistics(mbeanName,
                 statsName, snapCount, skipCount, showArchive);
         // Check if snapshotList is empty
-        if (snapshotList.size() == 0)
-        {
+        if (snapshotList.size() == 0) {
             return snapshotList;
         }
         /*
          * If there are not enough snapshots available to fill the requested
          * number, insert some with values of 0 and the proper times.
          */
-        while (snapshotList.size() < snapCount)
-        {
+        while (snapshotList.size() < snapCount) {
             // Temporary, always is first element (oldest)
             Long timeFix = snapshotList.firstKey();
 
             // Calculate appropriate time, add it to the submap, then
             // add
             // that to the tempMap
-            snapshotList
-                    .put(
-                            (timeFix - (getSnapshotDuration() * skipCount)),
-                            new Long(0));
+            snapshotList.put((timeFix - (getSnapshotDuration() * skipCount)), new Long(0));
         }
 
         /*
          * This is where we will be inserting data to fill 'gaps' in the
          * snapshots The initial for-loop will travel from the most recent
-         * snapshot to the oldest, checking that the snapshot_time along the
-         * way all align with what they should be
+         * snapshot to the oldest, checking that the snapshot_time along the way
+         * all align with what they should be
          */
         Set tempSet = snapshotList.keySet();
         ArrayList<Long> tempArray = new ArrayList(tempSet);
 
-        for (int i = tempArray.size() - 1; i > 0; i--)
-        {
+        for (int i = tempArray.size() - 1; i > 0; i--) {
             Long tempLong1 = tempArray.get(i);
             Long tempLong2 = tempArray.get(i - 1);
             // here is where we will in missing data
-            while (((((Long) tempLong1 / 1000) / 60)
-                    - (((Long) tempLong2 / 1000) / 60) > (((getSnapshotDuration() / 1000) / 60) * skipCount))
-                    && i > 0)
-            {
-
+            while ((((tempLong1 / 1000) / 60) - ((tempLong2 / 1000) / 60) > 
+                    (((getSnapshotDuration() / 1000) / 60) * skipCount))
+                    && i > 0) {
                 tempLong1 = tempLong1 - (getSnapshotDuration() * skipCount);
                 snapshotList.remove(tempArray.get(0));
                 snapshotList.put(tempLong1, new Long(0));
@@ -370,102 +339,85 @@
 
     @SuppressWarnings("unchecked")
     public HashMap<String, HashMap<String, Object>> getLatestSnapshots()
-            throws Exception
-    {
+            throws Exception {
         int snapCount = 1;
         int skipCount = 1;
         ArrayList<HashMap<String, HashMap<String, Object>>> snapshotList = mrc
                 .fetchSnapshotData(snapCount, skipCount);
         // Check if snapshotList is empty
-        if (snapshotList.size() == 0)
-        {
+        if (snapshotList.size() == 0) {
             return null;
-        }
-        else
+        } else
             return snapshotList.get(0);
     }
 
     /**
      * @return - Returns a boolean indicating successful stop
      * @throws Exception -
-     *             If the connection to the MRC-Server fails
+     *                 If the connection to the MRC-Server fails
      */
-    public boolean stopSnapshotThread() throws Exception
-    {
+    public boolean stopSnapshotThread() throws Exception {
         return mrc.stopSnapshot();
     }
 
     /**
      * @return - Returns a boolean indicating successful stop
      * @throws Exception -
-     *             If the connection to the MRC-Server fails
+     *                 If the connection to the MRC-Server fails
      */
-    public boolean startSnapshotThread(long time) throws Exception
-    {
+    public boolean startSnapshotThread(long time) throws Exception {
         return mrc.startSnapshot(time);
     }
 
-    public boolean isSnapshotRunning()
-    {
+    public boolean isSnapshotRunning() {
         boolean running = false;
-        try
-        {
+        try {
             running = mrc.isSnapshotRunning();
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             return false;
         }
         return running;
     }
 
     @SuppressWarnings("unchecked")
-    public Set<String> getAllMbeanNames() throws Exception
-    {
+    public Set<String> getAllMbeanNames() throws Exception {
         return mrc.getAllMBeanNames();
     }
 
     @SuppressWarnings("unchecked")
-    public Set<String> getStatisticsProviderBeanNames() throws Exception
-    {
+    public Set<String> getStatisticsProviderBeanNames() throws Exception {
         return mrc.getStatisticsProviderMBeanNames();
     }
 
     @SuppressWarnings("unchecked")
     public HashMap<String, ArrayList<String>> getAllSnapshotStatAttributes()
-            throws Exception
-    {
+            throws Exception {
         return mrc.getAllSnapshotStatAttributes();
     }
 
     @SuppressWarnings("unchecked")
-    public Set<String> getTrackedBeans() throws Exception
-    {
+    public Set<String> getTrackedBeans() throws Exception {
         return mrc.getTrackedMBeans();
     }
 
     @SuppressWarnings("unchecked")
-    public Set<String> getStatAttributesOnMBean(String mBean) throws Exception
-    {
+    public Set<String> getStatAttributesOnMBean(String mBean) throws Exception {
         HashMap<String, ArrayList<String>> allStatAttributes = getAllSnapshotStatAttributes();
         ArrayList<String> tempArrayList = allStatAttributes.get(mBean);
         Set<String> tempSet = new TreeSet<String>();
         Iterator it = tempArrayList.iterator();
-        while (it.hasNext())
-        {
+        while (it.hasNext()) {
             tempSet.add(it.next().toString());
         }
         return tempSet;
     }
 
     @SuppressWarnings("unchecked")
-    public Set<String> getTrackedBeansPretty() throws Exception
-    {
+    public Set<String> getTrackedBeansPretty() throws Exception {
         Set trackedBeans = getTrackedBeans();
         Set prettybeans = new TreeSet();
         Iterator it = trackedBeans.iterator();
-        while (it.hasNext())
-        {
+        while (it.hasNext()) {
             String[] temparray1 = it.next().toString().split("name=");
             String[] temparray2 = temparray1[1].split(",");
             String[] temparray3 = temparray2[0].split("/");
@@ -480,13 +432,11 @@
     }
 
     @SuppressWarnings("unchecked")
-    public TreeMap<String, String> getTrackedBeansMap() throws Exception
-    {
+    public TreeMap<String, String> getTrackedBeansMap() throws Exception {
         Set trackedBeans = getTrackedBeans();
         TreeMap<String, String> beanMap = new TreeMap<String, String>();
         Iterator it = trackedBeans.iterator();
-        while (it.hasNext())
-        {
+        while (it.hasNext()) {
             String mbeanName = it.next().toString();
             String[] temparray1 = mbeanName.split("name=");
             String[] temparray2 = temparray1[1].split(",");
@@ -502,13 +452,11 @@
     }
 
     @SuppressWarnings("unchecked")
-    public Set<String> getStatisticsProviderBeanNamesPretty() throws Exception
-    {
+    public Set<String> getStatisticsProviderBeanNamesPretty() throws Exception {
         Set availableBeans = getStatisticsProviderBeanNames();
         Set prettybeans = new TreeSet();
         Iterator it = availableBeans.iterator();
-        while (it.hasNext())
-        {
+        while (it.hasNext()) {
             String[] temparray1 = it.next().toString().split("name=");
             String[] temparray2 = temparray1[1].split(",");
             String[] temparray3 = temparray2[0].split("/");
@@ -524,13 +472,11 @@
 
     @SuppressWarnings("unchecked")
     public TreeMap<String, String> getStatisticsProviderBeanNamesMap()
-            throws Exception
-    {
+            throws Exception {
         Set availableBeans = getStatisticsProviderBeanNames();
         TreeMap<String, String> beanMap = new TreeMap<String, String>();
         Iterator it = availableBeans.iterator();
-        while (it.hasNext())
-        {
+        while (it.hasNext()) {
             String mbeanName = it.next().toString();
             String[] temparray1 = mbeanName.split("name=");
             String[] temparray2 = temparray1[1].split(",");
@@ -547,14 +493,12 @@
 
     @SuppressWarnings("unchecked")
     public Set<String> getFreeStatisticsProviderBeanNamesPretty()
-            throws Exception
-    {
+            throws Exception {
         Set<String> availableBeans = getStatisticsProviderBeanNamesPretty();
         Set<String> usedBeans = getTrackedBeansPretty();
         Set freeBeans = new TreeSet();
         Iterator it = availableBeans.iterator();
-        while (it.hasNext())
-        {
+        while (it.hasNext()) {
             String mbeanName = it.next().toString();
             if (!usedBeans.contains(mbeanName))
                 freeBeans.add(mbeanName);
@@ -563,14 +507,12 @@
     }
 
     @SuppressWarnings("unchecked")
-    public Set<String> getFreeStatisticsProviderBeanNames() throws Exception
-    {
+    public Set<String> getFreeStatisticsProviderBeanNames() throws Exception {
         Set<String> availableBeans = getStatisticsProviderBeanNames();
         Set<String> usedBeans = getTrackedBeansPretty();
         Set freeBeans = new TreeSet();
         Iterator it = availableBeans.iterator();
-        while (it.hasNext())
-        {
+        while (it.hasNext()) {
             String mbeanName = it.next().toString();
             String[] temparray1 = mbeanName.split("name=");
             String[] temparray2 = temparray1[1].split(",");
@@ -588,14 +530,12 @@
 
     @SuppressWarnings("unchecked")
     public TreeMap<String, String> getFreeStatisticsProviderBeanNamesMap()
-            throws Exception
-    {
+            throws Exception {
         Set<String> availableBeans = getStatisticsProviderBeanNames();
         Set<String> usedBeans = getTrackedBeansPretty();
         TreeMap<String, String> beanMap = new TreeMap<String, String>();
         Iterator it = availableBeans.iterator();
-        while (it.hasNext())
-        {
+        while (it.hasNext()) {
             String mbeanName = it.next().toString();
             String[] temparray1 = mbeanName.split("name=");
             String[] temparray2 = temparray1[1].split(",");
@@ -610,36 +550,33 @@
         }
         return beanMap;
     }
-    
+
     @SuppressWarnings("unchecked")
-    public boolean stopTrackingMbean(String MBean) throws Exception
-    {
+    public boolean stopTrackingMbean(String MBean) throws Exception {
         mrc.removeMBeanForSnapshot(MBean);
         return true;
     }
 
     @SuppressWarnings("unchecked")
-    public boolean startTrackingMbean(String MBean) throws Exception
-    {
+    public boolean startTrackingMbean(String MBean) throws Exception {
         mrc.addMBeanForSnapshot(MBean);
         return true;
     }
 
     @SuppressWarnings("unchecked")
-    public HashMap<String, Long> getStats(String MBean) throws Exception
-    {
+    public HashMap<String, Long> getStats(String MBean) throws Exception {
         return mrc.getStats(MBean);
     }
-    
+
     public void setSnapshotDuration(long duration) {
         mrc.setSnapshotDuration(new Long(duration));
     }
-    
+
     public long getSnapshotRetention() {
         return Long.parseLong(mrc.getSnapshotRetention());
     }
-    
+
     public void setSnapshotRetention(int duration) {
-        mrc.setSnapshotRetention( duration );
+        mrc.setSnapshotRetention(duration);
     }
 }

Modified: geronimo/server/trunk/applications/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp?rev=606930&r1=606929&r2=606930&view=diff
==============================================================================
--- geronimo/server/trunk/applications/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp (original)
+++ geronimo/server/trunk/applications/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp Wed Dec 26 10:35:36 2007
@@ -14,52 +14,52 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 --%>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
 <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
-<%@ page import="org.apache.geronimo.monitoring.console.StatsGraph" %>
-<%@ page import="org.apache.geronimo.monitoring.console.GraphsBuilder" %>
-<%@ page import="java.util.Set" %>
-<%@ page import="java.util.Iterator" %>
-<%@ page import="java.util.HashMap" %>
-<%@ page import="java.util.TreeMap" %>
-<%@ page import="java.util.ArrayList" %>
-<%@ page import="java.lang.String" %>
-<%@ page import="java.sql.Connection" %>
-<%@ page import="java.sql.DatabaseMetaData" %>
-<%@ page import="java.sql.PreparedStatement" %>
-<%@ page import="java.sql.ResultSet" %>
-<%@ page import="java.sql.SQLException" %>
-<%@ page import="org.apache.geronimo.monitoring.console.util.*" %>
-<%@ page import="org.apache.geronimo.monitoring.console.MRCConnector" %>
-<portlet:defineObjects/>
+<%@ page import="org.apache.geronimo.monitoring.console.StatsGraph"%>
+<%@ page import="org.apache.geronimo.monitoring.console.GraphsBuilder"%>
+<%@ page import="java.util.Set"%>
+<%@ page import="java.util.Iterator"%>
+<%@ page import="java.util.HashMap"%>
+<%@ page import="java.util.TreeMap"%>
+<%@ page import="java.util.ArrayList"%>
+<%@ page import="java.lang.String"%>
+<%@ page import="java.sql.Connection"%>
+<%@ page import="java.sql.DatabaseMetaData"%>
+<%@ page import="java.sql.PreparedStatement"%>
+<%@ page import="java.sql.ResultSet"%>
+<%@ page import="java.sql.SQLException"%>
+<%@ page import="org.apache.geronimo.monitoring.console.util.*"%>
+<%@ page import="org.apache.geronimo.monitoring.console.MRCConnector"%>
+<portlet:defineObjects />
 
 <%
-
-String message = (String) request.getAttribute("message");
-String mbean = (String) request.getAttribute("mbean");
-String dataname1 = (String) request.getAttribute("dataname");
-String server_id = (String) request.getAttribute("server_id");
-
-DBManager DBase = new DBManager();
-Connection con = DBase.getConnection();
-
-PreparedStatement pStmt = con.prepareStatement("SELECT * FROM servers WHERE enabled=1");
-ResultSet rs = pStmt.executeQuery();
-MRCConnector MRCConnection = null;
-ArrayList<String> serverIds = new ArrayList<String>();
-ArrayList<String> serverNames = new ArrayList<String>();
-
-if (message == null)
-    message = new String("");
-if (mbean == null)
-    mbean = new String("");
-if (dataname1 == null)
-    dataname1 = new String("");
-if (server_id == null)
-    server_id = new String("");
-
+            String message = (String) request.getAttribute("message");
+            String mbean = (String) request.getAttribute("mbean");
+            String dataname1 = (String) request.getAttribute("dataname");
+            String server_id = (String) request.getAttribute("server_id");
+
+            DBManager DBase = new DBManager();
+            Connection con = DBase.getConnection();
+
+            PreparedStatement pStmt = con
+                    .prepareStatement("SELECT * FROM servers WHERE enabled=1");
+            ResultSet rs = pStmt.executeQuery();
+            MRCConnector mrc = null;
+            ArrayList<String> serverIds = new ArrayList<String>();
+            ArrayList<String> serverNames = new ArrayList<String>();
+            Long snapshotDuration = 5L;
+
+            if (message == null)
+                message = new String("");
+            if (mbean == null)
+                mbean = new String("");
+            if (dataname1 == null)
+                dataname1 = new String("");
+            if (server_id == null)
+                server_id = new String("");
 %>
-<script type = "text/javascript">
+<script type="text/javascript">
 var serverBeans = new Array();
 var serverPrettyBeans = new Array();
 var serverBeanStatAttributes = new Array();
@@ -73,13 +73,14 @@
 {
     TreeMap <String,String> trackedBeansMap = null;
     try {
-        MRCConnection = new MRCConnector(       rs.getString("ip"), 
+        mrc = new MRCConnector(       rs.getString("ip"), 
                                                 rs.getString("username"), 
                                                 rs.getString("password"),
                                                 rs.getInt("port"));
-        trackedBeansMap = MRCConnection.getTrackedBeansMap();
+        trackedBeansMap = mrc.getTrackedBeansMap();
         serverIds.add(rs.getString("server_id"));
         serverNames.add(rs.getString("name") +" - "+rs.getString("ip"));
+        snapshotDuration = mrc.getSnapshotDuration();
         %>
         serverBeans[<%=rs.getString("server_id")%>] = new Array();
         serverPrettyBeans[<%=rs.getString("server_id")%>] = new Array();
@@ -89,7 +90,7 @@
         for (Iterator <String> it = trackedBeansMap.keySet().iterator(); it.hasNext();)
             {
                 String prettyBean = it.next().toString();
-                Set<String> statAttributes = MRCConnection.getStatAttributesOnMBean(trackedBeansMap.get(prettyBean));
+                Set<String> statAttributes = mrc.getStatAttributesOnMBean(trackedBeansMap.get(prettyBean));
                 %>
                 serverBeans[<%=rs.getString("server_id")%>][<%=i%>]="<%=trackedBeansMap.get(prettyBean)%>";
                 serverPrettyBeans[<%=rs.getString("server_id")%>][<%=i%>]="<%=prettyBean%>";
@@ -121,9 +122,9 @@
 </script>
 <!-- <head> -->
 
-    <style type='text/css'>
-    </style>
-    <script type = "text/javascript">
+<style type='text/css'>
+</style>
+<script type="text/javascript">
 <!--
 
 function hide(x) {
@@ -132,7 +133,7 @@
 function show(x) {
 document.getElementById(x).style.display='';
 }
-function validate() 
+function validate(duration) 
 {
    if (! (document.addGraph.name.value  
       && document.addGraph.dataname1.value
@@ -143,6 +144,11 @@
       alert("Server, Name, Data Series, MBean and Timeframe are all required fields");
       return false;
    }
+   // ensure that the timeframe is at least 2*(snapshotduration)
+   if(duration * 2 > document.addGraph.timeframe.value) {
+       alert("Snapshot Duration needs to be at least " + 2 * duration);
+       return false;
+   }
    if (document.addGraph.operation.value == 'other')
    {
        if (!document.addGraph.othermath.value)
@@ -405,34 +411,31 @@
 //-->
 </script>
 <!-- </head> -->
-            <%
- if (!message.equals(""))
- {
- %>
-<div align="left" style="width: 500px">
-<%=message %><br>
+<%
+if (!message.equals("")) {
+%>
+<div align="left" style="width: 500px"><%=message%><br>
 </div>
-<%} %>
+<%
+}
+%>
 <table>
-    <tr>
-        <!-- Body -->
-        <td width="90%" align="left" valign="top">
-            <p>
-            <font face="Verdana" size="+1">
-            Add a Graph
-            </font>
-            </p>         
-            <p>
-  <form onsubmit="return validate();" name="addGraph" method="POST" action="<portlet:actionURL portletMode="edit"><portlet:param name="action" value="saveAddGraph"/></portlet:actionURL>">
-  <table cellpadding="1" cellspacing="1">
-   <tr>
-      <td>Server:</td>
-      <td>&nbsp;</td>
-      <td align="right">
-    <select name="server_id" onChange="updateMbeanList(); updateFormula();">
-      <option value="">-Select Server-</option>
-    </select>    
-    <script type='text/javascript'>
+	<tr>
+		<!-- Body -->
+		<td width="90%" align="left" valign="top">
+		<p><font face="Verdana" size="+1"> Add a Graph </font></p>
+		<p>
+		<form onsubmit="return validate(<%=snapshotDuration/1000/60%>);"
+			name="addGraph" method="POST"
+			action="<portlet:actionURL portletMode="edit"><portlet:param name="action" value="saveAddGraph"/></portlet:actionURL>">
+		<table cellpadding="1" cellspacing="1">
+			<tr>
+				<td>Server:</td>
+				<td>&nbsp;</td>
+				<td align="right"><select name="server_id"
+					onChange="updateMbeanList(); updateFormula();">
+					<option value="">-Select Server-</option>
+				</select> <script type='text/javascript'>
     <% 
     for (int i = 1; i < serverIds.size()+1; i++)
     {
@@ -440,148 +443,159 @@
         document.addGraph.server_id.options[<%=i%>]=new Option("<%=serverNames.get(i-1)%>", "<%=serverIds.get(i-1)%>", <%if (server_id.equals(serverIds.get(i-1))){%>true<%}else{%>false<%}%>);
     <%
     }%>
-    </script>
-    </td>
-      <td></td>
-    </tr>
-    <tr>
-      <td>Name:</td>
-      <td>&nbsp;</td>
-      <td align="right"><input type="text" name="name" value=""></td>
-      <td></td>
-    </tr>
-    <tr>
-      <td>Description:</td>
-      <td>&nbsp;</td>
-      <td align="right"><textarea rows="5" cols="50" name="description"></textarea></td>
-      <td></td>
-    </tr>
-    <tr>
-      <td>X Axis label:</td>
-      <td>&nbsp;</td>
-      <td align="right"><input type="text" name="xlabel" value=""/></td>
-      <td></td>
-    </tr>
-    <tr>
-      <td>Y Axis label:</td>
-      <td>&nbsp;</td>
-      <td align="right"><input type="text" name="ylabel" value=""/></td>
-      <td></td>
-    </tr>
-    <tr>
-        <td>Timeframe:</td>
-        <td>&nbsp;</td>
-        <td align="right"><input type="text" width="5" size="4" name="timeframe" onKeyUp='noAlpha(this)' onKeyPress='noAlpha(this)' value="60"/></td>
-        <td> minutes</td>
-      </tr>
-    <tr>
-      <td>Mbean:</td>
-      <td>&nbsp;</td>
-      <td align="right">
-    <select name="mbean" onChange="updateDatanameList(); updateFormula();">
-      <option value="">-Select Server First-</option>
-    </select>
-    </td>
-      <td></td>
-    </tr>
-    <tr>
-      <td>Data series:</td>
-      <td>&nbsp;</td>
-      <td align="right">
-      <select name="data1operation" onchange="updateFormula();">
-        <option value="A" selected="selected">As-is</option>
-        <option value="D">Change (Delta) in</option>
-      </select>
-      <select name="dataname1" onchange="updateFormula();">
-        <option value="">-Select MBean First-</option>
-      </select>
-      </td>
-      <td></td>
-    </tr>
-    <tr>
-      <td>Math operation:</td>
-      <td>&nbsp;</td>
-        <td align="right">
-      <select name="operation" onChange="checkOtherMath(); updateFormula();">
-        <option value="" selected="selected">none</option>
-        <option value="+">+</option>
-        <option value="-">-</option>
-        <option value="*">*</option>
-        <option value="/">/</option>
-        <option value="other">Other</option>
-      </select>
-      </td>
-      <td><input type="text" style="display: none;" width="6" size="8" name="othermath" onKeyUp='noAlphaMath(this); updateFormula();' onKeyPress='noAlphaMath(this); updateFormula();' value=""/></td>
-    </tr>
-    <tr>
-      <td>Data series 2:</td>
-      <td>&nbsp;</td>
-      <td align="right">
-      <select name="data2operation" disabled="disabled" onchange="updateFormula();">
-        <option value="A" selected="selected">As-is</option>
-        <option value="D">Change (Delta) in</option>
-      </select>
-      <select name="dataname2" disabled="disabled" onchange="updateFormula(); checkNoData2();">
-        <option value="">-Select Operation First-</option>
-      </select>
-      <script type='text/javascript'>
+    </script></td>
+				<td></td>
+			</tr>
+			<tr>
+				<td>Name:</td>
+				<td>&nbsp;</td>
+				<td align="right"><input type="text" name="name" value=""></td>
+				<td></td>
+			</tr>
+			<tr>
+				<td>Description:</td>
+				<td>&nbsp;</td>
+				<td align="right"><textarea rows="5" cols="50"
+					name="description"></textarea></td>
+				<td></td>
+			</tr>
+			<tr>
+				<td>X Axis label:</td>
+				<td>&nbsp;</td>
+				<td align="right"><input type="text" name="xlabel" value="" /></td>
+				<td></td>
+			</tr>
+			<tr>
+				<td>Y Axis label:</td>
+				<td>&nbsp;</td>
+				<td align="right"><input type="text" name="ylabel" value="" /></td>
+				<td></td>
+			</tr>
+			<tr>
+				<td>Timeframe:</td>
+				<td>&nbsp;</td>
+				<td align="right"><input type="text" width="5" size="4"
+					name="timeframe" onKeyUp='noAlpha(this)' onKeyPress='noAlpha(this)'
+					value="60" /></td>
+				<td>minutes</td>
+			</tr>
+			<tr>
+				<td>Mbean:</td>
+				<td>&nbsp;</td>
+				<td align="right"><select name="mbean"
+					onChange="updateDatanameList(); updateFormula();">
+					<option value="">-Select Server First-</option>
+				</select></td>
+				<td></td>
+			</tr>
+			<tr>
+				<td>Data series:</td>
+				<td>&nbsp;</td>
+				<td align="right"><select name="data1operation"
+					onchange="updateFormula();">
+					<option value="A" selected="selected">As-is</option>
+					<option value="D">Change (Delta) in</option>
+				</select> <select name="dataname1" onchange="updateFormula();">
+					<option value="">-Select MBean First-</option>
+				</select></td>
+				<td></td>
+			</tr>
+			<tr>
+				<td>Math operation:</td>
+				<td>&nbsp;</td>
+				<td align="right"><select name="operation"
+					onChange="checkOtherMath(); updateFormula();">
+					<option value="" selected="selected">none</option>
+					<option value="+">+</option>
+					<option value="-">-</option>
+					<option value="*">*</option>
+					<option value="/">/</option>
+					<option value="other">Other</option>
+				</select></td>
+				<td><input type="text" style="display: none;" width="6"
+					size="8" name="othermath"
+					onKeyUp='noAlphaMath(this); updateFormula();'
+					onKeyPress='noAlphaMath(this); updateFormula();' value="" /></td>
+			</tr>
+			<tr>
+				<td>Data series 2:</td>
+				<td>&nbsp;</td>
+				<td align="right"><select name="data2operation"
+					disabled="disabled" onchange="updateFormula();">
+					<option value="A" selected="selected">As-is</option>
+					<option value="D">Change (Delta) in</option>
+				</select> <select name="dataname2" disabled="disabled"
+					onchange="updateFormula(); checkNoData2();">
+					<option value="">-Select Operation First-</option>
+				</select> <script type='text/javascript'>
         updateMbeanList();
-      </script>
-      </td>
-      <td></td>
-    </tr>
-    <tr>
-        <td></td>
-        <td>&nbsp;</td>
-        <td align="right">
-            <input type="checkbox" name="showArchive">Show Archived</input>
-        </td>
-        <td></td>
-    </tr>
-    <tr><td>Graphing: </td><td colspan="2"><strong><span id="formulaData1operation"></span> <span id="formulaDataname1"></span> <span id="formulaOperation"></span> <span id="formulaData2operation"></span> <span id="formulaDataname2"></span></strong></td></tr>
-    <tr><td colspan="3"><font size="-2">&nbsp;</font></td></tr>
-    <tr>
-      <td colspan="1" align="left"><button type="button" value="Cancel" onclick="javascript:history.go(-1)">Cancel</button></td>
-      <td>&nbsp;</td>
-      <td colspan="1" align="right"><input type="submit" value="Add" /></td>
-      <td></td>
-    </tr>
-  </table>
-  </form>
-            </p>
-      <script type='text/javascript'>
+      </script></td>
+				<td></td>
+			</tr>
+			<tr>
+				<td></td>
+				<td>&nbsp;</td>
+				<td align="right"><input type="checkbox" name="showArchive">Show
+				Archived</input></td>
+				<td></td>
+			</tr>
+			<tr>
+				<td>Graphing:</td>
+				<td colspan="2"><strong><span
+					id="formulaData1operation"></span> <span id="formulaDataname1"></span>
+				<span id="formulaOperation"></span> <span id="formulaData2operation"></span>
+				<span id="formulaDataname2"></span></strong></td>
+			</tr>
+			<tr>
+				<td colspan="3"><font size="-2">&nbsp;</font></td>
+			</tr>
+			<tr>
+				<td colspan="1" align="left">
+				<button type="button" value="Cancel"
+					onclick="javascript:history.go(-1)">Cancel</button>
+				</td>
+				<td>&nbsp;</td>
+				<td colspan="1" align="right"><input type="submit" value="Add" /></td>
+				<td></td>
+			</tr>
+		</table>
+		</form>
+		</p>
+		<script type='text/javascript'>
         updateFormula();
         checkNoData2();
-      </script>
-        </td>
-     
-         <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
-
-        <!-- Geronimo Links -->
-        <td valign="top">
-
-            <table width="100%" style="border-bottom: 1px solid #2581c7;" cellspacing="1" cellpadding="1">
-                <tr>
-                    <td class="DarkBackground" align="left" nowrap>
-                        <font face="Verdana" size="+1">Navigation</font>
-                    </td>
-                </tr>
-                <tr>
-                    <td bgcolor="#FFFFFF" nowrap>
-                        &nbsp;<br />
-                        <ul>
-                        <li><a href="<portlet:actionURL portletMode="view"><portlet:param name="action" value="showHome" /></portlet:actionURL>">Home</a></li>
-                        <li><a href="<portlet:actionURL portletMode="view"><portlet:param name="action" value="showAllViews" /></portlet:actionURL>">Views</a></li>
-                        <li><a href="<portlet:actionURL portletMode="view"><portlet:param name="action" value="showAllServers" /></portlet:actionURL>">Servers</a></li>
-                        <li><a href="<portlet:actionURL portletMode="view"><portlet:param name="action" value="showAllGraphs" /></portlet:actionURL>">Graphs</a></li>
-                        </ul>
-                        &nbsp;<br />
-                    </td>   
-                </tr>
-            </table>
-            
-        </td>        
-    </tr>
+      </script></td>
+
+		<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
+
+		<!-- Geronimo Links -->
+		<td valign="top">
+
+		<table width="100%" style="border-bottom: 1px solid #2581c7;"
+			cellspacing="1" cellpadding="1">
+			<tr>
+				<td class="DarkBackground" align="left" nowrap><font
+					face="Verdana" size="+1">Navigation</font></td>
+			</tr>
+			<tr>
+				<td bgcolor="#FFFFFF" nowrap>&nbsp;<br />
+				<ul>
+					<li><a
+						href="<portlet:actionURL portletMode="view"><portlet:param name="action" value="showHome" /></portlet:actionURL>">Home</a></li>
+					<li><a
+						href="<portlet:actionURL portletMode="view"><portlet:param name="action" value="showAllViews" /></portlet:actionURL>">Views</a></li>
+					<li><a
+						href="<portlet:actionURL portletMode="view"><portlet:param name="action" value="showAllServers" /></portlet:actionURL>">Servers</a></li>
+					<li><a
+						href="<portlet:actionURL portletMode="view"><portlet:param name="action" value="showAllGraphs" /></portlet:actionURL>">Graphs</a></li>
+				</ul>
+				&nbsp;<br />
+				</td>
+			</tr>
+		</table>
+
+		</td>
+	</tr>
 </table>
 
 

Modified: geronimo/server/trunk/applications/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditGraph.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditGraph.jsp?rev=606930&r1=606929&r2=606930&view=diff
==============================================================================
--- geronimo/server/trunk/applications/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditGraph.jsp (original)
+++ geronimo/server/trunk/applications/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditGraph.jsp Wed Dec 26 10:35:36 2007
@@ -73,13 +73,13 @@
     boolean archive = rs.getInt("archive") == 1 ? true : false;
     rs.close();
 
-pStmt = con.prepareStatement("SELECT * FROM servers WHERE enabled=1");
-rs = pStmt.executeQuery();
+    pStmt = con.prepareStatement("SELECT * FROM servers WHERE enabled=1");
+    rs = pStmt.executeQuery();
 
-MRCConnector MRCConnection = null;
+    MRCConnector MRCConnection = null;
 
-ArrayList<String> serverIds = new ArrayList<String>();
-ArrayList<String> serverNames = new ArrayList<String>();
+    ArrayList<String> serverIds = new ArrayList<String>();
+    ArrayList<String> serverNames = new ArrayList<String>();
 %>
 <script type = "text/javascript">
 var serverBeans = new Array();
@@ -95,13 +95,14 @@
 {
     TreeMap <String,String> trackedBeansMap = null;
     try {
-        MRCConnection = new MRCConnector(           rs.getString("ip"), 
+        mrc = new MRCConnector(           rs.getString("ip"), 
                                                     rs.getString("username"), 
                                                     rs.getString("password"),
                                                     rs.getInt("port"));
-        trackedBeansMap = MRCConnection.getTrackedBeansMap();
+        trackedBeansMap = mrc.getTrackedBeansMap();;
         serverIds.add(rs.getString("server_id"));
         serverNames.add(rs.getString("name") +" - "+rs.getString("ip"));
+        snapshotDuration = mrc.getSnapshotDuration();
         %>
         serverBeans[<%=rs.getString("server_id")%>] = new Array();
         serverPrettyBeans[<%=rs.getString("server_id")%>] = new Array();
@@ -111,8 +112,8 @@
         for (Iterator <String> it = trackedBeansMap.keySet().iterator(); it.hasNext();)
             {
                 String prettyBean = it.next().toString();
-                Set<String> statAttributes = MRCConnection.getStatAttributesOnMBean(trackedBeansMap.get(prettyBean));
-                %>
+                 Set<String> statAttributes = mrc.getStatAttributesOnMBean(trackedBeansMap.get(prettyBean));
+            %>
                 serverBeans[<%=rs.getString("server_id")%>][<%=i%>]="<%=trackedBeansMap.get(prettyBean)%>";
                 serverPrettyBeans[<%=rs.getString("server_id")%>][<%=i%>]="<%=prettyBean%>";
                 serverBeanStatAttributes[<%=rs.getString("server_id")%>][<%=i%>] = new Array();
@@ -155,7 +156,7 @@
 function show(x) {
 document.getElementById(x).style.display='';
 }
-function validate() 
+function validate(duration) 
 {
    if (! (document.editGraph.name.value  
       && document.editGraph.dataname1.value
@@ -166,6 +167,11 @@
       alert("Server, Name, Data Series, MBean and Timeframe are all required fields");
       return false;
    }
+   // ensure that the timeframe is at least 2*(snapshotduration)
+   if(duration * 2 > document.editGraph.timeframe.value) {
+        alert("Snapshot Duration needs to be at least " + 2 * duration);
+        return false;
+   }
    if (document.editGraph.operation.value == 'other')
    {
        if (!document.editGraph.othermath.value)
@@ -212,7 +218,7 @@
         }
         
     }
-       return;
+    return;
 }
 function noAlpha(obj){
     reg = /[^0-9]/g;
@@ -450,8 +456,8 @@
             </font>
             </p>         
             <p>
-  <form onsubmit="return validate();" name="editGraph" method="POST" action="<portlet:actionURL portletMode="edit"><portlet:param name="action" value="saveEditGraph"/></portlet:actionURL>">
-  <table cellpadding="1" cellspacing="1">
+   <form onsubmit="return validate(<%=snapshotDuration/1000/60%>);" name="editGraph" method="POST" action="<portlet:actionURL portletMode="edit"><portlet:param name="action" value="saveEditGraph"/></portlet:actionURL>">
+   <table cellpadding="1" cellspacing="1">
       <tr>
       <td>Added:</td>
       <td>&nbsp;</td>
@@ -691,7 +697,7 @@
                     </td>   
                 </tr>
             </table>
-			<br>
+            <br>
             <br>
             <table width="100%" style="border-bottom: 1px solid #2581c7;" cellspacing="1" cellpadding="1">
                 <tr>



Mime
View raw message