-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat: allow user to filter by access facet (#4133) * feat: updated access facet position in category group (#4133) --------- Co-authored-by: Fran McDade <[email protected]>
- Loading branch information
Showing
8 changed files
with
281 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export type PickSome<T, K extends keyof T> = { | ||
[P in K]: T[P]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
explorer/site-config/hca-dcp/cc-ma-dev/index/common/category.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { | ||
CategoryConfig, | ||
CategoryGroup, | ||
} from "@databiosphere/findable-ui/lib/config/entities"; | ||
import { mapSelectCategoryValue } from "../../../../../app/config/utils"; | ||
import { | ||
HCA_DCP_CATEGORY_KEY, | ||
HCA_DCP_CATEGORY_LABEL, | ||
} from "../../../category"; | ||
import { CATEGORY_GROUP } from "../../../dev/index/common/category"; | ||
import { mapAccessibleValue } from "./utils"; | ||
|
||
export const ACCESSIBLE: CategoryConfig = { | ||
key: HCA_DCP_CATEGORY_KEY.ACCESSIBLE, | ||
label: HCA_DCP_CATEGORY_LABEL.ACCESSIBLE, | ||
mapSelectCategoryValue: mapSelectCategoryValue(mapAccessibleValue), | ||
}; | ||
|
||
export const MA_CATEGORY_GROUP: Record<string, CategoryGroup> = { | ||
PROJECT: { | ||
...CATEGORY_GROUP.PROJECT, | ||
categoryConfigs: [...CATEGORY_GROUP.PROJECT.categoryConfigs, ACCESSIBLE], | ||
}, | ||
}; | ||
|
||
export const CATEGORY_GROUPS: CategoryGroup[] = [ | ||
MA_CATEGORY_GROUP.PROJECT, | ||
CATEGORY_GROUP.DONOR, | ||
CATEGORY_GROUP.SAMPLE, | ||
CATEGORY_GROUP.PROTOCOL, | ||
CATEGORY_GROUP.FILE, | ||
]; |
28 changes: 28 additions & 0 deletions
28
explorer/site-config/hca-dcp/cc-ma-dev/index/common/constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { | ||
ColumnConfig, | ||
ComponentConfig, | ||
} from "@databiosphere/findable-ui/lib/config/entities"; | ||
import { ProjectsResponse } from "../../../../../app/apis/azul/hca-dcp/common/responses"; | ||
import { PickSome } from "../../../../../app/common/types"; | ||
import * as C from "../../../../../app/components"; | ||
import * as V from "../../../../../app/viewModelBuilders/azul/hca-dcp/common/viewModelBuilders"; | ||
import { | ||
HCA_DCP_CATEGORY_KEY, | ||
HCA_DCP_CATEGORY_LABEL, | ||
} from "../../../category"; | ||
|
||
export const COLUMN: PickSome< | ||
Record<keyof typeof HCA_DCP_CATEGORY_KEY, ColumnConfig>, | ||
"ACCESSIBLE" | ||
> = { | ||
ACCESSIBLE: { | ||
componentConfig: { | ||
component: C.StatusBadge, | ||
viewBuilder: V.buildProjectAccess, | ||
} as ComponentConfig<typeof C.StatusBadge, ProjectsResponse>, | ||
disableSorting: true, | ||
header: HCA_DCP_CATEGORY_LABEL.ACCESSIBLE, | ||
id: HCA_DCP_CATEGORY_KEY.ACCESSIBLE, | ||
width: "auto", | ||
}, | ||
}; |
11 changes: 11 additions & 0 deletions
11
explorer/site-config/hca-dcp/cc-ma-dev/index/common/utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Returns "accessible" select category label for the given select category value. | ||
* @param value - Value. | ||
* @returns select category label. | ||
*/ | ||
export function mapAccessibleValue(value: string): string { | ||
if (value === "false") { | ||
return "Required"; | ||
} | ||
return "Granted"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.