Skip to content

Commit d69d99d

Browse files
authored
Merge pull request #908 from IQSS/TemplateUI
Manage Dataset Templates Integration
2 parents 833dedd + 0de6788 commit d69d99d

75 files changed

Lines changed: 4785 additions & 94 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ This changelog follows the principles of [Keep a Changelog](https://keepachangel
88

99
### Added
1010

11+
- Dataset Templates UI integration, including create/edit flows, previews, and skeleton states.
12+
1113
### Changed
1214

1315
### Fixed

cypress.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export default defineConfig({
5858
privacyPolicyUrl: 'https://support.dataverse.harvard.edu/harvard-dataverse-privacy-policy'
5959
},
6060
codeCoverage: {
61-
exclude: ['tests/**/*.*', '**/ErrorPage.tsx']
61+
exclude: ['tests/**/*.*', '**/ErrorPage.tsx', '**/EditGuestBook.tsx']
6262
}
6363
}
6464
})

docs/KEYCLOAK_DEPLOYMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ You can create a JSON file based on the following example file, replacing the va
161161
"enabled": true,
162162
"alwaysDisplayInConsole": false,
163163
"clientAuthenticatorType": "client-secret",
164-
"redirectUris": ["https://<INSTALLATION_DOMAIN_NAME>/spa/*"],
164+
"redirectUris": ["https://<INSTALLATION_DOMAIN_NAME>/modern/*"],
165165
"webOrigins": ["+"],
166166
"notBefore": 0,
167167
"bearerOnly": false,
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
{
2+
"pageTitle": "Dataset Templates",
3+
"infoAlert": {
4+
"title": "Manage Dataset Templates",
5+
"text": "Create a template prefilled with metadata fields standard values, such as Author Affiliation, or add instructions in the metadata fields to give depositors more information on what metadata is expected."
6+
},
7+
"actions": {
8+
"create": "Create Dataset Template",
9+
"makeDefault": "Make Default",
10+
"default": "Default",
11+
"view": "View",
12+
"copy": "Copy",
13+
"edit": "Edit Template",
14+
"delete": "Delete",
15+
"deleteDisabledTip": "This template is already used by datasets and cannot be deleted."
16+
},
17+
"filters": {
18+
"includeTemplatesFromRoot": "Include Templates from {{root}}"
19+
},
20+
"table": {
21+
"name": "Template Name",
22+
"created": "Date Created",
23+
"usage": "Usage",
24+
"action": "Action",
25+
"templateCreatedAt": "Template created at {{alias}}"
26+
},
27+
"emptyState": {
28+
"whyTitle": "Why Use Templates?",
29+
"whyBullets": [
30+
"Templates are useful when you have several datasets that have the same information in multiple metadata fields that you would prefer not to have to keep manually typing in.",
31+
"Templates can be used to input instructions for those uploading datasets into your dataverse if you have a specific way you want a metadata field to be filled out."
32+
],
33+
"howTitle": "How To Use Templates?",
34+
"howBullets": [
35+
"Templates are created at the dataverse level, can be deleted (so it does not show for future datasets), set to default (not required), and can be copied so you do not have to start over when creating a new template with similar metadata from another template. When a template is deleted, it does not impact the datasets that have used the template already."
36+
],
37+
"howNote": "Please note that the ability to choose which metadata fields are hidden, required, or optional is done on the <anchor>General Information</anchor> page for this dataverse.",
38+
"footer": "To get started, click on the Create Dataset Template button above. To learn more about templates, visit the <anchor>Dataset Templates</anchor> section of the User Guide."
39+
},
40+
"deleteModal": {
41+
"title": "Delete Template",
42+
"message": "Are you sure you want to delete this template? A new dataset will not be able to use this template."
43+
},
44+
"alerts": {
45+
"deleteSuccess": "Template deleted.",
46+
"deleteError": "Something went wrong deleting the template. Try again later.",
47+
"copySuccess": "Template copied.",
48+
"copyError": "Something went wrong copying the template. Try again later."
49+
},
50+
"copyNamePrefix": "copy {{name}}",
51+
"preview": {
52+
"title": "Dataset Template Preview",
53+
"templateLabel": "Dataset Template",
54+
"sections": {
55+
"metadata": "Citation Metadata",
56+
"terms": "Dataset Terms",
57+
"access": "Restricted Files + Terms of Access"
58+
},
59+
"noMetadata": "No citation metadata is available for this template.",
60+
"error": "Something went wrong loading the template preview. Please try again."
61+
},
62+
"createTemplate": {
63+
"pageTitle": "Create Dataset Template",
64+
"breadcrumb": "Create",
65+
"templateName": "Template Name",
66+
"requiredInfo": "Asterisks indicate metadata fields that users will be required to fill out while adding a dataset to this dataverse.",
67+
"citationMissing": "Citation metadata is not available for this template.",
68+
"saveAddTerms": "Save + Add Terms",
69+
"cancel": "Cancel",
70+
"alerts": {
71+
"success": "Success! Template has been created."
72+
},
73+
"errors": {
74+
"nameRequired": "Please add in a name for the dataset template.",
75+
"saveFailed": "Something went wrong creating the template. Try again later."
76+
},
77+
"customInstructions": {
78+
"label": "Custom Instructions:",
79+
"none": "(None - click to add)",
80+
"addAria": "Add custom instructions",
81+
"editAria": "Edit custom instructions",
82+
"inputAriaLabel": "Custom instructions",
83+
"save": "Save",
84+
"cancel": "Cancel"
85+
},
86+
"terms": {
87+
"datasetTermsTitle": "Dataset Terms",
88+
"licenseLabel": "License/Data Use Agreement",
89+
"restrictedTitle": "Restricted Files + Terms of Access",
90+
"requestAccessLabel": "Request Access",
91+
"requestAccessHelp": "Enable access request",
92+
"termsOfAccessLabel": "Terms of Access for Restricted Files",
93+
"dataAccessPlaceLabel": "Data Access Place"
94+
}
95+
}
96+
}

