Skip to content

Commit

Permalink
Introduced option to select dashboard implementation in opennms.prope…
Browse files Browse the repository at this point in the history
…rties
  • Loading branch information
christianpape committed Apr 20, 2015
1 parent 9735739 commit 62dd65b
Show file tree
Hide file tree
Showing 6 changed files with 232 additions and 169 deletions.
10 changes: 10 additions & 0 deletions opennms-base-assembly/src/main/filtered/etc/opennms.properties
Expand Up @@ -598,3 +598,13 @@ org.opennms.jasperReportsVersion=5.6.1
# even if none of the problematic services appears in any package. If you create custom
# services, you may need to add them to this list.
excludeServiceMonitorsFromRemotePoller=DHCP,NSClient,RadiusAuth,XMP

# ###### DASHBOARD/SURVEILLANCE VIEW IMPLEMENTATION ######
# OpenNMS provides two different dashboard/surveillance view implementations. The GWT
# variant is the original. Later, the UI was rewitten using the VAADIN framework. So, the
# two valid options fpr this option are 'vaadin' or 'gwt'. The VAADIN implementation is
# the default one. Please note that the GWT version is deprecated and will be removed in
# future versions.
#org.opennms.dashboard.implementation=gwt


11 changes: 0 additions & 11 deletions opennms-webapp/src/main/webapp/WEB-INF/dispatcher-servlet.xml
Expand Up @@ -346,11 +346,6 @@
<property name="url" value="dashboards.htm" />
<property name="entries">
<list>
<bean class="org.opennms.web.navigate.LocationBasedNavBarEntry">
<property name="name" value="Legacy Dashboard"/>
<property name="url" value="legacy-dashboard.jsp"/>
<property name="locationMatch" value="legacy-dashboard"/>
</bean>
<bean class="org.opennms.web.navigate.LocationBasedNavBarEntry">
<property name="name" value="Dashboard"/>
<property name="url" value="dashboard.jsp"/>
Expand Down Expand Up @@ -428,12 +423,6 @@
<property name="url" value="outage/index.jsp"/>
<property name="locationMatch" value="outage"/>
</bean>
<bean class="org.opennms.web.navigate.SurveillanceViewNavBarEntry">
<property name="name" value="Legacy Surveillance"/>
<property name="url" value=""/>
<property name="locationMatch" value="surveillance"/>
<property name="surveillanceViewConfigDao" ref="surveillanceViewConfigDao"/>
</bean>
<bean class="org.opennms.web.navigate.LocationBasedNavBarEntry">
<property name="name" value="Surveillance"/>
<property name="url" value="surveillance-view.jsp"/>
Expand Down
125 changes: 107 additions & 18 deletions opennms-webapp/src/main/webapp/dashboard.jsp
Expand Up @@ -29,27 +29,116 @@
--%>

<%@page language="java"
contentType="text/html"
session="true"
%>

<jsp:include page="/includes/bootstrap.jsp" flush="false" >
<jsp:param name="title" value="Vaadin Surveillance Views" />
<jsp:param name="headTitle" value="Vaadin Surveillance Views" />
<jsp:param name="location" value="surveillance-view" />
<jsp:param name="vaadinEmbeddedStyles" value="true" />
<jsp:param name="breadcrumb" value="Vaadin Surveillance Dashboard" />
</jsp:include>
<%@page language="java" contentType="text/html" session="true" %>

<%--
/*******************************************************************************
* Check org.opennms.dashboard.implementation for selected implementation *
*******************************************************************************/
--%>

