Skip to content

feat(Clusters): allow add, edit and delete cluster funcs #2369

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

Merged
merged 2 commits into from
Jun 9, 2025

Conversation

artemmufazalov
Copy link
Member

@artemmufazalov artemmufazalov commented Jun 4, 2025

Part of #2333

  • Add onAddCluster, onEditCluster, onDeleteCluster options to uiFactory
  • Rework header - now it's shown on Clusters page, it can contain "Add Cluster" button
  • Remove clusters statistics
  • Add menu with edit and delete buttons to Clusters table

Clusters page is not fully redesigned according to design, I only make changes that allow to add buttons

Design: https://nda.ya.ru/t/-uEByWGb7F6QxM
Example how it will work: https://nda.ya.ru/t/EyvbNXsb7F7iRc

CI Results

Test Status: ⚠️ FLAKY

📊 Full Report

Total Passed Failed Flaky Skipped
318 317 0 1 0
Test Changes Summary 🗑️2

🗑️ Deleted Tests (2)

  1. Top Query rows components have consistent height across different query lengths (tenant/diagnostics/tabs/queries.test.ts)
  2. Scroll to row, get shareable link, navigate to URL and verify row is scrolled into view (tenant/diagnostics/tabs/queries.test.ts)

Bundle Size: ✅

Current: 83.77 MB | Main: 83.76 MB
Diff: +0.54 KB (0.00%)

✅ Bundle size unchanged.

ℹ️ CI Information
  • Test recordings for failed tests are available in the full report.
  • Bundle size is measured for the entire 'dist' directory.
  • 📊 indicates links to detailed reports.
  • 🔺 indicates increase, 🔽 decrease, and ✅ no change in bundle size.

@artemmufazalov artemmufazalov marked this pull request as draft June 4, 2025 15:49
@artemmufazalov artemmufazalov marked this pull request as ready for review June 5, 2025 07:06
@artemmufazalov
Copy link
Member Author

@astandrik @Raubzeug ping

@astandrik astandrik requested a review from Copilot June 9, 2025 12:26
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements create/edit/delete cluster functionality in the UI by adding new capability endpoints, hooks, header actions, and table menu items, while removing the old cluster statistics view.

  • Introduce /meta/create_cluster, /meta/update_cluster, /meta/delete_cluster capabilities and corresponding hooks (useAdd/Edit/DeleteClusterFeatureAvailable)
  • Extend the header: add “Add Cluster” button on the Clusters page and update breadcrumb logic to include a root “All clusters” link
  • Update the Clusters page: remove statistics component, add a dropdown menu for edit/delete actions in the table, and adjust layout

Reviewed Changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/types/api/capabilities.ts Add new cluster CRUD capability strings
src/store/reducers/capabilities/hooks.ts Add hooks to check feature availability
src/containers/Header/breadcrumbs.tsx Add clusters breadcrumb and adapt getters
src/containers/Header/Header.tsx Insert Add Cluster button and update header controls
src/containers/Clusters/columns.tsx Add edit/delete actions to the clusters table column
src/containers/Clusters/Clusters.tsx Remove statistics, wire up hooks, and adjust layout
src/containers/Clusters/i18n/ru.json (Removed) Russian translations for clusters page
src/containers/Clusters/i18n/index.ts Removed RU import from keyset registration
Comments suppressed due to low confidence (5)

src/containers/Clusters/i18n/ru.json:1

  • Russian translations for the clusters page were removed; re-add the ru.json file or merge these translations back to maintain Russian localization support.
{

src/containers/Clusters/i18n/index.ts:3

  • Removed the RU keyset import; this breaksover Russian localization for the clusters page. Consider restoring the ru keyset registration.
import ru from './ru.json';

src/store/reducers/capabilities/hooks.ts:127

  • New feature hook useAddClusterFeatureAvailable lacks unit tests verifying its behavior; consider adding tests to cover feature-version lookup logic.
export const useAddClusterFeatureAvailable = () => {

src/containers/Header/Header.tsx:61

  • Rendering logic for the “Add Cluster” button is new UI behavior and should be covered by component tests to catch potential regressions.
if (isClustersPage && isAddClusterAvailable) {

src/containers/Clusters/i18n/en.json:21

  • [nitpick] The UI label uses “Remove Cluster” but the API hook is named onDeleteCluster. Consider renaming the key and label to “delete-cluster” for consistency.
"remove-cluster": "Remove Cluster"

@@ -4,7 +4,7 @@
justify-content: space-between;
align-items: center;

padding: 0 20px 0 12px;
padding: 0 20px;
Copy link
Collaborator

Choose a reason for hiding this comment

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

--g-spacing-5

@@ -44,6 +48,15 @@ export function Clusters() {

const dispatch = useTypedDispatch();

React.useEffect(() => {
dispatch(setHeaderBreadcrumbs('clusters', {}));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible to set it as default value in store instead of useEffect here?

Copy link
Member Author

Choose a reason for hiding this comment

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

  1. It is not a default value, there is no clusters page in single-cluster version
  2. useEffect is needed here anyway to reset current breadcrumbs state. So even if it will be a default value, some function call will be needed

const renderActions = () => {
const menuItems: (DropdownMenuItem | DropdownMenuItem[])[] = [];

if (isEditClusterAvailable) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe if onEditCluster is undefined - we also shouldnt push this to menuItmes

currently its kinda unobvious how onEditCluster and isEditClusterAvailable are connected or related to each other

Copy link
Member Author

Choose a reason for hiding this comment

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

We check it when we define these vars

const isEditClusterAvailable =
     useEditClusterFeatureAvailable() && uiFactory.onEditCluster !== undefined;
const isDeleteClusterAvailable =
     useDeleteClusterFeatureAvailable() && uiFactory.onDeleteCluster !== undefined;

uiFactory.onEditCluster?.() here is because we do not check type here

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed, it should look better now

@artemmufazalov artemmufazalov added this pull request to the merge queue Jun 9, 2025
Merged via the queue into main with commit 69b4b4e Jun 9, 2025
7 checks passed
@artemmufazalov artemmufazalov deleted the manage-cluster branch June 9, 2025 14:28
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.

2 participants