public/locales/en/shared.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"files": "Files",
88
"page": "Page",
99
"asterisksIndicateRequiredFields": "Asterisks indicate required fields",
10+
"asterisksRequiredDatasetFields": "Asterisks indicate metadata fields that users will be required to fill out while adding a dataset to this dataverse.",
1011
"remove": "Remove",
1112
"add": "Add",
1213
"yes": "Yes",
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
{
2+
"pageTitle": "Plantillas de conjuntos de datos",
3+
"infoAlert": {
4+
"title": "Gestionar plantillas de conjuntos de datos",
5+
"text": "Cree una plantilla precargada con valores estándar de campos de metadatos, como Afiliación del autor, o agregue instrucciones en los campos de metadatos para dar a los depositantes más información sobre qué metadatos se esperan."
6+
},
7+
"actions": {
8+
"create": "Crear plantilla de conjunto de datos",
9+
"makeDefault": "Hacer predeterminada",
10+
"default": "Predeterminada",
11+
"view": "Ver",
12+
"copy": "Copiar",
13+
"edit": "Editar plantilla",
14+
"delete": "Eliminar"
15+
},
16+
"filters": {
17+
"includeTemplatesFromRoot": "Incluir plantillas de {{root}}"
18+
},
19+
"table": {
20+
"name": "Nombre de la plantilla",
21+
"created": "Fecha de creación",
22+
"usage": "Uso",
23+
"action": "Acción",
24+
"templateCreatedAt": "Plantilla creada en {{alias}}"
25+
},
26+
"emptyState": {
27+
"whyTitle": "¿Por qué usar plantillas?",
28+
"whyBullets": [
29+
"Las plantillas son útiles cuando tienes varios conjuntos de datos que tienen la misma información en múltiples campos de metadatos y preferirías no tener que seguir escribiéndola manualmente.",
30+
"Las plantillas se pueden usar para incluir instrucciones para quienes cargan conjuntos de datos en tu dataverse si tienes una forma específica en la que quieres que se complete un campo de metadatos."
31+
],
32+
"howTitle": "Cómo usar plantillas",
33+
"howBullets": [
34+
"Las plantillas se crean a nivel de dataverse, se pueden eliminar (para que no aparezcan en futuros conjuntos de datos), establecer como predeterminadas (no obligatorias) y copiar para que no tengas que empezar de cero al crear una nueva plantilla con metadatos similares a otra. Cuando se elimina una plantilla, no afecta a los conjuntos de datos que ya la hayan usado."
35+
],
36+
"howNote": "Ten en cuenta que la capacidad de elegir qué campos de metadatos están ocultos, son obligatorios u opcionales se configura en la página de <anchor>Información General</anchor> de este dataverse.",
37+
"footer": "Para comenzar, haz clic en el botón Crear plantilla de conjunto de datos de arriba. Para obtener más información sobre las plantillas, visita la sección <anchor>Plantillas de conjuntos de datos</anchor> de la Guía del usuario."
38+
},
39+
"deleteModal": {
40+
"title": "Eliminar plantilla",
41+
"message": "¿Está seguro de que desea eliminar esta plantilla? Un nuevo conjunto de datos no podrá usar esta plantilla."
42+
},
43+
"alerts": {
44+
"deleteSuccess": "Plantilla eliminada.",
45+
"deleteError": "Algo salió mal al eliminar la plantilla. Inténtelo de nuevo más tarde.",
46+
"copySuccess": "Plantilla copiada.",
47+
"copyError": "Algo salió mal al copiar la plantilla. Inténtelo de nuevo más tarde."
48+
},
49+
"copyNamePrefix": "copia {{name}}",
50+
"preview": {
51+
"title": "Vista previa de plantilla de conjunto de datos",
52+
"templateLabel": "Plantilla de conjunto de datos",
53+
"sections": {
54+
"metadata": "Metadatos de citación",
55+
"terms": "Términos del conjunto de datos",
56+
"access": "Archivos restringidos + términos de acceso"
57+
},
58+
"noMetadata": "No hay metadatos de citación disponibles para esta plantilla.",
59+
"error": "No se pudo cargar la vista previa de la plantilla. Inténtelo de nuevo más tarde."
60+
},
61+
"createTemplate": {
62+
"pageTitle": "Crear plantilla de conjunto de datos",
63+
"breadcrumb": "Crear",
64+
"templateName": "Nombre de la plantilla",
65+
"requiredInfo": "Los asteriscos indican los campos de metadatos que los usuarios deberán completar al agregar un conjunto de datos a este dataverse.",
66+
"citationMissing": "Los metadatos de citación no están disponibles para esta plantilla.",
67+
"saveAddTerms": "Guardar + agregar términos",
68+
"cancel": "Cancelar",
69+
"alerts": {
70+
"success": "¡Éxito! La plantilla ha sido creada."
71+
},
72+
"errors": {
73+
"nameRequired": "Por favor, añade un nombre para la plantilla del conjunto de datos.",
74+
"saveFailed": "Algo salió mal al crear la plantilla. Inténtelo de nuevo más tarde."
75+
},
76+
"customInstructions": {
77+
"label": "Instrucciones personalizadas:",
78+
"none": "(Ninguna: haz clic para añadir)",
79+
"addAria": "Agregar instrucciones personalizadas",
80+
"editAria": "Editar instrucciones personalizadas",
81+
"inputAriaLabel": "Instrucciones personalizadas",
82+
"save": "Guardar",
83+
"cancel": "Cancelar"
84+
},
85+
"terms": {
86+
"datasetTermsTitle": "Términos del conjunto de datos",
87+
"licenseLabel": "Licencia/Acuerdo de uso de datos",
88+
"restrictedTitle": "Archivos restringidos + términos de acceso",
89+
"requestAccessLabel": "Solicitar acceso",
90+
"requestAccessHelp": "Habilitar solicitud de acceso",
91+
"termsOfAccessLabel": "Términos de acceso para archivos restringidos",
92+
"dataAccessPlaceLabel": "Lugar de acceso a los datos"
93+
}
94+
}
95+
}