<%
String viewName = "";
String dashboardImplementation = System.getProperty("org.opennms.dashboard.implementation", "vaadin").trim();
if (request.getParameterMap().containsKey("viewName")) {
viewName = "&viewName=" + request.getParameter("viewName");
}
if (!"gwt".equals(dashboardImplementation)) {
%>

<iframe id="surveillance-view-ui" src="osgi/vaadin-surveillance-views?dashboard=true<%= viewName %>" frameborder="0" style="height:100%; width:100%;"></iframe>
<jsp:include page="/includes/bootstrap-footer.jsp" flush="true"/>
<%--
/*******************************************************************************
* Include VAADIN implementation *
*******************************************************************************/
--%>

<jsp:include page="/includes/bootstrap.jsp" flush="false" >
<jsp:param name="title" value="Dashboard" />
<jsp:param name="headTitle" value="Dashboard" />
<jsp:param name="location" value="dashboard" />
<jsp:param name="vaadinEmbeddedStyles" value="true" />
<jsp:param name="breadcrumb" value="Dashboard" />
</jsp:include>

<%
String viewName = "";
if (request.getParameterMap().containsKey("viewName")) {
viewName = "&viewName=" + request.getParameter("viewName");
}
%>

<iframe id="surveillance-view-ui" src="osgi/vaadin-surveillance-views?dashboard=true<%= viewName %>" frameborder="0" style="height:100%; width:100%;"></iframe>

<jsp:include page="/includes/bootstrap-footer.jsp" flush="true"/>

<% } else { %>

<%--
/*******************************************************************************
* Include GWT implementation *
*******************************************************************************/
--%>

<jsp:include page="/includes/bootstrap.jsp" flush="false">
<jsp:param name="title" value="Dashboard" />
<jsp:param name="headTitle" value="Dashboard" />
<jsp:param name="location" value="dashboard" />
<jsp:param name="breadcrumb" value="Dashboard" />
<jsp:param name="meta">
<jsp:attribute name="value">
<meta name='gwt:module' content='org.opennms.dashboard.Dashboard' />
</jsp:attribute>
</jsp:param>
<jsp:param name="meta">
<jsp:attribute name="value">
<link media="screen" href="css/dashboard.css" type="text/css" rel="stylesheet">
</jsp:attribute>
</jsp:param>

</jsp:include>

<script type="text/javascript" src='dashboard/dashboard.nocache.js'></script>

<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-md-12">
<div class="dashletCell"id="surveillanceView"></div>
</div>
</div>

<div class="row">
<div class="col-md-12">
<div class="dashletCell" id="alarms"></div>
</div>
</div>

<div class="row">
<div class="col-md-12">
<div class="dashletCell" id="notifications"></div>
</div>
</div>

<div class="row">
<div class="col-md-12">
<div class="dashletCell" id="nodeStatus"></div>
</div>
</div>

<div class="row">
<div class="col-md-12">
<div class="dashletCell" id="graphs"></div>
</div>
</div>

<div class="row">
<div class="col-md-12">
<div class="dashletCell" id="outages"></div>
</div>
</div>
</div>
</div>

<jsp:include page="/includes/bootstrap-footer.jsp" flush="false" />

<% } %>


92 changes: 0 additions & 92 deletions opennms-webapp/src/main/webapp/legacy-dashboard.jsp

This file was deleted.

94 changes: 64 additions & 30 deletions opennms-webapp/src/main/webapp/surveillance-box.jsp
Expand Up @@ -29,49 +29,83 @@
--%>

<%@page language="java"
contentType="text/html"
session="true"
%>
<%@page language="java" contentType="text/html" session="true" %>

<%--
/*******************************************************************************
* Check org.opennms.dashboard.implementation for selected implementation *
*******************************************************************************/
--%>

<%
String viewName = "";
String dashboardImplementation = System.getProperty("org.opennms.dashboard.implementation", "vaadin").trim();
if (request.getParameterMap().containsKey("viewName")) {
viewName = "&viewName=" + request.getParameter("viewName");
}
if (!"gwt".equals(dashboardImplementation)) {
%>

<script type="text/javascript">
<%--
/*******************************************************************************
* Include VAADIN implementation *
*******************************************************************************/
--%>

<%
String viewName = "";
if (request.getParameterMap().containsKey("viewName")) {
viewName = "&viewName=" + request.getParameter("viewName");
}
%>

<script type="text/javascript">
var isInitialized = false;
var checkInterval = setInterval(checkIframe, 1000);
function checkIframe(){
var isInitialized = false;
var checkInterval = setInterval(checkIframe, 1000);
var iframe = document.getElementById("surveillance-iframe");
function checkIframe(){
iframe.contentWindow.postMessage("test", window.location.origin);
if(isInitialized){
clearInterval(checkInterval);
}
}
var iframe = document.getElementById("surveillance-iframe");
function receiveMessage(event){
isInitialized = true;
if(event.origin !== window.location.origin)
return;
iframe.contentWindow.postMessage("test", window.location.origin);
if(isInitialized){
clearInterval(checkInterval);
}
}
var elem = document.getElementById("surveillance-view");
elem.style.height = event.data;
}
function receiveMessage(event){
isInitialized = true;
if(event.origin !== window.location.origin)
return;
window.addEventListener("message", receiveMessage, false);
var elem = document.getElementById("surveillance-view");
elem.style.height = event.data;
</script>

}
<div id="surveillance-view">
<iframe id="surveillance-iframe" src="osgi/vaadin-surveillance-views?dashboard=false<%= viewName %>" frameborder="0" style="min-height:100%; min-width:100%;"></iframe>
</div>

window.addEventListener("message", receiveMessage, false);
<% } else { %>

</script>
<%--
/*******************************************************************************
* Include GWT implementation *
*******************************************************************************/
--%>

<div id="surveillance-view">
<meta name='gwt:module' content='org.opennms.dashboard.Dashboard' />
<link media="screen" href="css/dashboard.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src='dashboard/dashboard.nocache.js'></script>
<table class="dashboard" cellspacing="5" width="100%">
<tbody>
<tr>
<td class="dashletCell"id="surveillanceView"></td>
</tr>
</tbody>
</table>

<iframe id="surveillance-iframe" src="osgi/vaadin-surveillance-views?dashboard=false<%= viewName %>" frameborder="0" style="min-height:100%; min-width:100%;"></iframe>
</div>
<% } %>

0 comments on commit 62dd65b

Please sign in to comment.