Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added links to the environment

  • Loading branch information...
commit c6d3e76f78614cd488801c3a10017a0c978e7def 1 parent 836ec38
@jettro authored
View
5 application.properties
@@ -1,8 +1,9 @@
#utf-8
-#Fri Nov 06 19:18:13 CET 2009
+#Tue Nov 10 15:44:58 CET 2009
app.version=0.1
app.servlet.version=2.4
app.grails.version=1.1.1
-plugins.db-util=0.4
plugins.hibernate=1.1.1
+plugins.db-util=0.4
+plugins.joda-time=0.5
app.name=myserverpark
View
33 grails-app/conf/BootStrap.groovy
@@ -1,33 +0,0 @@
-class BootStrap {
-
- def init = { servletContext ->
- def statussus = ['OK','WARNING','PROBLEM','COLD']
- statussus.each {
- statusName ->
- def newStatus = new Status(name: statusName)
- newStatus.save()
- }
-
- def vlans = [['Middleware','middle_dev'],['Backend','backend_dev'],['Beheer','maint_dev'],['Backup','backup_dev']]
- vlans.each {
- vlanFunction,vlanName ->
- def newVlan = new Vlan(name:vlanName,function:vlanFunction)
- newVlan.save()
- }
-
- def environments = ['Development','Test','Acceptation','Production']
- environments.each {
- name ->
- def environment = new Environment(name:name)
- environment.save()
- }
-
- def okStatus = Status.findByName("OK")
- def warningStatus = Status.findByName("WARNING")
- def errorStatus = Status.findByName("PROBLEM")
- def coldStatus = Status.findByName("COLD")
-
- }
- def destroy = {
- }
-}
View
2  grails-app/conf/Config.groovy
@@ -35,7 +35,7 @@ grails.enable.native2ascii = true
// set per-environment serverURL stem for creating absolute links
environments {
production {
- grails.serverURL = "http://www.changeme.com"
+ grails.serverURL = "http://s1729.nxs.nl/serverpark/"
}
development {
grails.serverURL = "http://localhost:8080/${appName}"
View
2  grails-app/conf/DataSource.groovy
@@ -26,7 +26,7 @@ environments {
production {
dataSource {
dbCreate = "update"
- url = "jdbc:hsqldb:file:prodDb;shutdown=true"
+ jndiName = "java:comp/env/jdbc/serverpark"
}
}
}
View
2  grails-app/conf/UrlMappings.groovy
@@ -5,7 +5,7 @@ class UrlMappings {
// apply constraints here
}
}
- "/"(view:"/index")
+ "/"(controller:"overview", action:"index")
"500"(view:'/error')
}
}
View
3  grails-app/controllers/LinkController.groovy
@@ -0,0 +1,3 @@
+class LinkController {
+ def scaffold = true
+}
View
12 grails-app/domain/Environment.groovy
@@ -1,15 +1,23 @@
+import org.joda.time.*
+import org.joda.time.contrib.hibernate.*
+
class Environment {
String name
+ DateTime lastDeploy
- static hasMany = [servers:Server]
+ static hasMany = [servers:Server,links:Link]
static constraints = {
name(blank:false, maxSize:50)
+ lastDeploy(blank:true)
+ }
+
+ static mapping = {
+ lastDeploy type:PersistentDateTime
}
def String toString() {
return name + ": " + servers.size();
}
-
}
View
11 grails-app/domain/Link.groovy
@@ -0,0 +1,11 @@
+class Link {
+ String title
+ String url
+
+ static constraints = {
+ title(blank:false,maxSize:50)
+ url(blank:false,maxSize:150)
+ }
+
+ static belongsTo = [environment:Environment]
+}
View
2  grails-app/domain/NetworkDefinition.groovy
@@ -9,6 +9,6 @@ class NetworkDefinition {
}
public String toString() {
- return vlan + ' ' + ipAddress
+ return vlan.name + ' ' + ipAddress
}
}
View
6 grails-app/domain/Server.groovy
@@ -15,9 +15,11 @@ class Server {
externalIp(matches : "(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)")
}
+ static mapping = {
+ sort name:'desc'
+ }
+
def String toString() {
return name
}
-
-
}
View
31 grails-app/views/overview/index.gsp
@@ -16,31 +16,32 @@
<body>
<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>
<div id="environments">
- <g:each in="${environments}" var="environment">
+ <g:each in="${environments}" status="i" var="environment">
<div class="environment">
- <span class="title">${environment.name}</span>
- <g:each in="${environment.servers}" status="i" var="server">
+ <span class="title"><g:link action="show" controller="environment" id="${environment.id}">${environment.name}</g:link>
+ - (last depoy : ${environment.lastDeploy.format('dd-MMM-yyyy HH:mm')})
+ <g:each in="${environment.links.sort {a, b -> a.title.compareToIgnoreCase b.title}}" var="link"><a href="${link.url}" title="${link.title}">${link.title}</a>&nbsp;</g:each>
+ </span>
+ <g:each in="${environment.servers.sort { a, b -> a.name.compareToIgnoreCase b.name }}" var="server">
<div class="server ${server.status.name.toLowerCase()}">
<g:link action="show" id="${server.id}">${fieldValue(bean: server, field: 'name')}</g:link>
<ul>
- <li>${server.name}</li>
- <li>${server.function}</li>
- <li>vlans
- <ul>
- <g:each in="${server.networks}" status="j" var="network">
- <li>${network.vlan}</li>
- </g:each>
- </ul>
- </li>
- </ul>
- <g:remoteLink action="comments" params="[id:server.id]" update="comments">comments</g:remoteLink>
+ <li>${server.function}</li>
+ <g:each in="${server.networks.sort { a, b -> a.vlan.name.compareToIgnoreCase b.vlan.name }}" status="j" var="network">
+ <li>${network.vlan} (${network.ipAddress})</li>
+ </g:each>
+ </ul>
+ <g:remoteLink action="comments" params="[id:server.id]" update="comments${i}">comments</g:remoteLink>
</div>
</g:each>
+ <div id="comments${i}" class="comments"></div>
</div>
</g:each>
</div>
-<div id="comments"></div>
</body>
</html>
View
1  grails-app/views/shared/_comment.gsp
@@ -13,5 +13,6 @@
<span class="author">${comment.name}</span>
<span class="content">${comment.content}</span>
</div>
+ <div><g:link controller="comment" action="edit" params="[id:comment.id]">edit</g:link></div>
</g:each>
</div>
View
5 web-app/css/main.css
@@ -5,7 +5,7 @@ html * {
/* SPECIFIC FOR MY APP */
#environments {
- width:100%;
+ width:80%;
float:left;
}
div.environment {
@@ -46,8 +46,9 @@ div.problem {
div.cold {
background-color:lightblue;
}
-div.conments {
+div.comments {
float:right;
+ width:20%;
}
div.comment {
float:right;
Please sign in to comment.
Something went wrong with that request. Please try again.