Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

Feat/env template#378

Merged
abdheshnayak merged 9 commits into
release-v1.0.8from
feat/env-template
Oct 3, 2024
Merged

Feat/env template#378
abdheshnayak merged 9 commits into
release-v1.0.8from
feat/env-template

Conversation

@abdheshnayak
Copy link
Copy Markdown
Contributor

@abdheshnayak abdheshnayak commented Oct 3, 2024

  • fixed issue with owned cluster listing
  • fixed issues with env templates

Summary by Sourcery

Fix issues with owned cluster listing by adding appropriate filters and enhance environment templates with a new 'AllClusters' filter option in the search functionality.

Bug Fixes:

  • Fix issue with owned cluster listing by adding a filter for clusters owned by the user or unowned clusters.

Enhancements:

  • Enhance environment templates by introducing a new filter option 'AllClusters' in the search functionality.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Oct 3, 2024

Reviewer's Guide by Sourcery

This pull request implements changes to improve cluster listing functionality and introduces environment template-related fixes. The main changes include modifying the cluster listing logic to filter results based on ownership, updating the BYOK cluster listing, and adding a new field to the SearchCluster model.

Sequence diagram for InfraListClusters function

sequenceDiagram
    participant User
    participant QueryResolver
    participant Domain
    participant Repos
    User->>QueryResolver: InfraListClusters(search)
    QueryResolver->>QueryResolver: Check search.Text
    alt search.AllClusters is nil
        QueryResolver->>QueryResolver: Add filter for ClusterOwnedBy
    end
    QueryResolver->>Domain: ListClusters(filter, pagination)
    Domain->>Repos: FindPaginated(filter, pagination)
    Repos-->>Domain: Clusters
    Domain-->>QueryResolver: Clusters
    QueryResolver-->>User: Clusters
Loading

Sequence diagram for InfraListBYOKClusters function

sequenceDiagram
    participant User
    participant QueryResolver
    participant Domain
    participant Repos
    User->>QueryResolver: InfraListBYOKClusters(search)
    alt search is nil or search.AllClusters is nil
        QueryResolver->>QueryResolver: Add filter for BYOKClusterOwnedBy
    end
    QueryResolver->>Domain: ListBYOKCluster(filter, pagination)
    Domain->>Repos: FindPaginated(filter, pagination)
    Repos-->>Domain: BYOK Clusters
    Domain-->>QueryResolver: BYOK Clusters
    QueryResolver-->>User: BYOK Clusters
Loading

Updated class diagram for SearchCluster model

classDiagram
    class SearchCluster {
        repos.MatchFilter~optional~ isReady
        repos.MatchFilter~optional~ region
        repos.MatchFilter~optional~ text
        repos.MatchFilter~optional~ allClusters
    }
Loading

File-Level Changes

Change Details Files
Modified cluster listing logic to filter results based on ownership
  • Added a new filter condition to include clusters owned by the current user or with null ownership
  • Implemented the filter for both regular clusters and BYOK clusters
  • Introduced a new 'AllClusters' field in the SearchCluster model to control the filtering behavior
apps/infra/internal/app/graph/schema.resolvers.go
apps/infra/internal/domain/clusters.go
apps/infra/internal/domain/byok-clusters.go
apps/infra/internal/app/graph/model/models_gen.go
Updated BYOK cluster listing functionality
  • Commented out the previous ownership filtering logic in the BYOK cluster listing function
  • Implemented a new filter condition similar to the regular cluster listing
apps/infra/internal/domain/byok-clusters.go
apps/infra/internal/app/graph/schema.resolvers.go
Added a new field to the SearchCluster model
  • Introduced 'AllClusters' field of type '*repos.MatchFilter' to the SearchCluster struct
apps/infra/internal/app/graph/model/models_gen.go

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@abdheshnayak abdheshnayak merged commit c4d2652 into release-v1.0.8 Oct 3, 2024
@abdheshnayak abdheshnayak deleted the feat/env-template branch October 3, 2024 08:37
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @abdheshnayak - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider removing commented-out code in ListBYOKCluster and ListClusters functions to keep the codebase clean.
  • To improve code organization and reduce duplication, consider extracting the filter logic into a separate function, as it's used in both InfraListClusters and InfraListBYOKClusters.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

abdheshnayak added a commit that referenced this pull request Nov 5, 2024
* ✨ Added support for env-template

* handle clustername empty error in resource mapping

* 🎨 Implemented template and owned cluster

---------

Co-authored-by: Piyush Kumar <piyush.acet@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants