Skip to content

Commit

Permalink
Merge branch 'issue55' of http://github.com/gschueler/rundeck into gs…
Browse files Browse the repository at this point in the history
…-issue55
  • Loading branch information
noahcampbell committed Oct 30, 2010
2 parents 5e67e18 + 22a14d3 commit d4729e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions rundeckapp/grails-app/controllers/FrameworkController.groovy
Expand Up @@ -260,6 +260,12 @@ class FrameworkController {
def NodeFilter filter
def boolean saveuser=false
if(params.newFilterName && !params.existsFilterName){
def ofilter = NodeFilter.findByNameAndUser(params.newFilterName,u)
if(ofilter){
flash.error="Filter named ${params.newFilterName} already exists."
params.saveFilter=true
return chain(controller:'framework',action:'nodes',params:params)
}
filter= new NodeFilter(query.properties)
filter.name=params.newFilterName
u.addToNodefilters(filter)
Expand All @@ -272,12 +278,12 @@ class FrameworkController {
}else if(!params.newFilterName && !params.existsFilterName){
flash.error="Filter name not specified"
params.saveFilter=true
chain(controller:'reports',action:'index',params:params)
return chain(controller:'framework',action:'nodes',params:params)
}
if(!filter.save(flush:true)){
flash.error=filter.errors.allErrors.collect { g.message(error:it) }.join("\n")
params.saveFilter=true
chain(controller:'reports',action:'index',params:params)
return chain(controller:'framework',action:'nodes',params:params)
}
if(saveuser){
if(!u.save(flush:true)){
Expand Down
2 changes: 1 addition & 1 deletion rundeckapp/grails-app/domain/NodeFilter.groovy
Expand Up @@ -45,7 +45,7 @@ public class NodeFilter {

static belongsTo = [user:User]
static constraints={
name(blank:false,unique:true)
name(blank:false)
nodeInclude(nullable: true)
nodeExclude(nullable: true)
nodeIncludeName(nullable: true)
Expand Down

0 comments on commit d4729e6

Please sign in to comment.