Просмотр исходного кода

Merge branch 'belanger/por-160-pod-events-backend' of github.com:porter-dev/porter into nico/alert-events-frontend-implementation

jnfrati 4 лет назад
Родитель
Сommit
9362d9feec
2 измененных файлов с 9 добавлено и 0 удалено
  1. 2 0
      api/types/kube_events.go
  2. 7 0
      internal/repository/gorm/event.go

+ 2 - 0
api/types/kube_events.go

@@ -52,4 +52,6 @@ type ListKubeEventRequest struct {
 
 
 	OwnerType string `schema:"owner_type"`
 	OwnerType string `schema:"owner_type"`
 	OwnerName string `schema:"owner_name"`
 	OwnerName string `schema:"owner_name"`
+
+	ResourceType string `schema:"resource_type"`
 }
 }

+ 7 - 0
internal/repository/gorm/event.go

@@ -153,6 +153,13 @@ func (repo *KubeEventRepository) ListEventsByProjectID(
 		)
 		)
 	}
 	}
 
 
+	if listOpts.ResourceType != "" {
+		query = query.Where(
+			"resource_type = ?",
+			listOpts.ResourceType,
+		)
+	}
+
 	query = query.Limit(listOpts.Limit).Offset(listOpts.Skip)
 	query = query.Limit(listOpts.Limit).Offset(listOpts.Skip)
 
 
 	if listOpts.SortBy == "timestamp" {
 	if listOpts.SortBy == "timestamp" {