Skip to content

Commit ac960a1

Browse files
authored
Merge pull request #1325 from joshunrau/devel
add series instruments to manage group page
2 parents 7b90b70 + 7bddaeb commit ac960a1

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

apps/web/src/routes/_app/group/manage.tsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ type ManageGroupFormProps = {
3030
initialValues: {
3131
accessibleFormInstrumentIds: Set<string>;
3232
accessibleInteractiveInstrumentIds: Set<string>;
33+
accessibleSeriesInstrumentIds: Set<string>;
3334
defaultIdentificationMethod?: SubjectIdentificationMethod;
3435
idValidationRegex?: null | string;
3536
minimumAge?: null | number;
@@ -68,6 +69,12 @@ const ManageGroupForm = ({ data, onSubmit, readOnly }: ManageGroupFormProps) =>
6869
label: t('group.manage.interactive'),
6970
options: availableInstrumentOptions.interactive,
7071
variant: 'listbox'
72+
},
73+
accessibleSeriesInstrumentIds: {
74+
kind: 'set',
75+
label: t('group.manage.series'),
76+
options: availableInstrumentOptions.series,
77+
variant: 'listbox'
7178
}
7279
},
7380
title: t('group.manage.accessibleInstruments')
@@ -190,6 +197,7 @@ const ManageGroupForm = ({ data, onSubmit, readOnly }: ManageGroupFormProps) =>
190197
.object({
191198
accessibleFormInstrumentIds: z.set(z.string()),
192199
accessibleInteractiveInstrumentIds: z.set(z.string()),
200+
accessibleSeriesInstrumentIds: z.set(z.string()),
193201
defaultIdentificationMethod: $SubjectIdentificationMethod.optional(),
194202
idValidationRegex: $RegexString.optional(),
195203
idValidationRegexErrorMessageEn: z.string().optional(),
@@ -214,7 +222,11 @@ const ManageGroupForm = ({ data, onSubmit, readOnly }: ManageGroupFormProps) =>
214222
})}
215223
onSubmit={(data) => {
216224
void onSubmit({
217-
accessibleInstrumentIds: [...data.accessibleFormInstrumentIds, ...data.accessibleInteractiveInstrumentIds],
225+
accessibleInstrumentIds: [
226+
...data.accessibleFormInstrumentIds,
227+
...data.accessibleInteractiveInstrumentIds,
228+
...data.accessibleSeriesInstrumentIds
229+
],
218230
settings: {
219231
defaultIdentificationMethod: data.defaultIdentificationMethod,
220232
idValidationRegex: data.idValidationRegex,
@@ -258,6 +270,7 @@ const RouteComponent = () => {
258270
const initialValues = {
259271
accessibleFormInstrumentIds: new Set<string>(),
260272
accessibleInteractiveInstrumentIds: new Set<string>(),
273+
accessibleSeriesInstrumentIds: new Set<string>(),
261274
defaultIdentificationMethod,
262275
idValidationRegex: settings?.idValidationRegex,
263276
idValidationRegexErrorMessageEn: settings?.idValidationRegexErrorMessage?.en,
@@ -277,6 +290,11 @@ const RouteComponent = () => {
277290
if (accessibleInstrumentIds?.includes(instrument.id)) {
278291
initialValues.accessibleInteractiveInstrumentIds.add(instrument.id);
279292
}
293+
} else if (instrument.kind === 'SERIES') {
294+
availableInstrumentOptions.series[instrument.id] = instrument.details.title;
295+
if (accessibleInstrumentIds?.includes(instrument.id)) {
296+
initialValues.accessibleSeriesInstrumentIds.add(instrument.id);
297+
}
280298
}
281299
}
282300
return { availableInstrumentOptions, initialValues };

apps/web/src/translations/group.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
"en": "Interactive Tasks",
2929
"fr": "Tâches interactives"
3030
},
31+
"series": {
32+
"en": "Series",
33+
"fr": "Séries"
34+
},
3135
"pageTitle": {
3236
"en": "Manage Group",
3337
"fr": "Gestion du groupe"

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "opendatacapture",
33
"type": "module",
4-
"version": "1.13.4",
4+
"version": "1.13.5",
55
"private": true,
66
"packageManager": "pnpm@10.7.0",
77
"license": "Apache-2.0",
@@ -85,13 +85,18 @@
8585
"@prisma/engines",
8686
"@swc/core",
8787
"@tailwindcss/oxide",
88+
"cypress",
8889
"esbuild",
8990
"mongodb-memory-server",
9091
"msgpackr-extract",
9192
"msw",
9293
"oxc-resolver",
9394
"prisma",
94-
"sharp"
95+
"sharp",
96+
"sqlite3"
97+
],
98+
"ignoredBuiltDependencies": [
99+
"@scarf/scarf"
95100
]
96101
},
97102
"__isODCRepo": true

0 commit comments

Comments
 (0)