From 7d5171ea6792472be1ae8808a13cef509871111c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Jerman?= Date: Mon, 1 Mar 2021 10:38:53 +0100 Subject: [PATCH] Add missing no label resources checks --- system/service/application.go | 5 +++++ system/service/auth_client.go | 5 +++++ system/service/template.go | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/system/service/application.go b/system/service/application.go index 9353d8935..b17c2850f 100644 --- a/system/service/application.go +++ b/system/service/application.go @@ -94,6 +94,11 @@ func (svc *application) Search(ctx context.Context, af types.ApplicationFilter) if err != nil { return err } + + // labels specified but no labeled resources found + if len(af.LabeledIDs) == 0 { + return nil + } } if aa, f, err = store.SearchApplications(ctx, svc.store, af); err != nil { diff --git a/system/service/auth_client.go b/system/service/auth_client.go index b316f0e1c..24d4938e3 100644 --- a/system/service/auth_client.go +++ b/system/service/auth_client.go @@ -133,6 +133,11 @@ func (svc *authClient) Search(ctx context.Context, af types.AuthClientFilter) (a if err != nil { return err } + + // labels specified but no labeled resources found + if len(af.LabeledIDs) == 0 { + return nil + } } if aa, f, err = store.SearchAuthClients(ctx, svc.store, af); err != nil { diff --git a/system/service/template.go b/system/service/template.go index 2982d784a..bdbf4cbe6 100644 --- a/system/service/template.go +++ b/system/service/template.go @@ -160,6 +160,11 @@ func (svc template) Search(ctx context.Context, filter types.TemplateFilter) (se if err != nil { return err } + + // labels specified but no labeled resources found + if len(filter.LabeledIDs) == 0 { + return nil + } } if set, f, err = store.SearchTemplates(ctx, svc.store, filter); err != nil {