-
Notifications
You must be signed in to change notification settings - Fork 173
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
frontend: allow multiple deletes on ResourceTable #2594
base: main
Are you sure you want to change the base?
Conversation
d3e5a94
to
e150cb4
Compare
Thanks! minor nit, can you change the following file name:
|
09e1b10
to
77bd64d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great improvement, thanks! I've tried it out and works well. Just left a couple of small suggestions
frontend/src/components/common/Resource/DeleteMultipleButton.tsx
Outdated
Show resolved
Hide resolved
I found an issue. It should be fixed with the next commit. |
abddc30
to
dbd5e96
Compare
My concern here is how do we employ our usual UI philosophy of not showing the controls for which the user has no permissions. i.e. how to make sure we don't show the delete button if we are in a role where a deletion will fail? (some users deploy Headlamp as a read-only UI) |
@joaquimrocha Is their an efficient way to check all items for permission? |
We could also show in the dialog for which resources you have the permission as you can have the permission for some and for some you have no permission. |
I did thought a bit about it during the implementation, but I think their is no perfect way. So, I left it away. First I could a global setting to show it or not and then mark it as beta and ask for feedback. |
I think we can ask on Slack. But it's true that there's no easy way to do this very efficiently, because theoretically I guess one could be allowed to delete just a single resource in a namespace where nothing else can be deleted in one's role, right? I think we could also implement your idea of a switch in settings as you say, but I guess the idea of not showing the delete button is only relevant in environments where Headlamp is read-only most of the time, and those tend to be when Headlamp is deployed in-cluster or as a service. So what would be cool here is a way for running Headlamp with pre-filled settings, but we don't have a good solution for this ATM. I would say it's more important to have bulk deletion than a way to avoid it in RO envs, so we can keep your solution if there's no way or half way to check for permissions in bulk... |
For the switch: Do you think it is better to use a single switch or a switch for every cluster? |
It would be a switch for every cluster, but I don't think we should add the switch for now, as it won't make much difference since it's the end user themselves, not an admin, that would have to set the preference. And there's no big gain in that, since our concern here is to have people eventually trying to delete resources in a Headlamp that's been deployed for them, not in their own desktop deployment. So for now we can leave that functionality as an exception to our overall UI controls philosophy IMO. |
@joaquimrocha What is your plan now? Keep the current state and probably add a beta flag to it. Or do we need to do more merging? |
dbd5e96
to
26f6337
Compare
@joaquimrocha I added a beta mark to deleting items |
Sorry I couldn't reply earlier, and that I wasn't clearer in my previous message. In the meanwhile, I have a few more points to discuss: I don't think a beta flag is needed, but I wonder if we should have a REACT_APP*_ flag to enable it (we use this to change some things, like the product name). This would enable/disable the feature be for all clusters, so it could give the ability for someone deploying a read-only Headlamp to turn this feature off. Some changes needed already: |
e148634
to
b91cd2a
Compare
@joaquimrocha I've grouped the deletion. "Event shows a number"
I just used the design which react table is providing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a couple of comments but overall is looking good.
Also, the UX feels very slow. Takes sometimes 2 seconds for an item to be selected when in dev mode. Dev mode is admittedly very slow, but maybe @sniok knows whether there's something we can do to speed this up.
frontend/src/components/common/Resource/DeleteMultipleButton.tsx
Outdated
Show resolved
Hide resolved
clonedItems.forEach(item => { | ||
item.delete(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we could run these in a promise and wait for all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will check it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think?
Signed-off-by: farodin91 <[email protected]>
b91cd2a
to
5fac47e
Compare
@joaquimrocha i merged the branch table-pref into this branch and it was quite fast. |
* allow row selection * externalize logic Signed-off-by: farodin91 <[email protected]>
5fac47e
to
bff6644
Compare
Fixes #1640, #1604
screenshots:
folllow up: