Skip to content

Commit

Permalink
Merge pull request #3492 from broadinstitute/per-project-family-filter
Browse files Browse the repository at this point in the history
Support per project family-table-filters.
  • Loading branch information
ShifaSZ authored Jul 18, 2023
2 parents 182b2b2 + 8cbc8aa commit 58d7c47
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 5 additions & 2 deletions ui/pages/Project/reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,10 @@ export const updateFamiliesTable = (updates, tableName) => (
{ type: tableName === CASE_REVIEW_TABLE_NAME ? UPDATE_CASE_REVIEW_TABLE_STATE : UPDATE_FAMILY_TABLE_STATE, updates }
)

export const updateFamiliesTableFilters = updates => ({ type: UPDATE_FAMILY_TABLE_FILTER_STATE, updates })
export const updateFamiliesTableFilters = updates => (dispatch, getState) => {
const { currentProjectGuid } = getState()
dispatch({ type: UPDATE_FAMILY_TABLE_FILTER_STATE, updatesById: { [currentProjectGuid]: updates } })
}

export const updateSavedVariantTable = updates => ({ type: UPDATE_SAVED_VARIANT_TABLE_STATE, updates })

Expand All @@ -396,7 +399,7 @@ export const reducers = {
familiesSortOrder: SORT_BY_FAMILY_NAME,
familiesSortDirection: 1,
}, false),
familyTableFilterState: createSingleObjectReducer(UPDATE_FAMILY_TABLE_FILTER_STATE),
familyTableFilterState: createObjectsByIdReducer(UPDATE_FAMILY_TABLE_FILTER_STATE),
caseReviewTableState: createSingleObjectReducer(UPDATE_CASE_REVIEW_TABLE_STATE, {
familiesFilter: SHOW_IN_REVIEW,
familiesSortOrder: SORT_BY_FAMILY_ADDED_DATE,
Expand Down
8 changes: 7 additions & 1 deletion ui/pages/Project/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const getMmeSubmissionsLoading = state => state.mmeSubmissionsLoading.isL
export const getSamplesLoading = state => state.samplesLoading.isLoading
export const getTagTypesLoading = state => state.tagTypesLoading.isLoading
export const getFamilyTagTypeCounts = state => state.familyTagTypeCounts
export const getFamiliesTableFilters = state => state.familyTableFilterState
const getFamiliesTableFiltersByProject = state => state.familyTableFilterState

export const getCurrentProject = createSelector(
getProjectsByGuid, getProjectGuid, (projectsByGuid, currentProjectGuid) => projectsByGuid[currentProjectGuid],
Expand Down Expand Up @@ -432,6 +432,12 @@ const analysedByFilters = (filter, analysedByOptions) => {
return filterGroups
}

export const getFamiliesTableFilters = createSelector(
getFamiliesTableFiltersByProject,
getProjectGuid,
(familyTableFiltersByProject, projectGuid) => (familyTableFiltersByProject || {})[projectGuid],
)

const getFamiliesFilterFunc = createSelector(
(state, ownProps) => ownProps?.tableName === CASE_REVIEW_TABLE_NAME,
state => state.caseReviewTableState.familiesFilter,
Expand Down

0 comments on commit 58d7c47

Please sign in to comment.