Skip to content

Commit c75f065

Browse files
ac-jorellanafCito
andauthored
Supressed showing features with no values (GSI-1968) (#234)
* Supressed showing features with no values * Update src/mocks/data.ts Co-authored-by: Christoph Zwerschke <c.zwerschke@dkfz-heidelberg.de> Signed-off-by: Jordy <31940280+ac-jorellanaf@users.noreply.github.com> --------- Signed-off-by: Jordy <31940280+ac-jorellanaf@users.noreply.github.com> Co-authored-by: Christoph Zwerschke <c.zwerschke@dkfz-heidelberg.de>
1 parent 02431a1 commit c75f065

File tree

2 files changed

+60
-43
lines changed

2 files changed

+60
-43
lines changed

src/app/metadata/features/dataset-summary/dataset-summary.html

Lines changed: 46 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
<div class="pt-4 text-sm">
33
<div class="mb-4 flex flex-col gap-y-2 sm:float-right sm:w-52 md:ms-6 md:mb-4">
44
@if (hitContent().ega_accession !== '') {
5-
<a
6-
appExtLink
7-
mat-stroked-button
8-
class="larger-button-text"
9-
[href]="'https://ega-archive.org/datasets/' + hitContent().ega_accession"
10-
data-umami-event="Dataset Summary EGA Dataset Clicked"
11-
>EGA Dataset</a
12-
>
5+
<a
6+
appExtLink
7+
mat-stroked-button
8+
class="larger-button-text"
9+
[href]="'https://ega-archive.org/datasets/' + hitContent().ega_accession"
10+
data-umami-event="Dataset Summary EGA Dataset Clicked"
11+
>EGA Dataset</a
12+
>
1313
}
1414
<app-dynamic-access-request-button datasetID="{{ hit().id_ }}" />
1515
<a
@@ -22,7 +22,7 @@
2222
</div>
2323
<p class="*:mb-0.5"><strong>Dataset ID:</strong> {{ summary().accession }}</p>
2424
@if (hitContent().ega_accession) {
25-
<p><strong>EGA ID:</strong> {{ hitContent().ega_accession }}</p>
25+
<p><strong>EGA ID:</strong> {{ hitContent().ega_accession }}</p>
2626
}
2727
<p class="*:mb-0.5"><strong>Full title:</strong> {{ summary().title }}</p>
2828
<app-paragraphs
@@ -31,14 +31,14 @@
3131
pClasses="text-sm mb-0.5"
3232
/>
3333
@if (summary().types.length) {
34-
<div class="flex flex-wrap items-baseline">
35-
<strong>Types:&nbsp;</strong>
36-
<mat-chip-set>
37-
@for (type of summary().types; track type) {
38-
<mat-chip class="small-chip mr-1 text-sm">{{ type }}</mat-chip>
39-
}
40-
</mat-chip-set>
41-
</div>
34+
<div class="flex flex-wrap items-baseline">
35+
<strong>Types:&nbsp;</strong>
36+
<mat-chip-set>
37+
@for (type of summary().types; track type) {
38+
<mat-chip class="small-chip mr-1 text-sm">{{ type }}</mat-chip>
39+
}
40+
</mat-chip-set>
41+
</div>
4242
}
4343
<div
4444
class="mt-8 mb-4 *:flex *:grow *:flex-col *:gap-y-8 sm:flex *:sm:mb-0 *:sm:max-w-[50%] *:sm:overflow-x-auto lg:pe-[15%]"
@@ -72,23 +72,28 @@
7272
<strong>Sample info:</strong>
7373
<p>
7474
<strong>{{ samplesSummary().count }}</strong> Sample{{
75-
samplesSummary().count | addPluralS }} @if (samplesSex().length) { (Sex:
76-
@for (sex of samplesSex(); track sex.value; let last = $last) { {{
77-
sex.count }} {{ sex.value }}{{ last ? ')' : ', ' }} } }
78-
</p>
79-
<p>
80-
<strong>{{ samplesTissues().length }}</strong>
81-
Tissue{{ samplesTissues().length | addPluralS }}
75+
samplesSummary().count | addPluralS
76+
}}
77+
@if (samplesSex().length) {
78+
(Sex:
79+
@for (sex of samplesSex(); track sex.value; let last = $last) {
80+
{{ sex.count }} {{ sex.value }}{{ last ? ')' : ', ' }}
81+
}
82+
}
8283
</p>
8384
@if (samplesTissues().length > 0) {
84-
<app-summary-badges [data]="samplesTissues()" />
85+
<p>
86+
<strong>{{ samplesTissues().length }}</strong>
87+
Tissue{{ samplesTissues().length | addPluralS }}
88+
</p>
89+
<app-summary-badges [data]="samplesTissues()" />
8590
}
86-
<p>
87-
<strong>{{ samplesPhenotypes().length }}</strong>
88-
Phenotypic Feature{{ samplesPhenotypes().length | addPluralS }}
89-
</p>
9091
@if (samplesPhenotypes().length > 0) {
91-
<app-summary-badges [data]="samplesPhenotypes()" />
92+
<p>
93+
<strong>{{ samplesPhenotypes().length }}</strong>
94+
Phenotypic Feature{{ samplesPhenotypes().length | addPluralS }}
95+
</p>
96+
<app-summary-badges [data]="samplesPhenotypes()" />
9297
}
9398
</div>
9499
</div>
@@ -101,11 +106,12 @@
101106
<div class="*:mb-0.5">
102107
<strong>File Summary:</strong>
103108
<p>
104-
<strong>{{ filesSummary().count }}</strong> File{{ filesSummary().count |
105-
addPluralS }}
109+
<strong>{{ filesSummary().count }}</strong> File{{
110+
filesSummary().count | addPluralS
111+
}}
106112
</p>
107113
@if (filesSummary().count > 0) {
108-
<app-summary-badges [data]="filesFormats()" />
114+
<app-summary-badges [data]="filesFormats()" />
109115
}
110116
</div>
111117
</div>
@@ -118,14 +124,15 @@
118124
<strong>Experiments Summary:</strong>
119125
<p>
120126
<strong>{{ experimentsSummary().count }}</strong> Experiment{{
121-
experimentsSummary().count | addPluralS }}
122-
</p>
123-
<p>
124-
<strong>{{ experimentsPlatforms().length }} </strong>
125-
Platform{{ experimentsPlatforms().length | addPluralS }}
127+
experimentsSummary().count | addPluralS
128+
}}
126129
</p>
127130
@if (experimentsPlatforms().length > 0) {
128-
<app-summary-badges [data]="experimentsPlatforms()" />
131+
<p>
132+
<strong>{{ experimentsPlatforms().length }} </strong>
133+
Platform{{ experimentsPlatforms().length | addPluralS }}
134+
</p>
135+
<app-summary-badges [data]="experimentsPlatforms()" />
129136
}
130137
</div>
131138
</div>

src/mocks/data.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,20 @@ export const allIvasOfMar = allIvas.filter((iva) => iva.user_id === 'mar@test.de
229229
*/
230230

231231
// get dataset summaries with arbitrary accessions
232-
export const getDatasetSummary = (accession: string) => ({
233-
...datasetSummary,
234-
accession: accession,
235-
});
232+
// get dataset summaries with arbitrary accessions
233+
export const getDatasetSummary = (accession: string) => {
234+
const summary = structuredClone(datasetSummary);
235+
if (accession === 'GHGAD12345678901236') {
236+
// this is to test the rendering of empty stats
237+
summary.samples_summary.stats.phenotypic_features =
238+
summary.experiments_summary.stats.experiment_methods =
239+
summary.files_summary.stats.format =
240+
summary.samples_summary.stats.tissues =
241+
[];
242+
}
243+
summary.accession = accession;
244+
return summary;
245+
};
236246

237247
// get embedded datasets with arbitrary accessions
238248
export const getDatasetDetails = (accession: string) => ({

0 commit comments

Comments
 (0)