portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r1681628 - in /portals/jetspeed-2/applications/j2-admin/trunk: ./ src/main/java/org/apache/jetspeed/jetapp/ src/main/webapp/WEB-INF/ src/main/webapp/WEB-INF/view/cache/ src/main/webapp/jetapp/charts/ src/main/webapp/jetapp/charts/styles/ sr...
Date Mon, 25 May 2015 18:34:42 GMT
Author: taylor
Date: Mon May 25 18:34:41 2015
New Revision: 1681628

URL: http://svn.apache.org/r1681628
Log:
JS2-1320: completing chart portlets, improving chart data apis, integrating web resource optimization,
changed d3 donut back to pie chart, improved sizing of pie chart

Modified:
    portals/jetspeed-2/applications/j2-admin/trunk/pom.xml
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/jetapp/JetAppChartPortlet.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/jetapp/JetAppPortlet.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/cache/cacheMonitor.jsp
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/wro.xml
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/charts/chart-caches.html
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/charts/chart-memory.html
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/charts/chart-pages.html
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/charts/chart-users.html
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/charts/styles/styles.css
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/scripts/RestApiService.js
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/scripts/StatisticsRestServices.js
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/scripts/TextMessages.js
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/scripts/chartControllers.js
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/scripts/controllers.js
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/views/profiler-admin-edit.jsp
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/views/profiler-admin.jsp

