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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dashboards: Fix so that empty folders can be deleted from the manage dashboards/folders page #42527
Conversation
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.
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.
Looks good but I haven't had the chance to test it out (yet)
|
||
const canDelete = useMemo(() => { | ||
const somethingChecked = results.some((result) => result.checked || result.items.some((item) => item.checked)); |
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.
nit: I wonder if it would be worth to flatten everything and check for checked because using .some
in another .some
isn't super readable. I know I've been part of adding to this complexity in the past 馃檲 I guess as long we have good tests for these cases its not super important. 馃
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.
@hugohaggmark yeah agreed it's not super readable, but also didn't wanna flatten as that means we definitely have to go through the entire array. when using list view that means looping an array containing every dashboard that exists in your instance 馃槵 whereas with the .some
it shortcircuits that loop as soon as it finds one.
have moved the logic into a separate mini function instead. wdyt? 馃
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.
You're right! Looks better as a separate function.
@Clarity-89 i don't think this is easily possible as there's currently no real way to distinguish between an empty folder ( |
Just to clarify, if only one folder is selected, the message should say |
@Clarity-89 ahhhhh gotcha, that we can probably do. 馃憤 i thought you were referring to the |
* Manage dashboards: Can now delete empty folders * Split hasChecked out into a separate function * Update modal text (cherry picked from commit a365dcc)
This reverts commit a365dcc.
What this PR does / why we need it:
canDelete
is currently based oncanMove
, andcanMove
is only true if a dashboard is selected.canDelete
is enabled if anything is selected. this allows us to select empty folders, and also allows us to delete folders before they've been expanded.Which issue(s) this PR fixes:
Fixes #42486
Special notes for your reviewer: