Skip to content

Commit

Permalink
Add Clear Groups button (#3445)
Browse files Browse the repository at this point in the history
Co-authored-by: Mia Mijovic <[email protected]>
  • Loading branch information
mijovicmia and Mia Mijovic authored Mar 5, 2024
1 parent c24869d commit 827a2de
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export interface JobsTableActionBarProps {
getJobsService: IGetJobsService
updateJobsService: UpdateJobsService
onClearFilters: () => void
onClearGroups: () => void
onAddCustomView: (name: string) => void
onDeleteCustomView: (name: string) => void
onLoadCustomView: (name: string) => void
Expand All @@ -62,6 +63,7 @@ export const JobsTableActionBar = memo(
getJobsService,
updateJobsService,
onClearFilters,
onClearGroups,
onAddCustomView,
onDeleteCustomView,
onLoadCustomView,
Expand Down Expand Up @@ -123,6 +125,9 @@ export const JobsTableActionBar = memo(
<Button variant="text" onClick={onClearFilters} color="secondary">
Clear Filters
</Button>
<Button variant="text" onClick={onClearGroups} color="secondary">
Clear Groups
</Button>
<CustomViewPicker
customViews={customViews}
onAddCustomView={onAddCustomView}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,18 @@ export const JobsTableContainer = ({
setParseErrors({})
}

const clearGroups = () => {
// Set grouping to an empty array to clear all groups
onGroupingChange([])

// Reset expanded states as no groups will exist
setExpanded({})

// Clear any related UI states if necessary
// For example, resetting selection
setSelectedRows({})
}

const shiftSelectRow = async (row: Row<JobTableRow>) => {
if (lastSelectedRow === undefined || row.depth !== lastSelectedRow.depth) {
return
Expand Down Expand Up @@ -767,6 +779,7 @@ export const JobsTableContainer = ({
getJobsService={getJobsService}
updateJobsService={updateJobsService}
onClearFilters={clearFilters}
onClearGroups={clearGroups}
onAddCustomView={addCustomView}
onDeleteCustomView={deleteCustomView}
onLoadCustomView={loadCustomView}
Expand Down

0 comments on commit 827a2de

Please sign in to comment.