Skip to content

Commit

Permalink
Implement ListByPluginName
Browse files Browse the repository at this point in the history
Signed-off-by: Yoshiki Fujikane <[email protected]>
  • Loading branch information
ffjlabo committed Dec 26, 2024
1 parent fa548f6 commit a6603eb
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions pkg/app/pipedv1/apistore/applicationstore/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ type Lister interface {
ListByPlatformProvider(name string) []*model.Application
// Get retrieves a specifiec deployment for the given id.
Get(id string) (*model.Application, bool)
// ListByPluginName lists all applications for a given plugin name.
ListByPluginName(name string) []*model.Application
}

type apiClient interface {
Expand Down Expand Up @@ -159,6 +161,19 @@ func (s *store) Get(id string) (*model.Application, bool) {

// ListByPluginName lists all applications for a given plugin name.
func (s *store) ListByPluginName(name string) []*model.Application {
// TODO: implement it
return nil
apps := s.applicationList.Load()
if apps == nil {
return nil
}

Check warning on line 167 in pkg/app/pipedv1/apistore/applicationstore/store.go

View check run for this annotation

Codecov / codecov/patch

pkg/app/pipedv1/apistore/applicationstore/store.go#L163-L167

Added lines #L163 - L167 were not covered by tests

out := make([]*model.Application, 0)
list := apps.([]*model.Application)

for _, app := range list {
if app.Plugin == name {
out = append(out, app)
}

Check warning on line 175 in pkg/app/pipedv1/apistore/applicationstore/store.go

View check run for this annotation

Codecov / codecov/patch

pkg/app/pipedv1/apistore/applicationstore/store.go#L169-L175

Added lines #L169 - L175 were not covered by tests
}

return out

Check warning on line 178 in pkg/app/pipedv1/apistore/applicationstore/store.go

View check run for this annotation

Codecov / codecov/patch

pkg/app/pipedv1/apistore/applicationstore/store.go#L178

Added line #L178 was not covered by tests
}

0 comments on commit a6603eb

Please sign in to comment.