Skip to content

Commit 9e8ccd0

Browse files
feat(statistics): SJIP-1378 render optional download actions (Ferlab-Ste-Justine#616)
1 parent bf208a9 commit 9e8ccd0

File tree

5 files changed

+45
-24
lines changed

5 files changed

+45
-24
lines changed

packages/ui/Release.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
### 10.25.2 2025-06-16
2+
- feat: SJIP-1378 entity statistics download optionnal
3+
14
### 10.25.1 2025-06-11
25
- fix: SJIP-1370 increase legend width for demographic chart
36

packages/ui/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.

packages/ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ferlab/ui",
3-
"version": "10.25.1",
3+
"version": "10.25.2",
44
"description": "Core components for scientific research data portals",
55
"publishConfig": {
66
"access": "public"
Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11
.resizableCard {
2-
height: 100%;
3-
width: 100%;
2+
height: 100%;
3+
width: 100%;
44
}
55
.resizableCard .cardHeader {
6-
font-size: 12px;
6+
font-size: 12px;
7+
min-height: 24px;
78
}
89
.resizableCard .extra {
9-
display: flex;
10-
padding-right: 8px;
10+
display: flex;
11+
padding-right: 8px;
1112
}
1213
.resizableCard .extra .dropdownMenu :global(.ant-btn-compact-first-item) {
13-
display: none;
14+
display: none;
1415
}
1516
.resizableCard .extra .dropdownMenu :global(.ant-btn-compact-last-item) {
16-
width: 20px;
17+
width: 20px;
1718
}
1819
.resizableCard .extra .dropdownMenu :global(.ant-btn-text) {
19-
color: var(--chart-title-color) !important;
20+
color: var(--chart-title-color) !important;
2021
}
2122
.resizableCard .extra .button {
22-
width: 20px;
23-
color: var(--chart-title-color) !important;
23+
width: 20px;
24+
color: var(--chart-title-color) !important;
2425
}
2526

2627
.modalContentWrapper {
27-
position: relative;
28+
position: relative;
2829
}

packages/ui/src/pages/EntityPage/EntityStatistics/index.tsx

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ export interface IEntityStatistics {
140140
header: string;
141141
statistic: TStatistic;
142142
dictionary: TEntityStatisticsDictionary;
143+
withDownload?: boolean;
143144
}
144145

145146
const resizableCardCommonsSettings = {
@@ -151,6 +152,15 @@ const resizableCardCommonsSettings = {
151152
},
152153
withHandle: false,
153154
};
155+
const resizableCardCommonsWithoutDownloadSettings = {
156+
closeHandle: false,
157+
downloadSettings: {
158+
png: false,
159+
svg: false,
160+
tsv: false,
161+
},
162+
withHandle: false,
163+
};
154164

155165
const pieChartCommonsSettings = {
156166
margin: {
@@ -222,7 +232,9 @@ const applyFilter = ({ data, filter }: TStatisticBarChart | TStatisticPieChart,
222232

223233
const LEGEND_ITEM_HEIGHT = 18;
224234

225-
const getStatisticLayouts = (statistic: TStatistic, dictionary: TEntityStatisticsDictionary) => {
235+
type getStatisticLayouts = { statistic: TStatistic; dictionary: TEntityStatisticsDictionary; withDownload?: boolean };
236+
237+
const getStatisticLayouts = ({ dictionary, statistic, withDownload = true }: getStatisticLayouts) => {
226238
const phenotypesData = applyFilter(statistic.phenotype, 'label');
227239
const mondoData = applyFilter(statistic.mondo, 'label');
228240
const downSyndromeStatusData = applyFilter(statistic.downSyndromeStatus);
@@ -231,6 +243,10 @@ const getStatisticLayouts = (statistic: TStatistic, dictionary: TEntityStatistic
231243
const dataCategoryData = applyFilter(statistic.dataCategory);
232244
const dataTypeData = applyFilter(statistic.dataType);
233245

246+
const resizableCardSettings = withDownload
247+
? resizableCardCommonsSettings
248+
: resizableCardCommonsWithoutDownloadSettings;
249+
234250
return [
235251
// Phenotypes (HPO) (Vertical Bar Chart)
236252
{
@@ -318,7 +334,7 @@ const getStatisticLayouts = (statistic: TStatistic, dictionary: TEntityStatistic
318334
data: [phenotypesData],
319335
headers: ['Value', 'Count'],
320336
}}
321-
{...resizableCardCommonsSettings}
337+
{...resizableCardSettings}
322338
/>
323339
),
324340
id: 'phenotypes',
@@ -416,7 +432,7 @@ const getStatisticLayouts = (statistic: TStatistic, dictionary: TEntityStatistic
416432
data: [mondoData],
417433
headers: ['Value', 'Count'],
418434
}}
419-
{...resizableCardCommonsSettings}
435+
{...resizableCardSettings}
420436
/>
421437
),
422438
id: 'mondo',
@@ -556,7 +572,7 @@ const getStatisticLayouts = (statistic: TStatistic, dictionary: TEntityStatistic
556572
tsvSettings={{
557573
data: [statistic.demography.sex, statistic.demography.race, statistic.demography.ethnicity],
558574
}}
559-
{...resizableCardCommonsSettings}
575+
{...resizableCardSettings}
560576
/>
561577
),
562578
id: 'demography',
@@ -626,7 +642,7 @@ const getStatisticLayouts = (statistic: TStatistic, dictionary: TEntityStatistic
626642
tsvSettings={{
627643
data: [downSyndromeStatusData],
628644
}}
629-
{...resizableCardCommonsSettings}
645+
{...resizableCardSettings}
630646
/>
631647
),
632648
id: 'down_syndrome',
@@ -696,7 +712,7 @@ const getStatisticLayouts = (statistic: TStatistic, dictionary: TEntityStatistic
696712
tsvSettings={{
697713
data: [sampleTypeData],
698714
}}
699-
{...resizableCardCommonsSettings}
715+
{...resizableCardSettings}
700716
/>
701717
),
702718
id: 'sample_type',
@@ -766,7 +782,7 @@ const getStatisticLayouts = (statistic: TStatistic, dictionary: TEntityStatistic
766782
tsvSettings={{
767783
data: [sampleAvailabilityData],
768784
}}
769-
{...resizableCardCommonsSettings}
785+
{...resizableCardSettings}
770786
/>
771787
),
772788
id: 'sample_availability',
@@ -879,7 +895,7 @@ const getStatisticLayouts = (statistic: TStatistic, dictionary: TEntityStatistic
879895
tsvSettings={{
880896
data: [dataCategoryData],
881897
}}
882-
{...resizableCardCommonsSettings}
898+
{...resizableCardSettings}
883899
/>
884900
),
885901
id: 'data-category',
@@ -992,7 +1008,7 @@ const getStatisticLayouts = (statistic: TStatistic, dictionary: TEntityStatistic
9921008
tsvSettings={{
9931009
data: [dataTypeData],
9941010
}}
995-
{...resizableCardCommonsSettings}
1011+
{...resizableCardSettings}
9961012
/>
9971013
),
9981014
id: 'data-type',
@@ -1038,8 +1054,9 @@ const EntityStatistics = ({
10381054
statistic,
10391055
title,
10401056
titleExtra,
1057+
withDownload = true,
10411058
}: IEntityStatistics): React.ReactElement => {
1042-
const defaultLayouts = getStatisticLayouts(statistic, dictionary);
1059+
const defaultLayouts = getStatisticLayouts({ dictionary, statistic, withDownload });
10431060
const layouts = serialize(defaultLayouts);
10441061

10451062
return (

0 commit comments

Comments
 (0)