Modified: portals/jetspeed-2/applications/j2-admin/trunk/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/pom.xml?rev=1681628&r1=1681627&r2=1681628&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/pom.xml (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/pom.xml Mon May 25 18:34:41 2015
@@ -473,7 +473,7 @@
           </execution>
         </executions>
         <configuration>
-          <targetGroups>J2_ADMIN_EXTERNAL_JS,J2_ADMIN_INTERNAL_JS</targetGroups>
+          <targetGroups>J2_ADMIN_CSS,J2_ADMIN_CHARTS_CSS,J2_ADMIN_EXTERNAL_JS,J2_ADMIN_INTERNAL_JS,J2_ADMIN_INTERNAL_CHARTS_JS</targetGroups>
           <minimize>false</minimize>
           <destinationFolder>${basedir}/target/${project.artifactId}-${project.version}/wro/</destinationFolder>
           <!--<cssDestinationFolder>d:/static/css/</cssDestinationFolder>-->

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/jetapp/JetAppChartPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/jetapp/JetAppChartPortlet.java?rev=1681628&r1=1681627&r2=1681628&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/jetapp/JetAppChartPortlet.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/jetapp/JetAppChartPortlet.java
Mon May 25 18:34:41 2015
@@ -5,12 +5,29 @@ import javax.portlet.RenderResponse;
 
 public class JetAppChartPortlet extends JetAppPortlet {
 
-    protected static String[][] DEV_STYLES = {
-            {"/jetapp/charts/styles/styles.css", "chart_styles"},
-            {"/jetapp/charts/styles/nv.d3.min.css", "chart_nvd3"}
+    protected static final String J2_ADMIN_CHARTS_CSS_ID = "j2admin_charts_css";
+    protected static final String J2_ADMIN_INTERNAL_CHARTS_SCRIPT_ID = "j2admin_charts_js";
+
+    // use merged and minified resources when releasing
+    public static final boolean DEV_MODE = false;
+
+    protected static String[][] CHART_PRODUCTION_STYLES = {
+            {"/wro/J2_ADMIN_CHARTS_CSS.css", J2_ADMIN_CHARTS_CSS_ID},
+    };
+
+    protected static String[][] CHART_DEV_STYLES = {
+            {"/jetapp/charts/styles/nv.d3.min.css", "chart_nvd3"},
+            {"/jetapp/charts/styles/styles.css", "chart_styles"}
+    };
+
+    protected static String[][] CHART_PRODUCTION_SCRIPTS = {
+            {"/wro/J2_ADMIN_EXTERNAL_JS.js", J2_ADMIN_EXTERNAL_SCRIPT_ID},
+            {"/wro/J2_ADMIN_INTERNAL_CHARTS_JS.js", J2_ADMIN_INTERNAL_CHARTS_SCRIPT_ID},
+            { "/jetapp/charts/scripts/d3.min.js", "chart_d3"},
+            { "/jetapp/charts/scripts/nv.d3.min.js", "chart_nvd3js"}
     };
 
-    protected static String[][] DEV_SCRIPTS = {
+    protected static String[][] CHART_DEV_SCRIPTS = {
 //            { "/jetapp/charts/scripts/jquery-2.1.3.min.js", "chart_jquery"},
             { "/wro/J2_ADMIN_EXTERNAL_JS.js", J2_ADMIN_EXTERNAL_SCRIPT_ID},
             { "/jetapp/scripts/TextMessages.js", "j2admin_text"},
@@ -39,8 +56,8 @@ public class JetAppChartPortlet extends
         if (alreadyContributedHeaders(request))
             return;
 
-        String[][] styles = (DEV_MODE) ? DEV_STYLES : PRODUCTION_STYLES;
-        String[][] scripts = (DEV_MODE) ? DEV_SCRIPTS : PRODUCTION_SCRIPTS;
+        String[][] styles = (DEV_MODE) ? CHART_DEV_STYLES : CHART_DEV_STYLES;
+        String[][] scripts = (DEV_MODE) ? CHART_DEV_SCRIPTS : CHART_PRODUCTION_SCRIPTS;
 
         for (String[] pair : styles) {
             addStyleLink(response, request.getContextPath() + pair[0], pair[1]);

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/jetapp/JetAppPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/jetapp/JetAppPortlet.java?rev=1681628&r1=1681627&r2=1681628&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/jetapp/JetAppPortlet.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/jetapp/JetAppPortlet.java
Mon May 25 18:34:41 2015
@@ -65,10 +65,12 @@ public class JetAppPortlet extends Gener
     protected static final String J2_ADMIN_EXTERNAL_SCRIPT_ID = "j2admin_ext_script";
     protected static final String J2_ADMIN_INTERNAL_SCRIPT_ID = "j2admin_int_script";
 
+    // use merged and minified resources when releasing
+    public static final boolean DEV_MODE = false;
+
     // Web Resources
     protected static String[][] PRODUCTION_STYLES = {
-            // {"/wro/J2_ADMIN_CSS.css", J2_ADMIN_CSS_ID},
-            {"/jetapp/j2-admin-skin.css", J2_ADMIN_CSS_ID}
+         {"/wro/J2_ADMIN_CSS.css", J2_ADMIN_CSS_ID},
     };
 
     protected static String[][] DEV_STYLES = {
@@ -97,10 +99,6 @@ public class JetAppPortlet extends Gener
     protected final static String PREFS_VIEW = "View";
     protected final static String PREFS_EDIT = "Edit";
 
-
-    // use merged and minified resources when releasing
-    public static final boolean DEV_MODE = true;
-    
     @Override
     public void init(PortletConfig config) throws PortletException {
         super.init(config);
@@ -150,7 +148,7 @@ public class JetAppPortlet extends Gener
         if (alreadyContributedHeaders(request))
             return;
 
-        String[][] styles = (DEV_MODE) ? DEV_STYLES : PRODUCTION_STYLES;
+        String[][] styles = (DEV_MODE) ? DEV_STYLES : DEV_STYLES;
         String[][] scripts = (DEV_MODE) ? DEV_SCRIPTS : PRODUCTION_SCRIPTS;
 
         for (String[] pair : styles) {

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/cache/cacheMonitor.jsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/cache/cacheMonitor.jsp?rev=1681628&r1=1681627&r2=1681628&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/cache/cacheMonitor.jsp
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/cache/cacheMonitor.jsp
Mon May 25 18:34:41 2015
@@ -15,13 +15,15 @@ See the License for the specific languag
 limitations under the License.
 
 --%>
-<%@page import="java.util.List"%>
-<%@page import="java.text.DecimalFormat"%>
-<%@page import="java.text.NumberFormat"%>
-<%@page import="org.apache.jetspeed.cache.JetspeedCacheMonitor"%>
-<%@page import="org.apache.jetspeed.cache.CacheMonitorState"%>
 <%@page import="org.apache.jetspeed.CommonPortletServices"%>
+<%@page import="org.apache.jetspeed.cache.CacheMonitorState"%>
+<%@page import="org.apache.jetspeed.cache.JetspeedCacheMonitor"%>
 <%@page import="org.apache.jetspeed.portlets.cache.CacheMonitorPortlet"%>
+<%@page import="java.text.DecimalFormat"%>
+<%@page import="java.text.NumberFormat"%>
+<%@ page import="java.util.Collections" %>
+<%@ page import="java.util.Comparator" %>
+<%@ page import="java.util.List" %>
 <%@ page contentType="text/html" %>
 <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
 <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
@@ -33,8 +35,14 @@ limitations under the License.
  	<%
  	JetspeedCacheMonitor cacheMonitor = (JetspeedCacheMonitor)portletConfig.getPortletContext().getAttribute(CommonPortletServices.CPS_CACHE_MONITOR);
  	List<CacheMonitorState> states = cacheMonitor.snapshotStatistics();
+    Comparator<CacheMonitorState> comparator = new Comparator<CacheMonitorState>()
{
+        public int compare(CacheMonitorState cm1, CacheMonitorState cm2) {
+            return cm1.getCacheName().compareTo(cm2.getCacheName());
+        }
+    };
+    Collections.sort(states, comparator);
   	%>
-<table style="border-collapse: collapse; width: 350px; margin-top: 8px; float: left;">
+<table style="border-collapse: collapse; margin-top: 8px; float: left;">
 	<tr>
 		<th class="portlet-section-header" colspan="17"><fmt:message key="cachemonitor.table.title"/></th>
 	</tr>
@@ -56,7 +64,7 @@ limitations under the License.
       <th class="portlet-section-subheader" style="text-align: right"><fmt:message
key="cachemonitor.label.inmemsize"/></th>
       <th class="portlet-section-subheader">&nbsp;</th>
       <th class="portlet-section-subheader">&nbsp;</th>
-      <th class="portlet-section-subheader">&nbsp;</thd>
+      <th class="portlet-section-subheader">&nbsp;</th>
      </tr>
 <%
 NumberFormat pf = new DecimalFormat("##0.000");

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/wro.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/wro.xml?rev=1681628&r1=1681627&r2=1681628&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/wro.xml (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/wro.xml Mon May
25 18:34:41 2015
@@ -1,16 +1,16 @@
 <groups xmlns="http://www.isdc.ro/wro">
 
 
-    <!--<group name="J2_ADMIN_CSS">-->
-        <!--<css>/jetapp/bower_components/html5-boilerplate/dist/css/normalize.css</css>-->
-        <!--<css>/jetapp/bower_components/html5-boilerplate/dist/css/main.css</css>-->
-        <!--<css>/jetapp/bower_components/bootstrap/dist/css/bootstrap.min.css</css>-->
-        <!--<css>/jetapp/bower_components/bootstrap/dist/css/bootstrap-theme.min.css</css>-->
-        <!--<css>/jetapp/styles/ng-grid.min.css</css>-->
-        <!--<css>/jetapp/styles/app.css</css>-->
-        <!--<css>/jetapp/styles/default.css</css>-->
-    <!--</group>-->
+    <group name="J2_ADMIN_CSS">
+        <css minimize="false">/jetapp/styles/ng-grid.min.css</css>
+        <css minimize="false">/jetapp/styles/app.css</css>
+        <css minimize="false">/jetapp/styles/default.css</css>
+    </group>
 
+    <group name="J2_ADMIN_CHARTS_CSS">
+        <css minimize="false">/jetapp/charts/styles/nv.d3.min.css</css>
+        <css minimize="false">/jetapp/charts/styles/styles.css</css>
+    </group>
 
     <group name="J2_ADMIN_EXTERNAL_JS">
         <!--<js minimize="false">/jetapp/bower_components/jquery.js</js>-->
@@ -26,7 +26,6 @@
         <js minimize="false">/jetapp/bower_components/ng-grid-flexible-height.js</js>
     </group>
 
-    <!-- TODO: minimize in production build -->
     <group name="J2_ADMIN_INTERNAL_JS">
         <js minimize="false">/jetapp/scripts/TextMessages.js</js>
         <js minimize="false">/jetapp/scripts/ServerService.js</js>
@@ -40,5 +39,30 @@
         <js minimize="false">/jetapp/scripts/filters.js</js>
     </group>
 
+    <group name="J2_ADMIN_INTERNAL_CHARTS_JS">
+        <js minimize="false">/jetapp/scripts/TextMessages.js</js>
+        <js minimize="false">/jetapp/scripts/ServerService.js</js>
+        <js minimize="false">/jetapp/scripts/RestApiService.js</js>
+        <js minimize="false">/jetapp/scripts/PortletService.js</js>
+        <js minimize="false">/jetapp/scripts/StatisticsRestServices.js</js>
+        <js minimize="false">/jetapp/app.js</js>
+        <js minimize="false">/jetapp/scripts/controllers.js</js>
+        <js minimize="false">/jetapp/scripts/chartControllers.js</js>
+        <js minimize="false">/jetapp/scripts/directives.js</js>
+        <js minimize="false">/jetapp/scripts/filters.js</js>
+        <!--<js minimize="false">/jetapp/charts/scripts/d3.min.js</js>-->
+        <!--<js minimize="false">/jetapp/charts/scripts/nv.d3.min.js"</js>-->
+    </group>
+
+    <!--<group name="J2_ADMIN_CSS">-->
+    <!--<css>/jetapp/bower_components/html5-boilerplate/dist/css/normalize.css</css>-->
+    <!--<css>/jetapp/bower_components/html5-boilerplate/dist/css/main.css</css>-->
+    <!--<css>/jetapp/bower_components/bootstrap/dist/css/bootstrap.min.css</css>-->
+    <!--<css>/jetapp/bower_components/bootstrap/dist/css/bootstrap-theme.min.css</css>-->
+    <!--<css>/jetapp/styles/ng-grid.min.css</css>-->
+    <!--<css>/jetapp/styles/app.css</css>-->
+    <!--<css>/jetapp/styles/default.css</css>-->
+    <!--</group>-->
+
 </groups>
 

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/charts/chart-caches.html
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/charts/chart-caches.html?rev=1681628&r1=1681627&r2=1681628&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/charts/chart-caches.html
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/charts/chart-caches.html
Mon May 25 18:34:41 2015
@@ -1,4 +1,10 @@
 <div ng-controller="CachesController" ng-init="init()">
+    <div class="form-group">
+        <div class="col-md-10 col-sm-10 padding-left0">
+            <alert ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)"><strong>{{alert.msg}}</strong></alert>
+        </div>
+        <br />
+    </div>
     <svg class="caches-container" height="225"></svg>
 </div>
 

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/charts/chart-memory.html
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/charts/chart-memory.html?rev=1681628&r1=1681627&r2=1681628&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/charts/chart-memory.html
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/charts/chart-memory.html
Mon May 25 18:34:41 2015
@@ -1,3 +1,9 @@
 <div ng-controller="MemoryController" ng-init="init()">
+    <div class="form-group">
+        <div class="col-md-10 col-sm-10 padding-left0">
+            <alert ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)"><strong>{{alert.msg}}</strong></alert>
+        </div>
+        <br />
+    </div>
     <svg class="memory-container" height="225"></svg>
 </div>
\ No newline at end of file

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/charts/chart-pages.html
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/charts/chart-pages.html?rev=1681628&r1=1681627&r2=1681628&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/charts/chart-pages.html
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/charts/chart-pages.html
Mon May 25 18:34:41 2015
@@ -1,3 +1,9 @@
 <div ng-controller="PagesController" ng-init="init()">
+    <div class="form-group">
+        <div class="col-md-10 col-sm-10 padding-left0">
+            <alert ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)"><strong>{{alert.msg}}</strong></alert>
+        </div>
+        <br />
+    </div>
     <svg class="pages-container" height="225"></svg>
 </div>

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/charts/chart-users.html
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/charts/chart-users.html?rev=1681628&r1=1681627&r2=1681628&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/charts/chart-users.html
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/charts/chart-users.html
Mon May 25 18:34:41 2015
@@ -1,3 +1,9 @@
 <div ng-controller="UsersController" ng-init="init()">
+    <div class="form-group">
+        <div class="col-md-10 col-sm-10 padding-left0">
+            <alert ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)"><strong>{{alert.msg}}</strong></alert>
+        </div>
+        <br />
+    </div>
   <svg class="users-container" height="225"></svg>
 </div>
\ No newline at end of file

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/charts/styles/styles.css
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/charts/styles/styles.css?rev=1681628&r1=1681627&r2=1681628&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/charts/styles/styles.css
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/charts/styles/styles.css
Mon May 25 18:34:41 2015
@@ -1,4 +1,4 @@
 .graph-container {
     width: 100%;
     height: 100%;
-}
\ No newline at end of file
+}

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/scripts/RestApiService.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/scripts/RestApiService.js?rev=1681628&r1=1681627&r2=1681628&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/scripts/RestApiService.js
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/scripts/RestApiService.js
Mon May 25 18:34:41 2015
@@ -38,10 +38,10 @@ var RestService = function ($http, $q, S
                 })
                 .error(function error(data, status) {
                     if (status == 404) {
-                        deferred.resolve(data, status);
+                        deferred.resolve(data, 404);
                     }
                     else {
-                        deferred.reject(data, status);
+                        deferred.reject(data, data.status);
                     }
                 });
             return deferred.promise;

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/scripts/StatisticsRestServices.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/scripts/StatisticsRestServices.js?rev=1681628&r1=1681627&r2=1681628&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/scripts/StatisticsRestServices.js
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/scripts/StatisticsRestServices.js
Mon May 25 18:34:41 2015
@@ -35,10 +35,10 @@ var StatisticsRestService = function ($h
                 })
                 .error(function error(data, status) {
                     if (status == 404) {
-                        deferred.resolve(data, status);
+                        deferred.resolve(data, 404);
                     }
                     else {
-                        deferred.reject(data, status);
+                        deferred.reject(data, data.status);
                     }
                 });
             return deferred.promise;

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/scripts/TextMessages.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/scripts/TextMessages.js?rev=1681628&r1=1681627&r2=1681628&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/scripts/TextMessages.js
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/scripts/TextMessages.js
Mon May 25 18:34:41 2015
@@ -4,8 +4,10 @@ var TextMessages = function () {
 
         messages_en: {
             notFound: 'Message not found',
+            unauthorized:
+                'We\'re sorry, but you don\'t seem to have access to the web component you
are requesting. Please ensure you are authorized. [Message: %s] [Status: %s]',
             serverFailure:
-                'We\'re sorry, but we had trouble contacting our Monitor server. Please contact
support for further assistance. Message: %s status: %s',
+                'We\'re sorry, but we had trouble contacting our Portal server. Please contact
support for further assistance. [Message: %s] [Status: %s]',
             serverSuccess: 'Server is up and running',
             serverFailed: 'Bad status. Status: %s',
             prefsUpdated: 'Your preferences have been updated.'

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/scripts/chartControllers.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/scripts/chartControllers.js?rev=1681628&r1=1681627&r2=1681628&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/scripts/chartControllers.js
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/scripts/chartControllers.js
Mon May 25 18:34:41 2015
@@ -42,36 +42,30 @@ function bytesToSize(bytes)
     return text;
 }
 
+function addFailureAlert(TextMessages, $scope, errorMessage, status) {
+    $scope.alerts.length = 0;
+    var statusMsg = (status === undefined) ? "none" : status;
+    var key = (status == 401) ? "unauthorized" : "serverFailure";
+    $scope.alerts.push({type: 'danger', msg: TextMessages.get(key, errorMessage, statusMsg)});
+};
+
+
 /* Controllers: */
 angular.module('j2admin.chartControllers', [])
 
     // -- Memory Usage Controller
-    .controller('MemoryController', function ($scope, $q, StatisticsService, PortletService)
{
+    .controller('MemoryController', function ($scope, $q, StatisticsService, PortletService,
TextMessages) {
         $scope.memoryUsage = [];
 
-        // -- init function
-        $scope.init = function () {
-
-            /* -- Possible future add of preferences handling. Should be included for each
.controller
-            $scope.readResourceURL = readResourceURL;
-            PortletService.lookupPreferences(readResourceURL).then(
-                function success(prefs, status) {
-                    $scope.prefs = prefs;
-                    //$scope.perPage = prefs.rowsPerPage;
-                    // $scope.columnDefs[1].displayName = (!!~prefs.service.indexOf('cpu'))
? "CPU %" : "Memory %";
-                    $scope.getData();
+        $scope.alerts = [];
+        $scope.closeAlert = function (index) {
+            $scope.alerts = [];
+        };
+        $scope.addFailureAlert = function (errorMessage, status) {
+            addFailureAlert(TextMessages, $scope, errorMessage, status);
+        };
 
-                    if ($scope.initialized == false) {
-                        //$interval(refresh, $scope.prefs.refreshSeconds * 1000);
-                    }
-
-                    $scope.initialized = true;
-                },
-                function error(msg, status) {
-                    console.log(msg);
-                    $scope.addFailureAlert(msg, status);
-                }
-            ); */
+        $scope.init = function () {
 
             // -- retrieve runtime memory usage
             StatisticsService.memoryUsage().then(
@@ -86,16 +80,19 @@ angular.module('j2admin.chartControllers
                         var chart = nv.models.pieChart()
                             .x(function(d) { return (d.label + ": " + bytesToSize(d.value)
+ " (" + (d.value / $scope.memoryUsage.memory.total * 100).toFixed(1) + "%)" ) })    //Specify
the data accessors.
                             .y(function(d) { return d.value })
-                            .tooltips(false)
-                            .donut(true)
+                            .tooltips(true)
+                            .donut(false)
                             .donutRatio(0.4)
-                            .showLabels(true)
+                            .showLabels(false)
                             .donutLabelsOutside(true)
-                            .showLegend(false)
+                            .showLegend(true)
                             .duration(500);
 
+
                         d3.select(".memory-container")
                             .datum(datum)
+                            .attr("width", 960)
+                            .attr("height", 500)
                             .call(chart);
 
                         nv.utils.windowResize(chart.update);
@@ -116,8 +113,8 @@ angular.module('j2admin.chartControllers
                     })
                 },
                 function error(msg, status) {
-                    console.log(msg);
-                    $scope.addFailureAlert(msg, status);
+                    console.log(msg.message);
+                    $scope.addFailureAlert(msg.message, msg.status);
                 }
             )
         }
@@ -125,9 +122,17 @@ angular.module('j2admin.chartControllers
 )
 
     //-- Page Usage Controller
-    .controller('PagesController', function ($scope, $q, StatisticsService, PortletService)
{
+    .controller('PagesController', function ($scope, $q, StatisticsService, PortletService,
TextMessages) {
         $scope.pageHits = [];
 
+        $scope.alerts = [];
+        $scope.closeAlert = function (index) {
+            $scope.alerts = [];
+        };
+        $scope.addFailureAlert = function (errorMessage, status) {
+            addFailureAlert(TextMessages, $scope, errorMessage, status);
+        };
+
         // ---- init function
         $scope.init = function () {
 
@@ -185,7 +190,7 @@ angular.module('j2admin.chartControllers
                 },
                 function error(msg, status) {
                     console.log(msg);
-                    $scope.addFailureAlert(msg, status);
+                    $scope.addFailureAlert(msg.message, msg.status);
                 }
             )
         }
@@ -193,9 +198,17 @@ angular.module('j2admin.chartControllers
 )
 
     //-- User Sessions Usage Controller
-    .controller('UsersController', function ($scope, $q, StatisticsService, PortletService)
{
+    .controller('UsersController', function ($scope, $q, StatisticsService, PortletService,
TextMessages) {
         $scope.sessions = [];
 
+        $scope.alerts = [];
+        $scope.closeAlert = function (index) {
+            $scope.alerts = [];
+        };
+        $scope.addFailureAlert = function (errorMessage, status) {
+            addFailureAlert(TextMessages, $scope, errorMessage, status);
+        };
+
         // -- init function
         $scope.init = function () {
 
@@ -236,7 +249,7 @@ angular.module('j2admin.chartControllers
                 },
                 function error(msg, status) {
                     console.log(msg);
-                    $scope.addFailureAlert(msg, status);
+                    $scope.addFailureAlert(msg.message, msg.status);
                 }
             )
         }
@@ -244,9 +257,17 @@ angular.module('j2admin.chartControllers
 )
 
     //-- Top Caches Usage Controller
-    .controller('CachesController', function ($scope, $q, StatisticsService, PortletService)
{
+    .controller('CachesController', function ($scope, $q, StatisticsService, PortletService,
TextMessages) {
         $scope.cacheStats = [];
 
+        $scope.alerts = [];
+        $scope.closeAlert = function (index) {
+            $scope.alerts = [];
+        };
+        $scope.addFailureAlert = function (errorMessage, status) {
+            addFailureAlert(TextMessages, $scope, errorMessage, status);
+        };
+
         // -- init function
         $scope.init = function () {
 
@@ -295,7 +316,7 @@ angular.module('j2admin.chartControllers
                 },
                 function error(msg, status) {
                     console.log(msg);
-                    $scope.addFailureAlert(msg, status);
+                    $scope.addFailureAlert(msg.message, msg.status);
                 }
             )
         }

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/scripts/controllers.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/scripts/controllers.js?rev=1681628&r1=1681627&r2=1681628&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/scripts/controllers.js
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/scripts/controllers.js
Mon May 25 18:34:41 2015
@@ -1,5 +1,12 @@
 'use strict';
 
+function addFailureAlert(TextMessages, $scope, errorMessage, status) {
+    $scope.alerts.length = 0;
+    var statusMsg = (status === undefined) ? "none" : status;
+    var key = (status == 401) ? "unauthorized" : "serverFailure";
+    $scope.alerts.push({type: 'danger', msg: TextMessages.get(key, errorMessage, statusMsg)});
+};
+
 /* Controllers: */
 angular.module('j2admin.controllers', [])
     .controller('ProfilerController', function ($scope, $q, $interval, $log, $modal, DataService,
TextMessages, PortletService) {
@@ -39,15 +46,11 @@ angular.module('j2admin.controllers', []
         $scope.initialized = false;
 
         $scope.alerts = [];
-
         $scope.closeAlert = function (index) {
             $scope.alerts = [];
         };
-
         $scope.addFailureAlert = function (errorMessage, status) {
-            $scope.alerts.length = 0;
-            var statusMsg = (status === undefined) ? "none" : status;
-            $scope.alerts.push({type: 'danger', msg: TextMessages.get('serverFailure', errorMessage,
statusMsg)});
+            addFailureAlert(TextMessages, $scope, errorMessage, status);
         };
 
         // ---- init function
@@ -68,8 +71,8 @@ angular.module('j2admin.controllers', []
                     $scope.initialized = true;
                 },
                 function error(msg, status) {
-                    console.log(msg);
-                    $scope.addFailureAlert(msg, status);
+                    console.log(msg.message);
+                    $scope.addFailureAlert(msg.message, msg.status);
                 }
             );
         }; // end init
@@ -91,8 +94,8 @@ angular.module('j2admin.controllers', []
                     $scope.getPage();
                 },
                 function error(msg, status) {
-                    console.log(msg);
-                    $scope.addFailureAlert(msg, status);
+                    console.log(msg.message);
+                    $scope.addFailureAlert(msg.message, msg.status);
                 }
             )
         }; // end getPage
@@ -197,9 +200,21 @@ angular.module('j2admin.controllers', []
         };
     }
 )
-    .controller('ProfilerEditController', function ($scope, DataService, PortletService)
{
+    .controller('ProfilerEditController', function ($scope, DataService, PortletService,
TextMessages) {
         $scope.master = {};
 
+        $scope.alerts = [];
+        $scope.closeAlert = function (index) {
+            $scope.alerts = [];
+        };
+        $scope.addFailureAlert = function (errorMessage, status) {
+            addFailureAlert(TextMessages, $scope, errorMessage, status);
+        };
+        $scope.addSuccessAlert = function () {
+            $scope.alerts.length = 0;
+            $scope.alerts.push({type: 'success', msg: TextMessages.get('prefsUpdated') });
+        };
+
         $scope.init = function (readResourceURL, writeResourceURL, renderURL) {
             $scope.readResourceURL = readResourceURL;
             $scope.writeResourceURL = writeResourceURL;
@@ -211,8 +226,8 @@ angular.module('j2admin.controllers', []
                     //$scope.profileEditForm.$setPristine();
                 },
                 function error(msg, status) {
-                    console.log(msg);
-                    $scope.addFailureAlert(msg, status);
+                    console.log(msg.message);
+                    $scope.addFailureAlert(msg.message, msg.status);
                 }
             )
         };
@@ -221,10 +236,11 @@ angular.module('j2admin.controllers', []
             PortletService.storePreferences($scope.writeResourceURL, prefs).then(
                 function success(result, status) {
                     //window.location = $scope.renderURL;
+                    $scope.addSuccessAlert();
                 },
                 function error(msg, status) {
-                    console.log(msg);
-                    $scope.addFailureAlert(msg, status);
+                    console.log(msg.message);
+                    $scope.addFailureAlert(msg.message, msg.status);
                 }
             )
         };
@@ -243,24 +259,6 @@ angular.module('j2admin.controllers', []
             return angular.equals(prefs, $scope.master);
         };
 
-        $scope.alerts = [
-        ];
-
-        $scope.closeAlert = function (index) {
-            $scope.alerts = [];
-        };
-
-        $scope.addFailureAlert = function (errorMessage, status) {
-            $scope.alerts.length = 0;
-            var statusMsg = (status === undefined) ? "none" : status;
-            $scope.alerts.push({type: 'danger', msg: TextMessages.get('serverFailure', errorMessage,
statusMsg) });
-        };
-
-        $scope.addSuccessAlert = function () {
-            $scope.alerts.length = 0;
-            $scope.alerts.push({type: 'success', msg: TextMessages.get('PrefsUpdated') });
-        };
-
         $scope.reset();
     });
 
@@ -311,9 +309,9 @@ var ProfileDetailsInstanceController = f
             function success(result) {
                 $scope.profile = result;
             },
-            function error(message) {
-                console.log(message);
-                $scope.addFailureAlert(message);
+            function error(msg) {
+                console.log(msg.message);
+                $scope.addFailureAlert(msg.message, msg.status);
             });
     }
 
@@ -334,40 +332,30 @@ var ProfileDetailsInstanceController = f
     };
 
     $scope.alerts = [];
+    $scope.addFailureAlert = function (errorMessage, status) {
+        addFailureAlert(TextMessages, $scope, errorMessage, status);
+    };
+    $scope.closeAlert = function(index) {
+        $scope.alerts.splice(index, 1);
+    };
 
     $scope.hasAlias = function(alias) {
         return ($scope.hostIdentity.hostNames.indexOf(alias) !== -1);
     };
 
-    //$scope.addAlias = function(alias) {
-    //    $scope.hostIdentity.hostNames.push('');
-    //};
-    //
-    //$scope.removeAlias = function(index) {
-    //    $scope.hostIdentity.hostNames.splice(index, 1);
-    //};
-
     $scope.add = function() {
-        //var names = $scope.hostIdentity.hostNames;
-        //
-        //for(var i = 0; i < names.length; i++) {
-        //    if(!names[i].length) {
-        //        names.splice(i, 1);
-        //        i--;
-        //    }
-        //}
 
         DataService.createOrUpdateProfile($scope.profile).then(
             function success(entity) {
                 $modalInstance.close();
             },
-            function error(message) {
+            function error(msg) {
+                var message = msg.message;
                 if(message.indexOf('ConstraintViolationException') != -1) {
                     message = 'This profile is likely to exist already - please choose another
name.';
                 }
-
                 console.log(message);
-                $scope.addFailureAlert(message);
+                $scope.addFailureAlert(msg.message, msg.status);
             });
     };
 
@@ -402,19 +390,19 @@ var ProfileDetailsInstanceController = f
         $modalInstance.dismiss();
     };
 
-    $scope.addFailureAlert = function(message) {
-        $scope.alerts.length = 0;
-        $scope.alerts.push({type: 'danger', msg: message});
-    };
-
-    $scope.closeAlert = function(index) {
-        $scope.alerts.splice(index, 1);
-    };
 };
 ProfileDetailsInstanceController.$inject = ['$scope', '$modal', '$modalInstance', '$log',
'DataService', 'profile', 'parentScope', 'existing', 'existingIds'];
 
 var DeleteProfilesInstanceController = function ($scope, $modalInstance, DataService, selectedItems)
{
 
+    $scope.alerts = [];
+    $scope.addFailureAlert = function (errorMessage, status) {
+        addFailureAlert(TextMessages, $scope, errorMessage, status);
+    };
+    $scope.closeAlert = function(index) {
+        $scope.alerts.splice(index, 1);
+    };
+
     $scope.deleteItems = function() {
         var ids = [];
 
@@ -426,8 +414,8 @@ var DeleteProfilesInstanceController = f
             function success(data) {
                 $modalInstance.close();
             },
-            function failures(message, status) {
-                $scope.addFailureAlert(message);
+            function failures(msg, status) {
+                $scope.addFailureAlert(msg.message, msg.status);
             });
     };
 

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/views/profiler-admin-edit.jsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/views/profiler-admin-edit.jsp?rev=1681628&r1=1681627&r2=1681628&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/views/profiler-admin-edit.jsp
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/views/profiler-admin-edit.jsp
Mon May 25 18:34:41 2015
@@ -24,7 +24,7 @@
 
             <%--<button  class="btn btn-primary" ng-click="update(prefs)" ng-disabled="profileEditForm.$invalid
|| isUnchanged(prefs)" tabindex='6'>Submit</button>--%>
             <button  class="btn btn-primary" ng-click="update(prefs)" ng-disabled="!prefs.rowsPerPage"
tabindex='6'>Submit</button>
-            <alert ng-repeat="alert in alerts" type="alert.type" close="closeAlert($index)">{{alert.msg}}</alert>
+            <alert ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)">{{alert.msg}}</alert>
             <pre ng-bind =" contact | json" ng-hide="!debug"> </pre>
 
         </form>

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/views/profiler-admin.jsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/views/profiler-admin.jsp?rev=1681628&r1=1681627&r2=1681628&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/views/profiler-admin.jsp
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/jetapp/views/profiler-admin.jsp
Mon May 25 18:34:41 2015
@@ -5,6 +5,13 @@
 <portlet:resourceURL var="readPrefs" id="readPrefs" escapeXml="false" />
 
 <div ng-controller="ProfilerController" ng-init="init('<%=renderResponse.encodeURL(readPrefs.toString())%>')">
+    <div class="form-group">
+        <div class="col-md-10 col-sm-10 padding-left0">
+            <alert ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)"><strong>{{alert.msg}}</strong></alert>
+        </div>
+        <br />
+    </div>
+
     <div class="row no-margin">
 
         <div class="col-sm-9 col-md-9 col-lg-9">



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message