Skip to content

implement optimistic hide for resource and policy deletions#397

Open
RafsanNeloy wants to merge 4 commits into
karmada-io:mainfrom
RafsanNeloy:Working
Open

implement optimistic hide for resource and policy deletions#397
RafsanNeloy wants to merge 4 commits into
karmada-io:mainfrom
RafsanNeloy:Working

Conversation

@RafsanNeloy

Copy link
Copy Markdown
Contributor

What type of PR is this?
/kind design

What this PR does / why we need it: Improves UI responsiveness by immediately hiding resources from the dashboard after a successful deletion response, instead of waiting for background sync or manual reloads.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


Signed-off-by: rafsanneloy <rafsanneloy@gmail.com>
@karmada-bot karmada-bot added the kind/design Categorizes issue or PR as related to design. label Jan 28, 2026
@karmada-bot karmada-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 28, 2026
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @RafsanNeloy, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the user experience of the dashboard by introducing an "optimistic hide" mechanism for resource and policy deletion operations. Instead of waiting for a full data refresh from the backend, items are now immediately removed from the UI upon receiving a successful deletion response from the API. This change provides instant visual feedback to the user, making the application feel more responsive and fluid during common management tasks.

Highlights

  • Optimistic UI for Deletions: Implemented an "optimistic hide" feature across various resource and policy management pages. Upon a successful deletion API response, the item is immediately removed from the UI, improving perceived performance.
  • Centralized Deletion Tracking: Introduced a deletingNames state variable (a Set<string>) in relevant components to keep track of resources/policies that are currently undergoing deletion.
  • Dynamic Table Filtering: Modified table dataSource properties to filter out items whose identifiers are present in the deletingNames set, ensuring they are instantly hidden from the user interface.
  • Policy Key Generation: Added a getPolicyKey helper function for override and propagation policies to create unique identifiers (combining namespace and name for namespace-scoped policies, or just name for cluster-scoped policies) for consistent deletion tracking.
  • Broad Application: This optimistic deletion pattern has been applied to Cluster, Override Policy, Propagation Policy, ConfigMap, Secret, Namespace, Ingress, Service, and Workload management views.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces an optimistic UI update for resource and policy deletions, which is a great enhancement for user experience. When an item is deleted, it's immediately hidden from the view instead of waiting for a data refresh. The implementation is consistent across multiple pages. My review includes suggestions to improve code conciseness, reduce duplication, and enhance readability, which will contribute to better maintainability.

Comment thread ui/apps/dashboard/src/pages/cluster-manage/index.tsx
Comment thread ui/apps/dashboard/src/pages/multicloud-policy-manage/override-policy/index.tsx Outdated
Comment thread ui/apps/dashboard/src/pages/multicloud-policy-manage/override-policy/index.tsx Outdated
Comment thread ui/apps/dashboard/src/pages/multicloud-resource-manage/config/index.tsx Outdated
Comment thread ui/apps/dashboard/src/pages/multicloud-resource-manage/namespace/index.tsx Outdated
Comment thread ui/apps/dashboard/src/pages/multicloud-resource-manage/service/index.tsx Outdated
Comment thread ui/apps/dashboard/src/pages/multicloud-resource-manage/service/index.tsx Outdated
@RafsanNeloy

Copy link
Copy Markdown
Contributor Author

/cc @warjiang @RainbowMango

@warjiang

Copy link
Copy Markdown
Contributor

/assign

Signed-off-by: rafsanneloy <rafsanneloy@gmail.com>
@karmada-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from warjiang. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@karmada-bot karmada-bot added the do-not-merge/contains-merge-commits Indicates a PR which contains merge commits. label Feb 6, 2026
@karmada-bot

Copy link
Copy Markdown
Contributor

Adding label do-not-merge/contains-merge-commits because PR contains merge commits, which are not allowed in this repository.
Use git rebase to reapply your commits on top of the target branch. Detailed instructions for doing so can be found here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@RafsanNeloy

Copy link
Copy Markdown
Contributor Author

I added getPolicyKey for more convenient in base.ts to avoid marge conflict.
What should I do to remove do-not-merge/contains-merge-commits @warjiang could you please suggest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/contains-merge-commits Indicates a PR which contains merge commits. kind/design Categorizes issue or PR as related to design. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants