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

Delete modal - create a shared delete modal, use for all deletions #312

Merged
merged 10 commits into from
Mar 9, 2021

Conversation

himdel
Copy link
Collaborator

@himdel himdel commented Mar 2, 2021

Fixes https://issues.redhat.com/browse/AAH-358

This unifies the confirmation modal for all deletions/removals in the app so that we're:

  • using a confirmation modal,
  • using patternfly title with titleVariant='warning' to fix the icon alignment in the header
  • the title has the second word lowercased (Delete user => Delete group)
  • there's a description, with the name of the deleted item in bold

It also adds a missing Delete button to the group detail screen (user detail has it),
tweaks .gitignore and .prettierignore to ignore vim swap files,
fixes a logo console warning,
and updates the Users tab in Group detail to work with 10+ users.
(I can split these off if needed :).)

Before:

Users > kebab Delete - icon alignment, missing bold

usersb

Users > detail > Delete - icon alignment, missing bold

userdb

Groups > Delete - icon alignment, missing description

groupsb

Groups > detail > Delete - no such button

groupdetb

Groups > detail > tab Users > kebab Remove - no confirmation modal, removed directly


After:

Users > kebab Delete

users

Users > detail > Delete

userd

Groups > Delete

groups

(see comments for a version with a list/count of users)

Groups > detail > Delete

groupdet
groupd

(see comments for a version with a list/count of users)

Groups > detail > tab Users > kebab Remove

groupuser


Question: right now, a group can be deleted even if it has users assigned to it. Should that be possible? Warning at least?
Resolved by showing a list of affected users.

himdel added 4 commits March 2, 2021 19:16
using title + titleVariant instead of a custom modal header fixes the font size and icon alignment,
lowercasing the second word (Delete user => Delete group)
and adding a description with the name in bold
otherwise, `git commit` fails when a file is being edited, because prettier fails with

    [error] No parser could be inferred for file: src/containers/group-management/.group-detail.tsx.swp
also behaves the same way, alerts and redirects to group list after success
@himdel
Copy link
Collaborator Author

himdel commented Mar 2, 2021

@sbuenafe-rh can you review please? :) This should be unifying all the galaxy UI removal/deletion confirmation modals and aligning them with patternfly guidelines.

(And if you have any input on the question of deleting a group with users inside... :))

Copy link
Member

@ZitaNemeckova ZitaNemeckova left a comment

Choose a reason for hiding this comment

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

LGTM 👍 I'd like to get Susan's approval before merge.

@sbuenafe-rh
Copy link

@himdel The delete user and remove user from group modals look good.

Deleting a group's message needs to be reworked a little to mention that the users in this group will lose access. Not sure if we can list out the users...

@himdel
Copy link
Collaborator Author

himdel commented Mar 4, 2021

@sbuenafe-rh thanks :) would something like this make sense?

for a bit, if the users list is not already loaded (the blue bit is a small spinner, spinning):

spin

empty group:

none

nonempty group:

some

Any ideas how to deal with groups with 10+ users?
Maybe just "Multiple (64) users will lose access.."?

(WIP: right now this is only implemented on the group detail screen, and not limiting the number of users to display in the list, nor the list height; and the list should be sorted)

wip: deal with more users, list screen
@sbuenafe-rh
Copy link

@himdel looks good! For 10+ users, we could just state that deleting this group will affect [X] users.

himdel added 4 commits March 8, 2021 18:34
default sort pretended to be username but the list was unsorted until the sort order was changed
and there was only 1 page because the count came from results length, limited by page size
Introduced in ansible#248, PageHeader wraps logo in `a` by default and the logo became a Link, leading to `a > a > img`

We can override the upper `a` using `logoComponent` (https://www.patternfly.org/v4/components/page#pageheader), doing that.
@himdel
Copy link
Collaborator Author

himdel commented Mar 8, 2021

Thanks, updated... :)

For up to 10 items...

10

Over 10...

11

I've also fixed the Users tab in group detail to show more than 10 items, sorted by username,
moved the group deletion view logic to a shared modal and used this from the group-list, so both group deletions should behave the same now :).

Ready for more review :)

<Link
to={formatPath(Paths.searchByRepo, {
repo: this.state.selectedRepo,
})}
>
<SmallLogo alt={APPLICATION_NAME}></SmallLogo>
{children}
Copy link
Member

Choose a reason for hiding this comment

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

🎉

Verified

This commit was created on github.com and signed with GitHub’s verified signature. The key has expired.
Copy link
Member

@ZitaNemeckova ZitaNemeckova left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@ZitaNemeckova ZitaNemeckova merged commit 2502804 into ansible:master Mar 9, 2021
@himdel himdel deleted the delete-modal-358 branch March 9, 2021 13:28
@sbuenafe-rh
Copy link

@himdel When checking for affected users...will the Delete button be disabled?

@himdel
Copy link
Collaborator Author

himdel commented Mar 10, 2021

@sbuenafe-rh Right now, it won't be disabled.

My assumption was that you do know that you want to delete, and don't necessarily want to wait for the list of users to load.
(And if you're not sure, the message should hold you.)

But it can be easily disabled if you prefer :)

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.

None yet

3 participants