-
Notifications
You must be signed in to change notification settings - Fork 49
chore: restructure and test groups #1894
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
base: master
Are you sure you want to change the base?
chore: restructure and test groups #1894
Conversation
Reviewer's GuideThis PR restructures the groups feature by separating the legacy implementation from a new DataView-based UI: it renames and guards the legacy component, introduces a modern Groups container with DataViewToolbar and debounced fetch logic, extracts a dedicated GroupsTable component with expandable rows and selection, adds new action and modal components (GroupActionsMenu, EditGroupModal, RemoveGroupModal, EmptyGroupsState) with corresponding TypeScript types, updates routing to reference the legacy entrypoint, tweaks ModalFormTemplate by removing an extraneous role attribute, and enriches Storybook with comprehensive stories for both legacy and new components. Class diagram for new Groups feature structureclassDiagram
class Groups {
+useContext(PermissionsContext)
+useSelector(RBACStore)
+useDataViewFilters()
+fetchData()
+handleRowSelection()
+handleExpansion()
+handleSort()
+handleCreateGroup()
+handleEditGroup()
+handleDeleteGroups()
}
class GroupsTable {
+groups: Group[]
+isLoading: boolean
+isAdmin: boolean
+selectedRows: Group[]
+expandedCells: ExpandedCells
+sortByState: SortByState
+onRowSelection()
+onExpansion()
+onSort()
+onEditGroup()
+onDeleteGroups()
}
class GroupActionsMenu {
+selectedRows: Group[]
+onCreateGroup()
+onEditGroup()
+onDeleteGroups()
}
class EditGroupModal {
+group: Group
+isOpen: boolean
+onClose()
+onSubmit()
+isSubmitting: boolean
}
class RemoveGroupModal {
+groups: Group[]
+isOpen: boolean
+onClose()
+onConfirm()
+isRemoving: boolean
+isLoading: boolean
}
class Group {
+uuid: string
+name: string
+description: string
+principalCount: number | string
+roleCount: number
+policyCount: number
+platform_default: boolean
+admin_default: boolean
+system: boolean
+created: string
+modified: string
+roles: RoleWithAccess[]
+isLoadingRoles: boolean
+members: PrincipalIn[]
+isLoadingMembers: boolean
}
Groups --> GroupsTable
GroupsTable --> GroupActionsMenu
GroupsTable --> Group
Groups --> EditGroupModal
Groups --> RemoveGroupModal
EditGroupModal --> Group
RemoveGroupModal --> Group
Class diagram for legacy and new groups entrypointsclassDiagram
class groups_legacy {
// Legacy groups implementation
}
class Groups {
// New DataView-based groups implementation
}
Routing o-- groups_legacy : now references
Routing o-- Groups : (not default)
Class diagram for new Group typesclassDiagram
class Group {
+uuid: string
+name: string
+description?: string
+principalCount?: number | string
+roleCount?: number
+policyCount?: number
+platform_default?: boolean
+admin_default?: boolean
+system?: boolean
+created?: string
+modified?: string
+roles?: RoleWithAccess[]
+isLoadingRoles?: boolean
+members?: PrincipalIn[]
+isLoadingMembers?: boolean
}
class GroupsTableProps {
+groups: Group[]
+isLoading: boolean
+isAdmin: boolean
+selectedRows: Group[]
+expandedCells: ExpandedCells
+sortByState: SortByState
+hasActiveFilters: boolean
+onRowSelection(newSelection: Group[]): void
+onExpansion(groupId: string, columnKey: string, isExpanding: boolean): void
+onSort(event: any, index: number, direction: 'asc' | 'desc'): void
+onEditGroup(groupId: string): void
+onDeleteGroups(groupIds: string[]): void
}
Group <.. GroupsTableProps : used by
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
6f349c4
to
c47628e
Compare
this also improves some shared utilities around modals to drop an unnecessary role attribute, and simplifies the code already committed that was using react-data-view to be easier to read
c47628e
to
c635da1
Compare
Description
description text...
RHCLOUDXXXX
Screenshots
Before:
After:
Checklist ☑️
Summary by Sourcery
Restructure the groups feature by introducing a new DataView-based implementation and refactoring table and modal logic into modular components. Enhance Storybook coverage with interactive tests, update routing to support the legacy component, and adjust default group fetching to respect admin permissions.
New Features:
Bug Fixes:
Enhancements:
Tests: