Skip to content

Commit b323967

Browse files
feat: added direct request access link to DUOS dataset #4441 (#4442)
1 parent 7f302b2 commit b323967

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

app/apis/azul/hca-dcp/common/entities.ts

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export interface ProjectResponse {
8888
contributedAnalyses: ProjectResponseContributedAnalyses;
8989
contributors: ContributorResponse[];
9090
dataUseRestriction: string | null;
91+
duosId: string | null;
9192
estimatedCellCount: number | null;
9293
laboratory: (string | null)[];
9394
matrices: ProjectResponseMatrices;

app/viewModelBuilders/azul/hca-dcp/common/viewModelBuilders.ts

+18-1
Original file line numberDiff line numberDiff line change
@@ -2180,12 +2180,20 @@ function getProjectCallToAction(
21802180
if (!isReady || isAccessGranted) {
21812181
return null;
21822182
}
2183+
2184+
// Get the DUOS ID from the project API response. Use the generic DUOS URL if the project does not hav
2185+
// a DUOS ID.
2186+
const duosId = getProjectDuosId(projectsResponse);
2187+
const ctaUrl = duosId
2188+
? `https://duos.org/dataset/${duosId}`
2189+
: "https://duos.org/datalibrary/HCA";
2190+
21832191
return C.BackPageHeroActions({
21842192
callToActionProps: {
21852193
callToAction: {
21862194
label: "Request Access",
21872195
target: ANCHOR_TARGET.BLANK,
2188-
url: "https://duos.org/datalibrary/HCA",
2196+
url: ctaUrl,
21892197
},
21902198
},
21912199
linkProps: {
@@ -2196,6 +2204,15 @@ function getProjectCallToAction(
21962204
});
21972205
}
21982206

2207+
/**
2208+
* Returns the DUOS ID from the project API response.
2209+
* @param projectsResponse - Response model return from project API.
2210+
* @returns DUOS ID.
2211+
*/
2212+
function getProjectDuosId(projectsResponse: ProjectsResponse): string {
2213+
return processEntityValue(projectsResponse.projects, "duosId", LABEL.EMPTY);
2214+
}
2215+
21992216
/**
22002217
* Returns project file formats from the projects API response.
22012218
* @param projectsResponse - Response returned from projects API response.

0 commit comments

Comments
 (0)