Permalink
Browse files

upgraded to 1.2.0.RC1 and made the graph work

  • Loading branch information...
1 parent a820a55 commit 78401545dab00fd214e3fa9aa1628cf6643a7dc1 @jettro committed Dec 7, 2009
View
@@ -1,10 +1,11 @@
#Grails Metadata file
-#Fri Dec 04 08:26:37 CET 2009
-app.grails.version=1.2-M4
+#Mon Dec 07 19:41:11 CET 2009
+app.grails.version=1.2.0.RC1
app.name=myserverpark
app.servlet.version=2.4
app.version=0.2
plugins.db-util=0.4
-plugins.hibernate=1.2-M4
+plugins.google-chart=0.5.1
+plugins.hibernate=1.2.0.RC1
plugins.joda-time=0.5
-plugins.tomcat=1.2-M4
+plugins.tomcat=1.2.0.RC1
@@ -1,11 +1,9 @@
import org.joda.time.DateTime
class BootStrap {
- def init = {
- servletContext ->
- def statussus = ['OK', 'WARNING', 'PROBLEM', 'COLD']
- statussus.each {
- statusName ->
+ def init = { servletContext ->
+ def statussus = ['OK', 'WARNING', 'PROBLEM', 'COLD']
+ statussus.each { statusName ->
def newStatus = new Status(name: statusName)
newStatus.save()
}
@@ -33,6 +31,19 @@ class BootStrap {
def devEnvironment = Environment.findByName("Development")
devEnvironment.addToServers(backend1)
+ devEnvironment.save(flush:true)
+
+ def now = new DateTime()
+
+ def comments = [['comment now','this is a comment from now',now,backend1],
+ ['comment now 2','this is a comment from now too',now,backend1],
+ ['comment from past','this is a comment from the past',now.minusDays(4),backend1],
+ ['comment yesterday','this is a comment from yesterday',now.minusDays(1),backend1],
+ ['comment old','this is an old comment',now.minusDays(20),backend1]]
+ comments.each {name, content, dateCreated, server ->
+ def comment = new Comment(name:name,content:content,server:server)
+ comment.save()
+ }
}
def destroy = {
}
@@ -7,13 +7,13 @@ dataSource {
hibernate {
cache.use_second_level_cache=true
cache.use_query_cache=true
- cache.provider_class='com.opensymphony.oscache.hibernate.OSCacheProvider'
+ cache.provider_class='net.sf.ehcache.hibernate.EhCacheProvider'
}
// environment specific settings
environments {
development {
dataSource {
- dbCreate = "create-drop" // one of 'create', 'create-drop','update'
+ dbCreate = "update" // one of 'create', 'create-drop','update'
url = "jdbc:hsqldb:mem:devDB"
}
}
@@ -6,6 +6,15 @@ class CommentController {
def stats = {
def comments = Comment.findAllByDateCreatedGreaterThan((new DateTime()).minusDays(7))
- [comments:comments]
+ def commentData = [:]
+ comments.each {comment ->
+ def serverName = comment.server.name
+ if (commentData[serverName]) {
+ commentData[serverName]++
+ } else {
+ commentData[serverName] = 1
+ }
+ }
+ return [commentData:commentData]
}
}
@@ -4,17 +4,18 @@
<title>Simple GSP page</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="layout" content="main"/>
- <g:javascript>
- function addComment(e,divId) {
- $(divId).value = e.responseText;
- window.alert($(divId).value);
- }
- </g:javascript>
-
</head>
<body>
- <g:each in="${comments}" var="comment">
- ${comment.name}<br/>
- </g:each>
+<div class="nav">
+ <span class="menuButton"><a class="home" href="${resource(dir: '')}">Home</a></span>
+ <span class="menuButton"><g:link controller="environment">Environments</g:link></span>
+ <span class="menuButton"><g:link controller="server">Servers</g:link></span>
+ <span class="menuButton"><g:link controller="vlan">Vlans</g:link></span>
+</div>
+
+ ${commentData.keySet()}<br/>
+
+<g:pieChart title="Comments per server" type="3d" size="${[600,200]}"
+ labels="${commentData.keySet()}" dataType='text' data='${commentData.values().asList()}'/>
</body>
</html>
@@ -16,11 +16,6 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schem
<property name="application" ref="grailsApplication" />
</bean>
- <bean id="pluginMetaManager" class="org.codehaus.groovy.grails.plugins.DefaultPluginMetaManager">
- <property name="grailsApplication" ref="grailsApplication" />
- <property name="resourcePattern" value="/WEB-INF/plugins/*/plugin.xml" />
- </bean>
-
<bean id="grailsConfigurator" class="org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator">
<constructor-arg>
<ref bean="grailsApplication" />

0 comments on commit 7840154

Please sign in to comment.