1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-24 06:28:42 +01:00

feat: enables container filter to be configured at multiple places

This commit is contained in:
Amir Raminfar
2024-12-13 11:59:39 -08:00
parent a62cef7e25
commit 74b5adad00
20 changed files with 468 additions and 350 deletions

View File

@@ -10,7 +10,7 @@ import (
type ClientService interface {
FindContainer(ctx context.Context, id string) (docker.Container, error)
ListContainers(ctx context.Context) ([]docker.Container, error)
ListContainers(ctx context.Context, filter docker.ContainerFilter) ([]docker.Container, error)
Host(ctx context.Context) (docker.Host, error)
ContainerAction(ctx context.Context, container docker.Container, action docker.ContainerAction) error
LogsBetweenDates(ctx context.Context, container docker.Container, from time.Time, to time.Time, stdTypes docker.StdType) (<-chan *docker.LogEvent, error)
@@ -30,10 +30,10 @@ type dockerClientService struct {
store *docker.ContainerStore
}
func NewDockerClientService(client docker.Client) ClientService {
func NewDockerClientService(client docker.Client, filter docker.ContainerFilter) ClientService {
return &dockerClientService{
client: client,
store: docker.NewContainerStore(context.Background(), client),
store: docker.NewContainerStore(context.Background(), client, filter),
}
}
@@ -78,8 +78,8 @@ func (d *dockerClientService) ContainerAction(ctx context.Context, container doc
return d.client.ContainerActions(ctx, action, container.ID)
}
func (d *dockerClientService) ListContainers(ctx context.Context) ([]docker.Container, error) {
return d.store.ListContainers()
func (d *dockerClientService) ListContainers(ctx context.Context, filter docker.ContainerFilter) ([]docker.Container, error) {
return d.store.ListContainers(filter)
}
func (d *dockerClientService) Host(ctx context.Context) (docker.Host, error) {