fix filter and added postgres

This commit is contained in:
Pedro Nasser
2016-08-11 02:18:02 -03:00
parent 39f59620aa
commit 3ded66b32a
2 changed files with 5 additions and 1 deletions

View File

@@ -275,6 +275,10 @@ func buildFilterQuery(filter *models.RouteFilter) string {
filterQueries = append(filterQueries, fmt.Sprintf("app_name = '%s'", filter.AppName))
}
if filter.Image != "" {
filterQueries = append(filterQueries, fmt.Sprintf("image = '%s'", filter.Image))
}
for i, field := range filterQueries {
if i == 0 {
filterQuery = fmt.Sprintf("WHERE %s ", field)

View File

@@ -33,5 +33,5 @@ func ApplyAppFilter(app *App, filter *AppFilter) bool {
func ApplyRouteFilter(route *Route, filter *RouteFilter) bool {
return (filter.Path == "" || route.Path == filter.Path) &&
(filter.AppName == "" || route.AppName == filter.AppName) &&
(filter.Image == "" || route.Image == filter.Image) &&
(filter.Image == "" || route.Image == filter.Image)
}