Skip to content

Commit

Permalink
Merge getDomain and GetDomain
Browse files Browse the repository at this point in the history
Signed-off-by: zychen5186 <[email protected]>
  • Loading branch information
zychen5186 committed Jun 4, 2024
1 parent a181b70 commit 32e8fd7
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions flyteadmin/pkg/manager/impl/project_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (m *ProjectManager) CreateProject(ctx context.Context, request admin.Projec
return &admin.ProjectRegisterResponse{}, nil
}

func (m *ProjectManager) getDomains() []*admin.Domain {
func (m *ProjectManager) GetDomains(ctx context.Context, request admin.GetDomainRequest) *admin.Domains {
configDomains := m.config.ApplicationConfiguration().GetDomainsConfig()
var domains = make([]*admin.Domain, len(*configDomains))
for index, configDomain := range *configDomains {
Expand All @@ -51,12 +51,8 @@ func (m *ProjectManager) getDomains() []*admin.Domain {
Name: configDomain.Name,
}
}
return domains
}

func (m *ProjectManager) GetDomains(ctx context.Context, request admin.GetDomainRequest) *admin.Domains {
return &admin.Domains{
Domains: m.getDomains(),
Domains: domains,
}
}

Expand Down Expand Up @@ -93,7 +89,7 @@ func (m *ProjectManager) ListProjects(ctx context.Context, request admin.Project
if err != nil {
return nil, err
}
projects := transformers.FromProjectModels(projectModels, m.getDomains())
projects := transformers.FromProjectModels(projectModels, m.GetDomains(ctx, admin.GetDomainRequest{}).Domains)

var token string
if len(projects) == int(request.Limit) {
Expand Down Expand Up @@ -140,7 +136,7 @@ func (m *ProjectManager) GetProject(ctx context.Context, request admin.ProjectGe
if err != nil {
return nil, err
}
projectResponse := transformers.FromProjectModel(projectModel, m.getDomains())
projectResponse := transformers.FromProjectModel(projectModel, m.GetDomains(ctx, admin.GetDomainRequest{}).Domains)

return &projectResponse, nil
}
Expand Down

0 comments on commit 32e8fd7

Please sign in to comment.