public/locales/es/shared.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"files": "Ficheros",
88
"page": "Página",
99
"asterisksIndicateRequiredFields": "Los asteriscos indican los campos obligatorios",
10+
"asterisksRequiredDatasetFields": "Los asteriscos indican los campos de metadatos que los usuarios deberán completar al agregar un conjunto de datos a este dataverse.",
1011
"remove": "Eliminar",
1112
"add": "Agregar",
1213
"yes": "",

src/dataset/domain/useCases/DTOs/DatasetDTO.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ export interface DatasetMetadataBlockValuesDTO {
1010
fields: DatasetMetadataFieldsDTO
1111
}
1212

13-
type DatasetMetadataFieldsDTO = Record<string, DatasetMetadataFieldValueDTO>
13+
export type DatasetMetadataFieldsDTO = Record<string, DatasetMetadataFieldValueDTO>
1414

15-
type DatasetMetadataFieldValueDTO =
15+
export type DatasetMetadataFieldValueDTO =
1616
| string
1717
| string[]
1818
| DatasetMetadataChildFieldValueDTO

src/router/routes.tsx

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,28 @@ const EditFeaturedItems = lazy(() =>
9393
)
9494
)
9595

96+
const DatasetTemplatesPage = lazy(() =>
97+
import('../sections/templates/DatasetTemplatesFactory').then(({ DatasetTemplatesFactory }) => ({
98+
default: () => DatasetTemplatesFactory.create()
99+
}))
100+
)
101+
102+
const CreateTemplatePage = lazy(() =>
103+
import('../sections/templates/create-template/CreateTemplateFactory').then(
104+
({ CreateTemplateFactory }) => ({
105+
default: () => CreateTemplateFactory.create()
106+
})
107+
)
108+
)
109+
110+
const EditDatasetTemplateTermsPage = lazy(() =>
111+
import('../sections/templates/edit-template-terms/EditTemplateTermsFactory').then(
112+
({ EditTemplateTermsFactory }) => ({
113+
default: () => EditTemplateTermsFactory.create()
114+
})
115+
)
116+
)
117+
96118
const ReplaceFile = lazy(() =>
97119
import('../sections/replace-file/ReplaceFileFactory').then(({ ReplaceFileFactory }) => ({
98120
default: () => ReplaceFileFactory.create()
@@ -292,6 +314,33 @@ export const routes: RouteObject[] = [
292314
),
293315
errorElement: <ErrorPage />
294316
},
317+
{
318+
path: Route.COLLECTION_TEMPLATES,
319+
element: (
320+
<Suspense fallback={<AppLoader />}>
321+
<DatasetTemplatesPage />
322+
</Suspense>
323+
),
324+
errorElement: <ErrorPage />
325+
},
326+
{
327+
path: Route.TEMPLATES_CREATE,
328+
element: (
329+
<Suspense fallback={<AppLoader />}>
330+
<CreateTemplatePage />
331+
</Suspense>
332+
),
333+
errorElement: <ErrorPage />
334+
},
335+
{
336+
path: Route.TEMPLATES_EDIT_TERMS,
337+
element: (
338+
<Suspense fallback={<AppLoader />}>
339+
<EditDatasetTemplateTermsPage />
340+
</Suspense>
341+
),
342+
errorElement: <ErrorPage />
343+
},
295344
{
296345
path: Route.EDIT_FILE_METADATA,
297346
element: (

src/sections/Route.enum.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ export enum Route {
2020
ACCOUNT = '/account',
2121
EDIT_COLLECTION = '/collections/:collectionId/edit',
2222
EDIT_FEATURED_ITEMS = '/collections/:collectionId/edit-featured-items',
23+
COLLECTION_TEMPLATES = '/:collectionId/templates',
24+
TEMPLATES_CREATE = '/:collectionId/templates/create',
25+
TEMPLATES_EDIT_METADATA = '/:collectionId/templates/:templateId/edit/metadata',
26+
TEMPLATES_EDIT_TERMS = '/:collectionId/templates/:templateId/edit/terms',
2327
FEATURED_ITEM = '/featured-item/:parentCollectionId/:featuredItemId',
2428
NOT_FOUND_PAGE = '/404',
2529
AUTH_CALLBACK = '/auth-callback',
@@ -34,6 +38,12 @@ export const RouteWithParams = {
3438
CREATE_DATASET: (collectionId: string) => `/datasets/${collectionId}/create`,
3539
EDIT_COLLECTION: (collectionId: string) => `/collections/${collectionId}/edit`,
3640
EDIT_FEATURED_ITEMS: (collectionId: string) => `/collections/${collectionId}/edit-featured-items`,
41+
COLLECTION_TEMPLATES: (collectionId: string) => `/${collectionId}/templates`,
42+
TEMPLATES_CREATE: (collectionId: string) => `/${collectionId}/templates/create`,
43+
TEMPLATES_EDIT_METADATA: (collectionId: string, templateId: number | string) =>
44+
`/${collectionId}/templates/${templateId}/edit/metadata`,
45+
TEMPLATES_EDIT_TERMS: (collectionId: string, templateId: number | string) =>
46+
`/${collectionId}/templates/${templateId}/edit/terms`,
3747
EDIT_FILE_METADATA: (
3848
datasetPersistentId: string,
3949
datasetVersion: string,

0 commit comments

Comments
 (0)