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(delete/node): challenge deletion by text phrase #2248

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

hansbogert
Copy link

@hansbogert hansbogert commented Oct 14, 2023

A really simplistic change to not get burned by an accidental deletion of a node.

This is after 15min of looking through the k9s code and getting the functionality in asap; meant as inspiration for #1016

Help to make this a production ready change would be welcome.

image

Copy link
Owner

@derailed derailed left a comment

Choose a reason for hiding this comment

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

@hansbogert Thank you Hans for this PR! Please view comment.


confirmCheck := ""
if challenge {
f.AddInputField("Confirm with \"yes, I want to delete\":", confirmCheck, 30, nil, func(text string) {
Copy link
Owner

Choose a reason for hiding this comment

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

It may make sense to actually pass in the challenge string ie if set add the form field and validate. Then we can reuse this functionality to namespace to fix the original PR.
Also not sure how much we want to make folks type ie challenge: Sanitize me! or a simple `Yes!' might be enough to disrupt the flow and make users stop/think??

Copy link
Author

@hansbogert hansbogert Oct 20, 2023

Choose a reason for hiding this comment

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

I made the changes, and at least for deletion of nodes, it is now "delete!"

Do we want to make this default behaviour, or do we want to add a configuration toggle for this?
Would be nice to have the option as a user, to choose the resources you want to be challenged.

Copy link
Owner

Choose a reason for hiding this comment

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

Thank you for the updates Hans! Good point!!
I think doing this on a per resource basis would be a bit much. In k9sAlpha, I have the concept of an idiotLight. When this config is set, then confirm and deletion dialogs surface a new field aka Confirm with a challenge phrase. I think it would be a good idea to do the same here so folks can opt-in/out for additional guardrails. Would this make sense?

Copy link
Author

Choose a reason for hiding this comment

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

Agreed, will look into it when i have the time.

Copy link
Author

Choose a reason for hiding this comment

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

in constrast to K9sa I made the idiot-light option false by default, to not surprise users after an update.

@derailed derailed added enhancement New feature or request needs-review PR needs to be reviewed labels Nov 12, 2023
@jtcressy
Copy link

jtcressy commented Dec 5, 2023

FYI This PR might resolve #2076

especially if this behavior is opt-in via config toggle or cli argument

@hansbogert
Copy link
Author

Just rebased to master, @derailed when you have the time, can you give a final verdict and/or merge this?

@derailed derailed added the needs-tlc Pr needs additional updates label Dec 29, 2023
@hansbogert
Copy link
Author

@derailed is there something I can do in regards to the 'tlc' tag?

@derailed
Copy link
Owner

derailed commented Jan 4, 2024

@hansbogert Yes please take a peek at the conflicts with the latest drop. Thank you!

@hansbogert
Copy link
Author

@derailed Updated.

@hansbogert
Copy link
Author

@derailed Gentle nudge, I have to keep rebasing/conflict-resolve. Is the current change good enough?

@hansbogert
Copy link
Author

hansbogert commented Apr 13, 2024

@derailed 👼

@hansbogert
Copy link
Author

@derailed is this getting in?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs-review PR needs to be reviewed needs-tlc Pr needs additional updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants