Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove delete option for local cluster #320

Merged
merged 1 commit into from
Oct 9, 2024
Merged

Conversation

nxtCoder19
Copy link
Contributor

@nxtCoder19 nxtCoder19 commented Oct 9, 2024

Summary by Sourcery

Remove the 'Delete' option for local clusters by refactoring the ExtraButton component to conditionally display the option based on cluster type and ownership.

Enhancements:

  • Refactor the ExtraButton component to conditionally include the 'Delete' option only for 'byok' clusters that are not owned by any user.

Copy link

sourcery-ai bot commented Oct 9, 2024

Reviewer's Guide by Sourcery

This pull request removes the delete option for local clusters and refactors the ExtraButton component to conditionally render options based on cluster type and ownership. It also includes minor code formatting changes.

Class diagram for ExtraButton component refactor

classDiagram
    class ExtraButton {
        +onEdit()
        +onDelete()
        +onShowLogs()
        +item: CombinedBaseType
    }
    class ResourceExtraAction {
        +options: IResourceExtraItem[]
    }
    ExtraButton --> ResourceExtraAction
    class IResourceExtraItem {
        +key: String
        +label: String
        +icon: ReactNode
        +type: String
        +onClick: Function
        +className: String
    }
    class CombinedBaseType {
        +type: String
        +ownedBy: String
    }
    ExtraButton --> CombinedBaseType
    ExtraButton --> IResourceExtraItem
Loading

File-Level Changes

Change Details Files
Refactoring of ExtraButton component to remove delete option for local clusters
  • Removed separate rendering logic for 'byok' and non-'byok' clusters
  • Introduced a single options array with conditional rendering
  • Added a condition to only show delete option for 'byok' clusters with null ownership
  • Removed 'Show Logs' and 'Settings' options for all cluster types
src/apps/console/routes/_main+/$account+/infra+/clusters/cluster-resources-v2.tsx
Minor code formatting changes
  • Removed trailing commas in function calls
  • Reordered import statements
src/apps/console/routes/_main+/$account+/infra+/clusters/cluster-resources-v2.tsx
src/apps/console/routes/_main+/_layout/_layout.tsx

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.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

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

Copy link

@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 @nxtCoder19 - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The PR description lacks context. Please provide an explanation for why the delete option is being removed for local clusters.
  • The new condition item.ownedBy === null for the delete option needs explanation. Consider adding a comment in the code or mentioning it in the PR description.
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.

Comment on lines +314 to +315
key: 'delete',
className: '!text-text-critical',
Copy link

Choose a reason for hiding this comment

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

issue (code-quality): Delete should only be used for object properties. (only-delete-object-properties)

ExplanationThe `delete` operator is intended for use in deleting the properties of objects, and does not have meaningful behaviour otherwise.

See the MDN docs for delete.

@nxtCoder19 nxtCoder19 merged commit 41ad773 into release-v1.0.8 Oct 9, 2024
5 checks passed
@nxtCoder19 nxtCoder19 deleted the update/infra branch October 9, 2024 16:14
abdheshnayak pushed a commit that referenced this pull request Oct 28, 2024
Remove delete option for local cluster
tulsiojha pushed a commit that referenced this pull request Nov 1, 2024
Remove delete option for local cluster
abdheshnayak pushed a commit that referenced this pull request Nov 5, 2024
Remove delete option for local cluster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant