kvrocks-controller icon indicating copy to clipboard operation
kvrocks-controller copied to clipboard

Add Rename Functionality to Sidebar Items

Open Jitmisra opened this issue 9 months ago • 5 comments

Add Rename Functionality to Sidebar Items✍🏻

After adding rename

https://github.com/user-attachments/assets/4eaecfcb-e68c-4a03-b07d-b69c8069b975

before

https://github.com/user-attachments/assets/a32a02c0-3b1f-45a0-b2db-08528faee3b2

Description

Currently, the sidebar items (namespaces and clusters) only have a delete option when clicking on the three dots menu. We need to add a rename capability to allow users to change the names of namespaces and clusters directly from the sidebar.

Requirements

  • Add a rename/edit option to the sidebar item context menu for namespaces and clusters
  • Create a dialog to input the new name
  • Implement API calls to handle the renaming on the backend
  • Add proper error handling and user feedback

Implementation Details

UI Changes

  • Add an edit icon to the context menu next to the delete icon
  • Create a rename dialog with a text field for the new name
  • Show success/error messages after rename attempts

API Endpoints

Need to implement these endpoints on the backend:

  • /api/namespaces/{oldName}/rename - For renaming namespaces
  • /api/namespaces/{namespace}/clusters/{oldName}/rename - For renaming clusters

Files to Modify

  1. /Users/jitmisra/Desktop/kvrocks-controller/webui/src/app/ui/sidebarItem.tsx
  2. /Users/jitmisra/Desktop/kvrocks-controller/webui/src/app/lib/api.ts

Acceptance Criteria

  • Users can rename namespaces and clusters from the sidebar
  • UI provides clear feedback on success or failure
  • After successful rename, the user is redirected to the renamed resource

Jitmisra avatar Mar 08 '25 09:03 Jitmisra

I want to work on this issue already i have wrote the code as you can see in the video added edit icon previosly only delete icon was there

Jitmisra avatar Mar 08 '25 10:03 Jitmisra

@Jitmisra, that looks good to me. Thanks for your efforts.

git-hulk avatar Mar 08 '25 12:03 git-hulk

@Jitmisra, that looks good to me. Thanks for your efforts.

I have already implemented the frontend and rename functionality, and it successfully makes the API call. However, since I have limited experience with Go, I need to check if the backend already has a function to handle the rename operation. If it doesn’t, I will need some time to implement it. Alternatively, I can push the PR for the edit functionality now and work on the backend implementation separately. Let me know how you’d like to proceed.

Jitmisra avatar Mar 08 '25 15:03 Jitmisra

@Jitmisra It now doesn't have the rename API, but it should be simple to implement. Could refer to: https://github.com/apache/kvrocks-controller/blob/unstable/server/route.go#L61

git-hulk avatar Mar 09 '25 02:03 git-hulk

@Jitmisra It now doesn't have the rename API, but it should be simple to implement. Could refer to: https://github.com/apache/kvrocks-controller/blob/unstable/server/route.go#L61

thank you i have raised the pr please review

Jitmisra avatar Mar 09 '25 14:03 Jitmisra