Skip to content

Commit b92ec50

Browse files
frano-mFran McDade
andauthored
feat: show access badge on detail page if auth is enabled (#897) (#3608)
* feat: show access badge on detail page if auth is enabled (#897) * feat: removed component from component export (#897) --------- Co-authored-by: Fran McDade <franmcdade@Frans-MacBook-Pro.local>
1 parent 0df1b8b commit b92ec50

File tree

9 files changed

+173
-178
lines changed

9 files changed

+173
-178
lines changed

explorer/app/apis/azul/anvil-cmg/common/entities.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,9 @@ export interface BioSampleEntityResponse {
4444
*/
4545
export interface DatasetEntity {
4646
accessible: boolean;
47-
consent_group: string;
47+
consent_group: (string | null)[];
4848
dataset_id: string;
49-
entity_description: string;
50-
registered_identifier: string;
49+
registered_identifier: (string | null)[];
5150
title: string;
5251
}
5352

explorer/app/apis/azul/anvil-cmg/common/transformers.ts

Lines changed: 2 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import { LABEL } from "@clevercanary/data-explorer-ui/lib/apis/azul/common/entities";
22
import { stringifyValues } from "@clevercanary/data-explorer-ui/lib/common/utils";
3-
import { Breadcrumb } from "@clevercanary/data-explorer-ui/lib/components/common/Breadcrumbs/breadcrumbs";
43
import {
54
Key,
65
KeyValues,
76
Value,
87
} from "@clevercanary/data-explorer-ui/lib/components/common/KeyValuePairs/keyValuePairs";
98
import { MetadataValue } from "@clevercanary/data-explorer-ui/lib/components/Index/components/NTagCell/nTagCell";
10-
import { Description } from "@clevercanary/data-explorer-ui/lib/components/Project/common/entities";
119
import { humanFileSize } from "../../../../utils/fileSize";
1210
import {
1311
processAggregatedOrArrayValue,
@@ -24,7 +22,6 @@ import {
2422
import {
2523
ActivityEntityResponse,
2624
BioSampleEntityResponse,
27-
DatasetEntityResponse,
2825
DonorEntityResponse,
2926
FileEntityResponse,
3027
LibraryEntityResponse,
@@ -72,8 +69,8 @@ export function getBioSampleType(response: BioSampleEntityResponse): string {
7269
* @param response - Response model return from biosamples API.
7370
* @returns Biosample type.
7471
*/
75-
export function getConsentGroup(response: DatasetEntityResponse): string {
76-
return processEntityValue(response.datasets, "consent_group");
72+
export function getConsentGroup(response: DatasetsResponse): string[] {
73+
return processAggregatedOrArrayValue(response.datasets, "consent_group");
7774
}
7875

7976
/**
@@ -87,40 +84,6 @@ export function getAggregatedBioSampleTypes(
8784
return processAggregatedOrArrayValue(response.biosamples, "biosample_type");
8885
}
8986

90-
/**
91-
* Returns dataset related breadcrumbs.
92-
* TODO revisit location
93-
* @param firstCrumb - First breadcrumb.
94-
* @param response - Response model return from datasets or dataset API endpoints.
95-
* @returns dataset breadcrumbs.
96-
*/
97-
export function getDatasetBreadcrumbs(
98-
firstCrumb: Breadcrumb,
99-
response: DatasetEntityResponse
100-
): Breadcrumb[] {
101-
const datasetName = getDatasetTitle(response);
102-
const breadcrumbs = [firstCrumb];
103-
if (datasetName) {
104-
breadcrumbs.push({ path: "", text: datasetName });
105-
}
106-
return breadcrumbs;
107-
}
108-
109-
/**
110-
* Maps dataset description from API response.
111-
* @param response - Response model return from datasets or dataset API endpoints.
112-
* @returns string representation of dataset description.
113-
*/
114-
export function getDatasetDescription(
115-
response: DatasetEntityResponse
116-
): Description {
117-
return processEntityValue(
118-
response.datasets,
119-
"entity_description",
120-
LABEL.NONE
121-
);
122-
}
123-
12487
/**
12588
* Maps dataset-related information, included formatted display text from API response.
12689
* @param response - Response model return from datasets or dataset API endpoints.
@@ -188,15 +151,6 @@ export function getDatasetEntryId(response: DatasetsResponse): string {
188151
return response.entryId ?? ""; // TODO throw on no ID?
189152
}
190153

191-
/**
192-
* Maps dataset title from the core dataset entity returned from the index/datasets endpoint.
193-
* @param response - Response model return from datasets or dataset API endpoints.
194-
* @returns Dataset title.
195-
*/
196-
export function getDatasetTitle(response: DatasetEntityResponse): string {
197-
return processEntityValue(response.datasets, "title", LABEL.NONE);
198-
}
199-
200154
/**
201155
* Maps dataset name from an aggregated datasets value returned from endpoints other than index/datasets.
202156
* @param response - Response model return from Azul that includes aggregated datasets.
@@ -352,17 +306,6 @@ export function getAggregatedPhenotypicSexes(
352306
return processAggregatedOrArrayValue(response.donors, "phenotypic_sex");
353307
}
354308

355-
/**
356-
* Maps registered identifier from the core dataset entity returned from the /index/datasets API response.
357-
* @param response - Response model return from index/datasets API endpoint.
358-
* @returns registered identifier.
359-
*/
360-
export function getRegisteredIdentifier(
361-
response: DatasetEntityResponse
362-
): string {
363-
return processEntityValue(response.datasets, "registered_identifier");
364-
}
365-
366309
/**
367310
* Maps reported ethnicities from the core donors value returned from the index/donors endpoint.
368311
* @param response - Response model return from index/donors API endpoint.

explorer/app/components/Index/components/AccessStatusBadge/accessStatusBadge.styles.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

explorer/app/components/Index/components/AccessStatusBadge/accessStatusBadge.tsx

Lines changed: 0 additions & 18 deletions
This file was deleted.

explorer/app/components/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export { Sections } from "@clevercanary/data-explorer-ui/lib/components/common/S
2121
export { Divider } from "@clevercanary/data-explorer-ui/lib/components/common/Stack/components/Divider/divider";
2222
export { Stack } from "@clevercanary/data-explorer-ui/lib/components/common/Stack/stack";
2323
export { StaticImage } from "@clevercanary/data-explorer-ui/lib/components/common/StaticImage/staticImage";
24+
export { StatusBadge } from "@clevercanary/data-explorer-ui/lib/components/common/StatusBadge/statusBadge";
2425
export { TagWarning } from "@clevercanary/data-explorer-ui/lib/components/common/Tag/tag.styles";
2526
export { DetailViewTable } from "@clevercanary/data-explorer-ui/lib/components/Detail/components/DetailViewTable/detailViewTable";
2627
export { DownloadCurlCommandForm } from "@clevercanary/data-explorer-ui/lib/components/Export/components/DownloadCurlCommand/components/DownloadCurlCommandForm/downloadCurlCommandForm";
@@ -66,5 +67,4 @@ export { FileLocationCopy } from "./Detail/components/GeneratedMatricesTables/co
6667
export { FileLocationDownload } from "./Detail/components/GeneratedMatricesTables/components/FileLocationDownload/fileLocationDownload";
6768
export { FileNameCell } from "./Detail/components/GeneratedMatricesTables/components/FileNameCell/fileNameCell";
6869
export { GeneratedMatricesTables } from "./Detail/components/GeneratedMatricesTables/generatedMatricesTables";
69-
export { AccessStatusBadge } from "./Index/components/AccessStatusBadge/accessStatusBadge";
7070
export { ConsentCodesCell } from "./Index/components/ConsentCodesCell/consentCodesCell";

0 commit comments

Comments
 (0)