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

feat(coral): Allow users to delete clusters #2354

Merged
merged 8 commits into from
Mar 18, 2024
Merged

Conversation

mathieu-anderson
Copy link
Contributor

@mathieu-anderson mathieu-anderson commented Mar 15, 2024

Linked issue

Resolves: #2282

What kind of change does this PR introduce?

  • Bug fix
  • New feature
  • Refactor
  • Docs update
  • CI update

What is the current behavior?

There is not way to delete clusters from Klaw currently

What is the new behavior?

  • Add context menu to Clusters table row with Delete option (will also have Edit option later)
  • Add ability to delete clusters
  • Do not show if user does not have the permission addDeleteEditClusters
Screen.Recording.2024-03-15.at.11.49.24.mov

Other information

  • Added the possibilty to pass React.ReactElement as children to Dialog
  • The copy is still being worked on by @harshini-rangaswamy

Requirements (all must be checked before review)

  • The pull request title follows our guidelines
  • Tests for the changes have been added (if relevant)
  • The latest changes from the main branch have been pulled
  • pnpm lint has been run successfully

Mathieu Anderson added 3 commits March 15, 2024 11:47
Signed-off-by: Mathieu Anderson <mathieu.anderson@aiven.io>
Signed-off-by: Mathieu Anderson <mathieu.anderson@aiven.io>
Signed-off-by: Mathieu Anderson <mathieu.anderson@aiven.io>
@mathieu-anderson mathieu-anderson added enhancement New feature or request Frontend Relates to coral (react app) labels Mar 15, 2024
@mathieu-anderson mathieu-anderson self-assigned this Mar 15, 2024
Signed-off-by: Mathieu Anderson <mathieu.anderson@aiven.io>
@harshini-rangaswamy
Copy link

@mathieu-anderson and @programmiri

For the copy, let's change Delete to Remove. "Remove" is better here as we are clearing or removing the cluster association in Klaw. For ref: https://aquarium.aiven.io/43ae72f19/p/925433-word-list/t/678211

Also, I suggest updating the label next to the delete icon to "Remove" instead of "Delete." We have something similar in the Aiven Console, for example.
image

Scenario 1: When users cannot remove cluster as it is associated with an env

Remove cluster
'DEV' is linked to an environment and cannot be removed from Klaw. Unlink the environment to proceed.

Scenario 2: When users can remove clusters

Remove cluster
Confirm removal of 'TEST2'. The cluster will be excluded from Klaw.

Buttons: Cancel, Remove

Signed-off-by: Mathieu Anderson <mathieu.anderson@aiven.io>
@mathieu-anderson
Copy link
Contributor Author

@harshini-rangaswamy implemented the changes here: 35d9e5e

@harshini-rangaswamy
Copy link

@harshini-rangaswamy implemented the changes here: 35d9e5e

Looks good, thanks!

Copy link
Contributor

@programmiri programmiri left a comment

Choose a reason for hiding this comment

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

Left a few small comments.

One bigger question -> I think for superadmin, the "connect" action should also be in the Dropdown? 🤔 It does not make sense to have one directly accessible button and one other button hidden behind a menu. Also, the contrast for which dropdown menu is active is already very bad accessibility wise, but if there's only one, that is in focus from the beginning, but it's not a focus style, so it's not really to see, which makes keyboard navigation hard.

Screenshot 2024-03-18 at 09 50 05

@@ -87,15 +103,15 @@ const ClustersTable = (props: ClustersTableProps) => {
},
];

if (handleShowModal !== undefined) {
if (isAdminUser) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would add a test case for that, too, so we make sure the "Remove" functionality is only available for admins.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for not being more precise -> I meant explicitly confirming that there is no delete action available for the user without the permission (e.g. in the block shows all clusters as a table (user without permissions.addDeleteEditClusters)). It's can get a bit trick to decide how much of "testing that something is NOT there" makes sense 😅 but in a case of this kind of functionality I would do it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aaah of course!

Added here ^^ 62dd1c7

@mathieu-anderson
Copy link
Contributor Author

@programmiri regarding putting the connect button in the dropdown, I considered it, but I decided against because:

  • it is different in nature: in the dropdown, it is actions on the cluster: delete and dedit. In the button, it's an informational help.
  • I believe that the connect information would be something that users would want easy access to, as opposed to operation which seems unusual in a normal flow (delete and edit)

Regarding accessibility, yeah, this is for sure an issue :/ But I think it should probably be acted on at the DS level?

At any rate, I think we can modify this later, as it's not central to the functionality. Well, except for the accessibility issues, which are a little tricky to address...

@programmiri
Copy link
Contributor

programmiri commented Mar 18, 2024

Yes, your thinking with the button makes sense 🤔 I still would verify with Kate (but for a later PR), as I remember a discussion about this (with Mustafa maybe?) and the "rule" was: if there more than one action, it should be a menu. But that may not be applicable for this case.

But I think it should probably be acted on at the DS level?

It's a colour and focus visibility issue, that's nothing that is planned in the near future to be looked into. We could maybe check if we can apply a simple css fix for this, but that's out of scope for this PR as you said!

@mathieu-anderson
Copy link
Contributor Author

Kate has seen the UI, as I asked here if a modal worked in the context of deleting the cluster, so I think she doesn't have any opposition to what is currently implemented. But I can ask another confirmation ^^

@programmiri
Copy link
Contributor

No if she has seen it that's perfect! :D

Mathieu Anderson added 2 commits March 18, 2024 10:30
…olumns

Signed-off-by: Mathieu Anderson <mathieu.anderson@aiven.io>
@programmiri programmiri merged commit c9d373c into main Mar 18, 2024
30 checks passed
@programmiri programmiri deleted the 2282-delete-clusters branch March 18, 2024 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Frontend Relates to coral (react app)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(Coral) - Allow an Admin to delete a cluster
3 participants