@genspectrum/dashboard-components 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/mutationOverTimeWorker-BOCXtKzd.js.map +1 -1
- package/dist/dashboard-components.js +16 -4
- package/dist/dashboard-components.js.map +1 -1
- package/dist/genspectrum-components.d.ts +40 -40
- package/package.json +2 -2
- package/src/operator/SlidingOperator.ts +3 -0
- package/src/preact/components/error-display.tsx +1 -0
- package/src/preact/prevalenceOverTime/__mockData__/numeratorFilterNoData.json +11 -0
- package/src/preact/prevalenceOverTime/prevalence-over-time-bar-chart.tsx +13 -6
- package/src/preact/prevalenceOverTime/prevalence-over-time-bubble-chart.tsx +13 -6
- package/src/preact/prevalenceOverTime/prevalence-over-time-line-chart.tsx +13 -6
- package/src/preact/prevalenceOverTime/prevalence-over-time.stories.tsx +74 -11
- package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +1 -1
- package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.stories.tsx +12 -5
- package/standalone-bundle/dashboard-components.js +505 -493
- package/standalone-bundle/dashboard-components.js.map +1 -1
|
@@ -1039,10 +1039,7 @@ declare global {
|
|
|
1039
1039
|
|
|
1040
1040
|
declare global {
|
|
1041
1041
|
interface HTMLElementTagNameMap {
|
|
1042
|
-
'gs-
|
|
1043
|
-
}
|
|
1044
|
-
interface HTMLElementEventMap {
|
|
1045
|
-
'gs-date-range-changed': CustomEvent<Record<string, string>>;
|
|
1042
|
+
'gs-mutation-comparison-component': MutationComparisonComponent;
|
|
1046
1043
|
}
|
|
1047
1044
|
}
|
|
1048
1045
|
|
|
@@ -1050,7 +1047,7 @@ declare global {
|
|
|
1050
1047
|
declare global {
|
|
1051
1048
|
namespace JSX {
|
|
1052
1049
|
interface IntrinsicElements {
|
|
1053
|
-
'gs-
|
|
1050
|
+
'gs-mutation-comparison-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1054
1051
|
}
|
|
1055
1052
|
}
|
|
1056
1053
|
}
|
|
@@ -1058,10 +1055,7 @@ declare global {
|
|
|
1058
1055
|
|
|
1059
1056
|
declare global {
|
|
1060
1057
|
interface HTMLElementTagNameMap {
|
|
1061
|
-
'gs-
|
|
1062
|
-
}
|
|
1063
|
-
interface HTMLElementEventMap {
|
|
1064
|
-
'gs-text-input-changed': CustomEvent<Record<string, string>>;
|
|
1058
|
+
'gs-mutations-component': MutationsComponent;
|
|
1065
1059
|
}
|
|
1066
1060
|
}
|
|
1067
1061
|
|
|
@@ -1069,7 +1063,7 @@ declare global {
|
|
|
1069
1063
|
declare global {
|
|
1070
1064
|
namespace JSX {
|
|
1071
1065
|
interface IntrinsicElements {
|
|
1072
|
-
'gs-
|
|
1066
|
+
'gs-mutations-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1073
1067
|
}
|
|
1074
1068
|
}
|
|
1075
1069
|
}
|
|
@@ -1077,10 +1071,7 @@ declare global {
|
|
|
1077
1071
|
|
|
1078
1072
|
declare global {
|
|
1079
1073
|
interface HTMLElementTagNameMap {
|
|
1080
|
-
'gs-
|
|
1081
|
-
}
|
|
1082
|
-
interface HTMLElementEventMap {
|
|
1083
|
-
'gs-location-changed': CustomEvent<Record<string, string>>;
|
|
1074
|
+
'gs-prevalence-over-time': PrevalenceOverTimeComponent;
|
|
1084
1075
|
}
|
|
1085
1076
|
}
|
|
1086
1077
|
|
|
@@ -1088,7 +1079,7 @@ declare global {
|
|
|
1088
1079
|
declare global {
|
|
1089
1080
|
namespace JSX {
|
|
1090
1081
|
interface IntrinsicElements {
|
|
1091
|
-
'gs-
|
|
1082
|
+
'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1092
1083
|
}
|
|
1093
1084
|
}
|
|
1094
1085
|
}
|
|
@@ -1096,11 +1087,7 @@ declare global {
|
|
|
1096
1087
|
|
|
1097
1088
|
declare global {
|
|
1098
1089
|
interface HTMLElementTagNameMap {
|
|
1099
|
-
'gs-
|
|
1100
|
-
}
|
|
1101
|
-
interface HTMLElementEventMap {
|
|
1102
|
-
'gs-mutation-filter-changed': CustomEvent<SelectedMutationFilterStrings>;
|
|
1103
|
-
'gs-mutation-filter-on-blur': CustomEvent<SelectedMutationFilterStrings>;
|
|
1090
|
+
'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
|
|
1104
1091
|
}
|
|
1105
1092
|
}
|
|
1106
1093
|
|
|
@@ -1108,7 +1095,7 @@ declare global {
|
|
|
1108
1095
|
declare global {
|
|
1109
1096
|
namespace JSX {
|
|
1110
1097
|
interface IntrinsicElements {
|
|
1111
|
-
'gs-
|
|
1098
|
+
'gs-relative-growth-advantage': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1112
1099
|
}
|
|
1113
1100
|
}
|
|
1114
1101
|
}
|
|
@@ -1116,10 +1103,7 @@ declare global {
|
|
|
1116
1103
|
|
|
1117
1104
|
declare global {
|
|
1118
1105
|
interface HTMLElementTagNameMap {
|
|
1119
|
-
'gs-
|
|
1120
|
-
}
|
|
1121
|
-
interface HTMLElementEventMap {
|
|
1122
|
-
'gs-lineage-filter-changed': CustomEvent<Record<string, string>>;
|
|
1106
|
+
'gs-aggregate-component': AggregateComponent;
|
|
1123
1107
|
}
|
|
1124
1108
|
}
|
|
1125
1109
|
|
|
@@ -1127,7 +1111,7 @@ declare global {
|
|
|
1127
1111
|
declare global {
|
|
1128
1112
|
namespace JSX {
|
|
1129
1113
|
interface IntrinsicElements {
|
|
1130
|
-
'gs-
|
|
1114
|
+
'gs-aggregate-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1131
1115
|
}
|
|
1132
1116
|
}
|
|
1133
1117
|
}
|
|
@@ -1135,7 +1119,7 @@ declare global {
|
|
|
1135
1119
|
|
|
1136
1120
|
declare global {
|
|
1137
1121
|
interface HTMLElementTagNameMap {
|
|
1138
|
-
'gs-
|
|
1122
|
+
'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
|
|
1139
1123
|
}
|
|
1140
1124
|
}
|
|
1141
1125
|
|
|
@@ -1143,7 +1127,7 @@ declare global {
|
|
|
1143
1127
|
declare global {
|
|
1144
1128
|
namespace JSX {
|
|
1145
1129
|
interface IntrinsicElements {
|
|
1146
|
-
'gs-
|
|
1130
|
+
'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1147
1131
|
}
|
|
1148
1132
|
}
|
|
1149
1133
|
}
|
|
@@ -1151,7 +1135,7 @@ declare global {
|
|
|
1151
1135
|
|
|
1152
1136
|
declare global {
|
|
1153
1137
|
interface HTMLElementTagNameMap {
|
|
1154
|
-
'gs-mutations-
|
|
1138
|
+
'gs-mutations-over-time': MutationsOverTimeComponent;
|
|
1155
1139
|
}
|
|
1156
1140
|
}
|
|
1157
1141
|
|
|
@@ -1159,7 +1143,7 @@ declare global {
|
|
|
1159
1143
|
declare global {
|
|
1160
1144
|
namespace JSX {
|
|
1161
1145
|
interface IntrinsicElements {
|
|
1162
|
-
'gs-mutations-
|
|
1146
|
+
'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1163
1147
|
}
|
|
1164
1148
|
}
|
|
1165
1149
|
}
|
|
@@ -1167,7 +1151,10 @@ declare global {
|
|
|
1167
1151
|
|
|
1168
1152
|
declare global {
|
|
1169
1153
|
interface HTMLElementTagNameMap {
|
|
1170
|
-
'gs-
|
|
1154
|
+
'gs-date-range-selector': DateRangeSelectorComponent;
|
|
1155
|
+
}
|
|
1156
|
+
interface HTMLElementEventMap {
|
|
1157
|
+
'gs-date-range-changed': CustomEvent<Record<string, string>>;
|
|
1171
1158
|
}
|
|
1172
1159
|
}
|
|
1173
1160
|
|
|
@@ -1175,7 +1162,7 @@ declare global {
|
|
|
1175
1162
|
declare global {
|
|
1176
1163
|
namespace JSX {
|
|
1177
1164
|
interface IntrinsicElements {
|
|
1178
|
-
'gs-
|
|
1165
|
+
'gs-date-range-selector': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1179
1166
|
}
|
|
1180
1167
|
}
|
|
1181
1168
|
}
|
|
@@ -1183,7 +1170,10 @@ declare global {
|
|
|
1183
1170
|
|
|
1184
1171
|
declare global {
|
|
1185
1172
|
interface HTMLElementTagNameMap {
|
|
1186
|
-
'gs-
|
|
1173
|
+
'gs-location-filter': LocationFilterComponent;
|
|
1174
|
+
}
|
|
1175
|
+
interface HTMLElementEventMap {
|
|
1176
|
+
'gs-location-changed': CustomEvent<Record<string, string>>;
|
|
1187
1177
|
}
|
|
1188
1178
|
}
|
|
1189
1179
|
|
|
@@ -1191,7 +1181,7 @@ declare global {
|
|
|
1191
1181
|
declare global {
|
|
1192
1182
|
namespace JSX {
|
|
1193
1183
|
interface IntrinsicElements {
|
|
1194
|
-
'gs-
|
|
1184
|
+
'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1195
1185
|
}
|
|
1196
1186
|
}
|
|
1197
1187
|
}
|
|
@@ -1199,7 +1189,10 @@ declare global {
|
|
|
1199
1189
|
|
|
1200
1190
|
declare global {
|
|
1201
1191
|
interface HTMLElementTagNameMap {
|
|
1202
|
-
'gs-
|
|
1192
|
+
'gs-text-input': TextInputComponent;
|
|
1193
|
+
}
|
|
1194
|
+
interface HTMLElementEventMap {
|
|
1195
|
+
'gs-text-input-changed': CustomEvent<Record<string, string>>;
|
|
1203
1196
|
}
|
|
1204
1197
|
}
|
|
1205
1198
|
|
|
@@ -1207,7 +1200,7 @@ declare global {
|
|
|
1207
1200
|
declare global {
|
|
1208
1201
|
namespace JSX {
|
|
1209
1202
|
interface IntrinsicElements {
|
|
1210
|
-
'gs-
|
|
1203
|
+
'gs-text-input': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1211
1204
|
}
|
|
1212
1205
|
}
|
|
1213
1206
|
}
|
|
@@ -1215,7 +1208,11 @@ declare global {
|
|
|
1215
1208
|
|
|
1216
1209
|
declare global {
|
|
1217
1210
|
interface HTMLElementTagNameMap {
|
|
1218
|
-
'gs-
|
|
1211
|
+
'gs-mutation-filter': MutationFilterComponent;
|
|
1212
|
+
}
|
|
1213
|
+
interface HTMLElementEventMap {
|
|
1214
|
+
'gs-mutation-filter-changed': CustomEvent<SelectedMutationFilterStrings>;
|
|
1215
|
+
'gs-mutation-filter-on-blur': CustomEvent<SelectedMutationFilterStrings>;
|
|
1219
1216
|
}
|
|
1220
1217
|
}
|
|
1221
1218
|
|
|
@@ -1223,7 +1220,7 @@ declare global {
|
|
|
1223
1220
|
declare global {
|
|
1224
1221
|
namespace JSX {
|
|
1225
1222
|
interface IntrinsicElements {
|
|
1226
|
-
'gs-
|
|
1223
|
+
'gs-mutation-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1227
1224
|
}
|
|
1228
1225
|
}
|
|
1229
1226
|
}
|
|
@@ -1231,7 +1228,10 @@ declare global {
|
|
|
1231
1228
|
|
|
1232
1229
|
declare global {
|
|
1233
1230
|
interface HTMLElementTagNameMap {
|
|
1234
|
-
'gs-
|
|
1231
|
+
'gs-lineage-filter': LineageFilterComponent;
|
|
1232
|
+
}
|
|
1233
|
+
interface HTMLElementEventMap {
|
|
1234
|
+
'gs-lineage-filter-changed': CustomEvent<Record<string, string>>;
|
|
1235
1235
|
}
|
|
1236
1236
|
}
|
|
1237
1237
|
|
|
@@ -1239,7 +1239,7 @@ declare global {
|
|
|
1239
1239
|
declare global {
|
|
1240
1240
|
namespace JSX {
|
|
1241
1241
|
interface IntrinsicElements {
|
|
1242
|
-
'gs-
|
|
1242
|
+
'gs-lineage-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1243
1243
|
}
|
|
1244
1244
|
}
|
|
1245
1245
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genspectrum/dashboard-components",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "GenSpectrum web components for building dashboards",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"eslint-config-preact": "^1.3.0",
|
|
112
112
|
"eslint-plugin-import": "^2.29.1",
|
|
113
113
|
"eslint-plugin-jest": "^28.2.0",
|
|
114
|
-
"eslint-plugin-storybook": "^0.
|
|
114
|
+
"eslint-plugin-storybook": "^0.11.0",
|
|
115
115
|
"http-server": "^14.1.1",
|
|
116
116
|
"lit-analyzer": "^2.0.3",
|
|
117
117
|
"msw": "^2.2.14",
|
|
@@ -14,6 +14,9 @@ export class SlidingOperator<Data, AggregationResult> implements Operator<Aggreg
|
|
|
14
14
|
async evaluate(lapis: string, signal?: AbortSignal) {
|
|
15
15
|
const childEvaluated = await this.child.evaluate(lapis, signal);
|
|
16
16
|
const content = new Array<AggregationResult>();
|
|
17
|
+
if (childEvaluated.content.length === 0) {
|
|
18
|
+
return { content };
|
|
19
|
+
}
|
|
17
20
|
const numberOfWindows = Math.max(childEvaluated.content.length - this.windowSize, 0) + 1;
|
|
18
21
|
for (let i = 0; i < numberOfWindows; i++) {
|
|
19
22
|
content.push(this.aggregate(childEvaluated.content.slice(i, i + this.windowSize)));
|
|
@@ -25,6 +25,7 @@ export class UserFacingError extends Error {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export const ErrorDisplay: FunctionComponent<{ error: Error }> = ({ error }) => {
|
|
28
|
+
// eslint-disable-next-line no-console -- Currently we use the following statement for our error handling
|
|
28
29
|
console.error(error);
|
|
29
30
|
|
|
30
31
|
const containerRef = useRef<HTMLInputElement>(null);
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from '../../query/queryPrevalenceOverTime';
|
|
10
10
|
import { sortNullToBeginningThenByDate } from '../../utils/sort';
|
|
11
11
|
import GsChart from '../components/chart';
|
|
12
|
+
import { NoDataDisplay } from '../components/no-data-display';
|
|
12
13
|
import { LogitScale } from '../shared/charts/LogitScale';
|
|
13
14
|
import { singleGraphColorRGBAById } from '../shared/charts/colors';
|
|
14
15
|
import { type ConfidenceIntervalMethod, wilson95PercentConfidenceInterval } from '../shared/charts/confideceInterval';
|
|
@@ -30,12 +31,18 @@ const PrevalenceOverTimeBarChart = ({
|
|
|
30
31
|
confidenceIntervalMethod,
|
|
31
32
|
yAxisMaxConfig,
|
|
32
33
|
}: PrevalenceOverTimeBarChartProps) => {
|
|
33
|
-
const nullFirstData = data
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
const nullFirstData = data
|
|
35
|
+
.filter((prevalenceOverTimeData) => prevalenceOverTimeData.content.length > 0)
|
|
36
|
+
.map((variantData) => {
|
|
37
|
+
return {
|
|
38
|
+
content: variantData.content.sort(sortNullToBeginningThenByDate),
|
|
39
|
+
displayName: variantData.displayName,
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
if (nullFirstData.length === 0) {
|
|
44
|
+
return <NoDataDisplay />;
|
|
45
|
+
}
|
|
39
46
|
|
|
40
47
|
const datasets = nullFirstData.map((graphData, index) => getDataset(graphData, index, confidenceIntervalMethod));
|
|
41
48
|
|
|
@@ -5,6 +5,7 @@ import { type PrevalenceOverTimeData } from '../../query/queryPrevalenceOverTime
|
|
|
5
5
|
import { addUnit, minusTemporal } from '../../utils/temporalClass';
|
|
6
6
|
import { getMinMaxNumber } from '../../utils/utils';
|
|
7
7
|
import GsChart from '../components/chart';
|
|
8
|
+
import { NoDataDisplay } from '../components/no-data-display';
|
|
8
9
|
import { LogitScale } from '../shared/charts/LogitScale';
|
|
9
10
|
import { singleGraphColorRGBAById } from '../shared/charts/colors';
|
|
10
11
|
import { getYAxisMax, type YAxisMaxConfig } from '../shared/charts/getYAxisMax';
|
|
@@ -23,12 +24,18 @@ const PrevalenceOverTimeBubbleChart = ({
|
|
|
23
24
|
yAxisScaleType,
|
|
24
25
|
yAxisMaxConfig,
|
|
25
26
|
}: PrevalenceOverTimeBubbleChartProps) => {
|
|
26
|
-
const nonNullDateRangeData = data
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
const nonNullDateRangeData = data
|
|
28
|
+
.filter((prevalenceOverTimeData) => prevalenceOverTimeData.content.length > 0)
|
|
29
|
+
.map((variantData) => {
|
|
30
|
+
return {
|
|
31
|
+
content: variantData.content.filter((dataPoint) => dataPoint.dateRange !== null),
|
|
32
|
+
displayName: variantData.displayName,
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
if (nonNullDateRangeData.length === 0) {
|
|
37
|
+
return <NoDataDisplay />;
|
|
38
|
+
}
|
|
32
39
|
|
|
33
40
|
const firstDate = nonNullDateRangeData[0].content[0].dateRange!;
|
|
34
41
|
const total = nonNullDateRangeData.map((graphData) => graphData.content.map((dataPoint) => dataPoint.total)).flat();
|
|
@@ -4,6 +4,7 @@ import { type TooltipItem } from 'chart.js/dist/types';
|
|
|
4
4
|
import { maxInData } from './prevalence-over-time';
|
|
5
5
|
import { type PrevalenceOverTimeData, type PrevalenceOverTimeVariantData } from '../../query/queryPrevalenceOverTime';
|
|
6
6
|
import GsChart from '../components/chart';
|
|
7
|
+
import { NoDataDisplay } from '../components/no-data-display';
|
|
7
8
|
import { LogitScale } from '../shared/charts/LogitScale';
|
|
8
9
|
import { singleGraphColorRGBAById } from '../shared/charts/colors';
|
|
9
10
|
import {
|
|
@@ -29,12 +30,18 @@ const PrevalenceOverTimeLineChart = ({
|
|
|
29
30
|
confidenceIntervalMethod,
|
|
30
31
|
yAxisMaxConfig,
|
|
31
32
|
}: PrevalenceOverTimeLineChartProps) => {
|
|
32
|
-
const nonNullDateRangeData = data
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
const nonNullDateRangeData = data
|
|
34
|
+
.filter((prevalenceOverTimeData) => prevalenceOverTimeData.content.length > 0)
|
|
35
|
+
.map((variantData) => {
|
|
36
|
+
return {
|
|
37
|
+
content: variantData.content.filter((dataPoint) => dataPoint.dateRange !== null),
|
|
38
|
+
displayName: variantData.displayName,
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
if (nonNullDateRangeData.length === 0) {
|
|
43
|
+
return <NoDataDisplay />;
|
|
44
|
+
}
|
|
38
45
|
|
|
39
46
|
const datasets = nonNullDateRangeData
|
|
40
47
|
.map((graphData, index) => getDataset(graphData, index, confidenceIntervalMethod))
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/preact';
|
|
2
|
+
import { expect, waitFor } from '@storybook/test';
|
|
3
|
+
|
|
4
|
+
import { LapisUrlContext } from '../LapisUrlContext';
|
|
1
5
|
import denominatorFilter from './__mockData__/denominatorFilter.json';
|
|
2
6
|
import denominatorOneDataset from './__mockData__/denominatorFilterOneDataset.json';
|
|
3
7
|
import numeratorFilterEG from './__mockData__/numeratorFilterEG.json';
|
|
4
8
|
import numeratorFilterJN1 from './__mockData__/numeratorFilterJN1.json';
|
|
9
|
+
import numeratorFilterNoData from './__mockData__/numeratorFilterNoData.json';
|
|
5
10
|
import numeratorOneDataset from './__mockData__/numeratorFilterOneDataset.json';
|
|
6
11
|
import { PrevalenceOverTime, type PrevalenceOverTimeProps } from './prevalence-over-time';
|
|
7
12
|
import { AGGREGATED_ENDPOINT, LAPIS_URL } from '../../constants';
|
|
8
|
-
import { LapisUrlContext } from '../LapisUrlContext';
|
|
9
13
|
|
|
10
14
|
export default {
|
|
11
15
|
title: 'Visualization/PrevalenceOverTime',
|
|
@@ -58,7 +62,7 @@ const Template = {
|
|
|
58
62
|
),
|
|
59
63
|
};
|
|
60
64
|
|
|
61
|
-
export const TwoVariants = {
|
|
65
|
+
export const TwoVariants: StoryObj<PrevalenceOverTimeProps> = {
|
|
62
66
|
...Template,
|
|
63
67
|
args: {
|
|
64
68
|
numeratorFilter: [
|
|
@@ -74,10 +78,8 @@ export const TwoVariants = {
|
|
|
74
78
|
height: '700px',
|
|
75
79
|
lapisDateField: 'date',
|
|
76
80
|
pageSize: 10,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
logarithmic: 1,
|
|
80
|
-
},
|
|
81
|
+
yAxisMaxLinear: 1,
|
|
82
|
+
yAxisMaxLogarithmic: 1,
|
|
81
83
|
},
|
|
82
84
|
parameters: {
|
|
83
85
|
fetchMock: {
|
|
@@ -134,7 +136,7 @@ export const TwoVariants = {
|
|
|
134
136
|
},
|
|
135
137
|
};
|
|
136
138
|
|
|
137
|
-
export const OneVariant = {
|
|
139
|
+
export const OneVariant: StoryObj<PrevalenceOverTimeProps> = {
|
|
138
140
|
...Template,
|
|
139
141
|
args: {
|
|
140
142
|
numeratorFilter: {
|
|
@@ -150,10 +152,8 @@ export const OneVariant = {
|
|
|
150
152
|
height: '700px',
|
|
151
153
|
lapisDateField: 'date',
|
|
152
154
|
pageSize: 10,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
logarithmic: 1,
|
|
156
|
-
},
|
|
155
|
+
yAxisMaxLinear: 1,
|
|
156
|
+
yAxisMaxLogarithmic: 1,
|
|
157
157
|
},
|
|
158
158
|
parameters: {
|
|
159
159
|
fetchMock: {
|
|
@@ -193,3 +193,66 @@ export const OneVariant = {
|
|
|
193
193
|
},
|
|
194
194
|
},
|
|
195
195
|
};
|
|
196
|
+
|
|
197
|
+
export const ShowsNoDataBanner: StoryObj<PrevalenceOverTimeProps> = {
|
|
198
|
+
...Template,
|
|
199
|
+
args: {
|
|
200
|
+
numeratorFilter: {
|
|
201
|
+
displayName: 'EG',
|
|
202
|
+
lapisFilter: { country: 'USA', pangoLineage: 'BA.2.86*', dateFrom: '2023-10-01' },
|
|
203
|
+
},
|
|
204
|
+
denominatorFilter: { country: 'USA', dateFrom: '2023-10-01' },
|
|
205
|
+
granularity: 'day',
|
|
206
|
+
smoothingWindow: 7,
|
|
207
|
+
views: ['bar', 'line', 'bubble', 'table'],
|
|
208
|
+
confidenceIntervalMethods: ['wilson'],
|
|
209
|
+
width: '100%',
|
|
210
|
+
height: '700px',
|
|
211
|
+
lapisDateField: 'date',
|
|
212
|
+
pageSize: 10,
|
|
213
|
+
yAxisMaxLinear: 1,
|
|
214
|
+
yAxisMaxLogarithmic: 1,
|
|
215
|
+
},
|
|
216
|
+
parameters: {
|
|
217
|
+
fetchMock: {
|
|
218
|
+
mocks: [
|
|
219
|
+
{
|
|
220
|
+
matcher: {
|
|
221
|
+
name: 'numeratorOneVariant',
|
|
222
|
+
url: AGGREGATED_ENDPOINT,
|
|
223
|
+
body: {
|
|
224
|
+
country: 'USA',
|
|
225
|
+
pangoLineage: 'BA.2.86*',
|
|
226
|
+
dateFrom: '2023-10-01',
|
|
227
|
+
fields: ['date'],
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
response: {
|
|
231
|
+
status: 200,
|
|
232
|
+
body: numeratorFilterNoData,
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
matcher: {
|
|
237
|
+
name: 'denominatorOneVariant',
|
|
238
|
+
url: AGGREGATED_ENDPOINT,
|
|
239
|
+
body: {
|
|
240
|
+
country: 'USA',
|
|
241
|
+
dateFrom: '2023-10-01',
|
|
242
|
+
fields: ['date'],
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
response: {
|
|
246
|
+
status: 200,
|
|
247
|
+
body: numeratorFilterNoData,
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
],
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
play: async ({ canvas }) => {
|
|
254
|
+
await waitFor(() => expect(canvas.getByText('No data available.', { exact: false })).toBeVisible(), {
|
|
255
|
+
timeout: 10000,
|
|
256
|
+
});
|
|
257
|
+
},
|
|
258
|
+
};
|
|
@@ -80,7 +80,7 @@ export const PrevalenceOverTimeInner: FunctionComponent<PrevalenceOverTimeProps>
|
|
|
80
80
|
return <ErrorDisplay error={error} />;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
if (data === null) {
|
|
83
|
+
if (data === null || data.every((variant) => variant.content.length === 0)) {
|
|
84
84
|
return <NoDataDisplay />;
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { type StoryObj } from '@storybook/preact';
|
|
2
|
+
|
|
1
3
|
import denominator from './__mockData__/denominatorFilter.json';
|
|
2
4
|
import numerator from './__mockData__/numeratorFilter.json';
|
|
3
5
|
import { RelativeGrowthAdvantage, type RelativeGrowthAdvantageProps } from './relative-growth-advantage';
|
|
@@ -11,8 +13,8 @@ export default {
|
|
|
11
13
|
fetchMock: {},
|
|
12
14
|
},
|
|
13
15
|
argTypes: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
numeratorFilter: { control: 'object' },
|
|
17
|
+
denominatorFilter: { control: 'object' },
|
|
16
18
|
generationTime: { control: 'number' },
|
|
17
19
|
views: {
|
|
18
20
|
options: ['line'],
|
|
@@ -24,7 +26,7 @@ export default {
|
|
|
24
26
|
},
|
|
25
27
|
};
|
|
26
28
|
|
|
27
|
-
export const Primary = {
|
|
29
|
+
export const Primary: StoryObj<RelativeGrowthAdvantageProps> = {
|
|
28
30
|
render: (args: RelativeGrowthAdvantageProps) => (
|
|
29
31
|
<LapisUrlContext.Provider value={LAPIS_URL}>
|
|
30
32
|
<RelativeGrowthAdvantage
|
|
@@ -40,8 +42,13 @@ export const Primary = {
|
|
|
40
42
|
</LapisUrlContext.Provider>
|
|
41
43
|
),
|
|
42
44
|
args: {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
numeratorFilter: {
|
|
46
|
+
country: 'Switzerland',
|
|
47
|
+
pangoLineage: 'B.1.1.7',
|
|
48
|
+
dateFrom: '2020-12-01',
|
|
49
|
+
dateTo: '2021-03-01',
|
|
50
|
+
},
|
|
51
|
+
denominatorFilter: { country: 'Switzerland', dateFrom: '2020-12-01', dateTo: '2021-03-01' },
|
|
45
52
|
generationTime: 7,
|
|
46
53
|
views: ['line'],
|
|
47
54
|
width: '100%',
|