Skip to content

Commit

Permalink
Added project shortname to filter. Resolves #1653.
Browse files Browse the repository at this point in the history
  • Loading branch information
MillenniumFalconMechanic authored and NoopDog committed Apr 20, 2021
1 parent 3e01802 commit b9b21d5
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion spa/src/app/files/_ngrx/files.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,6 @@ export class FilesEffects {
*/
private isAnyProjectSelected(searchTermsByFacetName: Map<string, Set<SearchTerm>>): boolean {

return searchTermsByFacetName.has(FileFacetName.PROJECT) || searchTermsByFacetName.has(FileFacetName.PROJECT_ID);
return searchTermsByFacetName.has(FileFacetName.PROJECT_ID);
}
}
3 changes: 1 addition & 2 deletions spa/src/app/files/_ngrx/search/search.selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ export const selectSelectedSearchTermsBySearchKey = createSelector(selectSearch,
// Selected project search terms - returns the current set of selected projects
export const selectSelectedProjectSearchTerms = createSelector(selectSearch, (state) => {
return state.selectedSearchTerms.filter((searchTerm: SearchTerm) => {
return searchTerm.getSearchKey() === FileFacetName.PROJECT ||
searchTerm.getSearchKey() === FileFacetName.PROJECT_ID;
return searchTerm.getSearchKey() === FileFacetName.PROJECT_ID;
});
});

Expand Down
3 changes: 1 addition & 2 deletions spa/src/app/files/entity/entity-request.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class EntityRequestService {
}

/**
* Remove project facet and/or project IDs from list of search terms as we do not want to restrict the table result
* Remove project ID facet from list of search terms as we do not want to restrict the table result
* set to just the selected project.
*
* @param {Map<string, Set<SearchTerm>>} searchTermsByFacetName
Expand All @@ -120,7 +120,6 @@ export class EntityRequestService {
searchTermsByFacetName: Map<string, Set<SearchTerm>>, selectedEntity: string): Map<string, Set<SearchTerm>> {

const filteredSearchTerms = new Map(searchTermsByFacetName);
filteredSearchTerms.delete(FileFacetName.PROJECT);
filteredSearchTerms.delete(FileFacetName.PROJECT_ID);
return filteredSearchTerms;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
export enum FileFacetNameDisplay {
"disease" = "Disease Status",
"libraryConstructionApproach" = "Library Construction Method",
"project" = "Project Label",
"projectId" = "Project",
"sampleEntityType" = "Sample Type",
"specimenOrgan" = "Organ",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ describe("SearchTermHttpService:", () => {
/**
* Confirm project facet is not added as a search term.
*/
it("excludes project facet from search terms", () => {
it("binds project facet in search terms", () => {

const searchTerms = searchTermHttpService.bindSearchTerms(PROJECTS_ENTITY_API_RESPONSE.termFacets);
expect(searchTerms).toBeTruthy();
const projectSearchTerm = searchTerms.find((searchTerm) => searchTerm.facetName === FileFacetName.PROJECT);
expect(projectSearchTerm).toBeFalsy();
expect(projectSearchTerm).toBeTruthy();
});


Expand Down
1 change: 1 addition & 0 deletions spa/src/app/files/search/http/search-term-http.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class SearchTermHttpService {
"organismAgeValue",
"pairedEnd",
"preservationMethod",
"project",
"projectTitle",
"publicationTitle",
"sampleDisease",
Expand Down

0 comments on commit b9b21d5

Please sign in to comment.