Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit 95fb0bd

Browse files
authored
Suppport new version of MASS (#239)
1 parent 4c4ec99 commit 95fb0bd

File tree

12 files changed

+210
-128
lines changed

12 files changed

+210
-128
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-portal-ui",
3-
"version": "1.2.3",
3+
"version": "1.3.0",
44
"private": true,
55
"dependencies": {
66
"@fortawesome/fontawesome-svg-core": "~6.4.2",

src/api/browse.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type getDatasetsSearchRespType = (
2929
* function with search results, returns nothing.
3030
* @param callbackFunc - Function takes an argument conforms to the searchResponseModel.
3131
* @param filterQuery - Filters to be applied, array of objects that conform to the facetFilterModel.
32-
* @param searchKeyword - String representing the search keyword. Default: "*".
32+
* @param searchKeyword - String representing the search keyword. Default: "".
3333
* @param skip - Number of results to skip in the search results. Default: 0.
3434
* @param limit - Maximum number of results to be returned by the search. Default: 20.
3535
* @param documentType - String representing the document type to search. Default: "Dataset".
@@ -43,16 +43,18 @@ export const querySearchService: getDatasetsSearchRespType = async (
4343
limit = 20,
4444
documentType = "EmbeddedDataset"
4545
) => {
46-
let url = new URL("rpc/search", MASS_URL);
47-
const payload = {
48-
class_name: documentType,
49-
query: searchKeyword,
50-
filters: filterQuery,
51-
skip: skip,
52-
limit: limit,
53-
};
46+
let url = new URL("search", MASS_URL);
47+
const params = url.searchParams;
48+
params.append("class_name", documentType);
49+
if (searchKeyword) params.append("query", searchKeyword);
50+
filterQuery.forEach((filter) => {
51+
params.append("filter_by", filter.key);
52+
params.append("value", filter.value);
53+
});
54+
if (skip) params.append("skip", skip.toString());
55+
params.append("limit", limit.toString());
5456
try {
55-
const response = await fetchJson(url, "POST", payload);
57+
const response = await fetchJson(url, "GET");
5658
const data = await response.json();
5759
if (response.status !== 200) {
5860
throw new Error(`Status code ${response.status} in search response`);

src/components/browse/dataset/datasetAccordion/datasetAccordion.tsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,20 @@ const DatasetAccordion = (props: DataSetListProps) => {
3939
{props.dsList.map((hit, index) => (
4040
<Accordion.Item
4141
key={index}
42-
eventKey={hit.content.accession}
42+
eventKey={hit.id_}
4343
className="mb-3 border border-1 rounded-0"
4444
title={hit.content.title}
4545
>
4646
<Accordion.Button
4747
className="bg-light align-items-start text-break py-2 px-1 px-lg-2 text-black"
48-
onClick={() => getDetails(hit.content.accession)}
48+
onClick={() => getDetails(hit.id_)}
4949
>
5050
<Col xs={5} sm={4} xl={3}>
51-
{hit.content.accession}
52-
{hit.content.ega_accession ? (
51+
{hit.id_}
52+
{hit.content.alias ? (
5353
<>
5454
<br />
55-
{hit.content.ega_accession}
55+
{hit.content.alias}
5656
</>
5757
) : (
5858
""
@@ -74,10 +74,7 @@ const DatasetAccordion = (props: DataSetListProps) => {
7474
</Col>
7575
</Accordion.Button>
7676
<Accordion.Body className="p-2">
77-
<DatasetSummary
78-
hit={hit}
79-
summary={summaryMap.get(hit.content.accession)}
80-
/>
77+
<DatasetSummary hit={hit} summary={summaryMap.get(hit.id_)} />
8178
</Accordion.Body>
8279
</Accordion.Item>
8380
))}

src/components/browse/dataset/datasetAccordion/datasetSummary/boldenedSummaryDetails/boldenedSummaryDetails.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interface BoldenedProps {
66
const BoldenedSummaryDetails = (props: BoldenedProps) => {
77
return (
88
<div>
9-
{props.x.value} <strong>{props.x.count}</strong>
9+
{props.x.value.replace(/_/g, " ")} <strong>{props.x.count}</strong>
1010
</div>
1111
);
1212
};

src/components/browse/dataset/datasetAccordion/datasetSummary/datasetSummary.tsx

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ const DatasetSummary = (props: DataSetDetailsProps) => {
4343
<div className="float-end ps-0 ps-md-4 ms-1">
4444
{props.summary ? (
4545
<>
46-
{props.hit.content.ega_accession ? (
46+
{props.hit.content.alias ? (
4747
<Button
4848
variant="outline-quinary"
4949
href={
5050
"https://ega-archive.org/datasets/" +
51-
props.hit.content.ega_accession
51+
props.hit.content.alias
5252
}
5353
className="mb-3 fs-7 shadow-md-dark d-block"
5454
title="EGA Dataset page"
@@ -68,11 +68,11 @@ const DatasetSummary = (props: DataSetDetailsProps) => {
6868
<></>
6969
)}
7070
<RequestAccessButton
71-
accession={props.hit.content.accession}
71+
accession={props.hit.id_}
7272
handleOpen={handleOpen}
7373
classes="d-block"
7474
/>
75-
<Link to={props.hit.content.accession}>
75+
<Link to={props.hit.id_}>
7676
<Button
7777
variant="quinary"
7878
className="text-white mb-3 fs-7 shadow-md-dark d-block"
@@ -110,12 +110,12 @@ const DatasetSummary = (props: DataSetDetailsProps) => {
110110
<div className="text-break mb-3">
111111
<p className={pClass}>
112112
<strong>Dataset ID:&nbsp;</strong>
113-
{props.hit.content.accession}
113+
{props.hit.id_}
114114
</p>
115-
{props.hit.content.ega_accession ? (
115+
{props.hit.content.alias ? (
116116
<p className={pClass}>
117117
<strong>EGA ID:&nbsp;</strong>
118-
{props.hit.content.ega_accession}
118+
{props.hit.content.alias}
119119
</p>
120120
) : (
121121
<></>
@@ -124,21 +124,31 @@ const DatasetSummary = (props: DataSetDetailsProps) => {
124124
<strong>Full title:&nbsp;</strong>
125125
{props.hit.content.title}
126126
</p>
127-
<p className={pClass}>
128-
<strong>Description:&nbsp;</strong>
129-
{props.hit.content.description}
130-
</p>
131-
<p className={pClass}>
132-
<strong>Types:&nbsp;</strong>
133-
{props.hit.content.types.map((x) => (
134-
<Badge
135-
className="me-1 bg-white text-black border-primary border px-1 fw-normal"
136-
key={x}
137-
>
138-
{x}
139-
</Badge>
140-
))}
141-
</p>
127+
{props.hit.content.description || props.summary?.description ? (
128+
<p className={pClass}>
129+
<strong>Description:&nbsp;</strong>
130+
{props.hit.content.description || props.summary?.description}
131+
</p>
132+
) : (
133+
<></>
134+
)}
135+
{(props.hit.content.types || props.summary?.types || []).length ? (
136+
<p className={pClass}>
137+
<strong>Types:&nbsp;</strong>
138+
{(props.hit.content.types || props.summary?.types || []).map(
139+
(x) => (
140+
<Badge
141+
className="me-1 bg-white text-black border-primary border px-1 fw-normal"
142+
key={x}
143+
>
144+
{x}
145+
</Badge>
146+
)
147+
)}
148+
</p>
149+
) : (
150+
<></>
151+
)}
142152
</div>
143153
{props.summary ? (
144154
<div>
@@ -163,7 +173,7 @@ const DatasetSummary = (props: DataSetDetailsProps) => {
163173
)}
164174
</div>
165175
<DataRequestFormModal
166-
accession={props.hit.content.accession}
176+
accession={props.hit.id_}
167177
copyEmail={copyEmail}
168178
show={show}
169179
handleClose={handleClose}

src/components/browse/dataset/datasetList.tsx

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,31 @@ const DatasetList = (props: DataSetProps) => {
9494
<PaginatedDataset />
9595
</Col>
9696
<Col xs={4} md={2} className="ps-0 ps-lg-4 pe-0">
97-
<Form.Select
98-
value={props.limit}
99-
onChange={(event) => handleSelect(event)}
100-
>
101-
<option value="10">10</option>
102-
{props.dsCount >= 25 ? <option value="25">25</option> : ""}
103-
</Form.Select>
97+
{(props.page - 1) * 50 <= props.dsCount ? (
98+
<Form.Select
99+
value={props.limit}
100+
onChange={(event) => handleSelect(event)}
101+
>
102+
<option value="10">10</option>
103+
<option value="25">25</option>
104+
<option value="50">50</option>
105+
</Form.Select>
106+
) : (props.page - 1) * 25 <= props.dsCount ? (
107+
<Form.Select
108+
value={props.limit}
109+
onChange={(event) => handleSelect(event)}
110+
>
111+
<option value="10">10</option>
112+
<option value="25">25</option>
113+
</Form.Select>
114+
) : (
115+
<Form.Select
116+
value={props.limit}
117+
onChange={(event) => handleSelect(event)}
118+
>
119+
<option value="10">10</option>
120+
</Form.Select>
121+
)}
104122
</Col>
105123
</Row>
106124
</>

src/components/browse/sidebar/sidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const Sidebar = (props: SidebarProps) => {
5454
querySearchService(
5555
props.setSearchResults,
5656
[],
57-
"*",
57+
"",
5858
skip,
5959
props.limit,
6060
"EmbeddedDataset"

src/components/home/homeMidSection/homeMidSection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ const HomeMidSection = () => {
114114
{protocolTypes.map((x) => (
115115
<tr key={x.value}>
116116
<th className="text-end pe-2">{x.count}</th>
117-
<td>{x.value}</td>
117+
<td>{x.value.replace(/_/g, " ")}</td>
118118
</tr>
119119
))}
120120
</tbody>

0 commit comments

Comments
 (0)