Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@dnd-kit/sortable": "8.0.0",
"@dnd-kit/utilities": "3.2.2",
"@faker-js/faker": "7.6.0",
"@iqss/dataverse-client-javascript": "2.0.0-alpha.85",
"@iqss/dataverse-client-javascript": "2.1.0-pr429.f4e6bd4",
"@iqss/dataverse-design-system": "*",
"@istanbuljs/nyc-config-typescript": "1.0.2",
"@tanstack/react-table": "8.9.2",
Expand Down
16 changes: 11 additions & 5 deletions public/locales/en/dataset.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@
"requestAccessTip": "If checked, users can request access to the restricted files in this dataset.",
"requestAccessTrue": "Users may request access to files.",
"requestAccessFalse": "Users may not request access to files.",
"guestbookTitle": "Guestbook",
"guestbookTip": "User information (i.e., name, email, institution, and position) will be collected when files are downloaded.",
"guestbookDescription": "The following guestbook will prompt a user to provide additional information when downloading a file.",
"noGuestbookAssigned": "No guestbook is assigned to this dataset so users will not be prompted to provide any information when downloading files. To learn more about guestbooks, visit the <anchor>Dataset Guestbook</anchor> section of the User Guide.",
"guestbookPreviewButton": "Preview Guestbook",
"restrictedFilesTip": "The number of restricted files in this dataset.",
"dataAccessPlaceTip": "If the data is not only in Dataverse, list the location(s) where the data are currently stored.",
"originalArchiveTip": "Archive from which the data was obtained.",
Expand Down Expand Up @@ -347,7 +352,7 @@
"tabs": {
"datasetTerms": "Dataset Terms",
"restrictedFilesTerms": "Restricted Files + Terms of Access",
"guestBook": "GuestBook"
"guestbook": "Guestbook"
},
"datasetTerms": {
"title": "Dataset Terms",
Expand All @@ -361,10 +366,10 @@
"title": "Restricted Files + Terms of Access",
"description": "Set up access restrictions and terms for restricted files in this dataset."
},
"guestBook": {
"title": "GuestBook",
"description": "Select a guestbook to have a user provide additional information when downloading a file.",
"testGuestbook": "Test Guestbook",
"guestbook": {
"title": "Guestbook",
"description": "Select a guestbook to have a user provide additional information when downloading a file. To learn more about guestbooks, visit the <anchor>Dataset Guestbook</anchor> section of the User Guide.",
"noGuestbooksEnabled": "There are no guestbooks enabled in {{collectionName}}. To create a guestbook, return to {{collectionName}}, click the \"Edit\" button and select the \"Dataset Guestbooks\" option.",
"previewButton": "Preview Guestbook"
},
"unsavedChangesModal": {
Expand All @@ -373,6 +378,7 @@
"stay": "Stay on this page",
"leave": "Leave without saving"
},
"defaultGuestbookUpdateError": "An error occurred while updating the dataset guestbook. Please try again.",
"defaultLicenseUpdateError": "An error occurred while updating the dataset license. Please try again.",
"defaultTermsOfAccessUpdateError": "An error occurred while updating the dataset terms of access. Please try again."
}
Expand Down
12 changes: 12 additions & 0 deletions public/locales/en/file.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@
"helpText": "Share this file on your favorite social media networks."
}
},
"actions": {
"optionsMenu": {
"guestbookAppliedModal": {
"submitError": "Something went wrong submitting guestbook responses. Try again later.",
"downloadError": "Something went wrong downloading the file. Try again later.",
"validation": {
"required": "This field is required.",
"invalidEmail": "Please enter a valid email address."
}
}
}
},
"deleteFileModal": {
"title": "Delete File",
"message": "The file will be deleted after you click on the Delete button.",
Expand Down
12 changes: 12 additions & 0 deletions public/locales/en/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@
"title": "File Options",
"headers": {
"editOptions": "Edit Options"
},
"guestbookAppliedModal": {
"title": "Dataset Guestbook",
"message": "A guestbook is assigned to this dataset. Users will be prompted to provide additional information when downloading files.",
"close": "Close",
"additionalQuestions": "Additional Questions",
"submitError": "Something went wrong submitting guestbook responses. Try again later.",
"downloadError": "Something went wrong downloading the file. Try again later.",
"validation": {
"required": "This field is required.",
"invalidEmail": "Please enter a valid email address."
}
}
},
"alreadyDeletedAlert": {
Expand Down
33 changes: 33 additions & 0 deletions public/locales/en/guestbooks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"title": "Dataset Guestbooks",
"errors": {
"getGuestbook": "Something went wrong getting the guestbook. Try again later."
},
"preview": {
"title": "Preview Guestbook",
"description": "Upon downloading files the guestbook asks for the following information.",
"guestbookNameLabel": "Guestbook Name",
"guestbookDataLabel": "Collected Data",
"guestbookDataTip": "User data collected by the guestbook.",
"collectedDataLabel": "Collected Data",
"collectedDataTip": "User data collected by the guestbook.",
"accountInformation": "Account Information",
"customQuestionsLabel": "Custom Questions",
"required": "Required",
"optional": "Optional"
},
"create": {
"fields": {
"dataCollected": {
"label": "Data Collected",
"help": "Dataverse account information that will be collected when a user downloads a file. Check the ones that will be required.",
"options": {
"name": "Name",
"email": "Email",
"institution": "Institution",
"position": "Position"
}
}
}
}
}
1 change: 1 addition & 0 deletions public/locales/es/dataset.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
"requestAccessTip": "Si está marcado, los usuarios pueden solicitar acceso a los ficheros restringidos en este dataset.",
"requestAccessTrue": "Los usuarios pueden solicitar acceso a los ficheros.",
"requestAccessFalse": "Los usuarios no pueden solicitar acceso a los ficheros.",
"noGuestbookAssigned": "No hay un libro de visitas asignado a este dataset, por lo que no se pedirá a los usuarios que proporcionen información al descargar archivos. Para obtener más información sobre libros de visitas, visita la sección <anchor>Dataset Guestbook</anchor> de la Guía del usuario.",
"restrictedFilesTip": "El número de ficheros restringidos en este dataset.",
"dataAccessPlaceTip": "Si los datos no están solo en Dataverse, enumera la(s) ubicación(es) donde los datos están actualmente almacenados.",
"originalArchiveTip": "Fichero del cual se obtuvieron los datos.",
Expand Down
12 changes: 12 additions & 0 deletions public/locales/es/file.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@
"helpText": "Comparte este fichero en tus redes sociales favoritas."
}
},
"actions": {
"optionsMenu": {
"guestbookAppliedModal": {
"submitError": "Algo salió mal al enviar las respuestas del libro de visitas. Inténtalo de nuevo más tarde.",
"downloadError": "Algo salió mal al descargar el archivo. Inténtalo de nuevo más tarde.",
"validation": {
"required": "Este campo es obligatorio.",
"invalidEmail": "Por favor, ingresa un correo electrónico válido."
}
}
}
},
"deleteFileModal": {
"title": "Eliminar archivo",
"message": "El fichero se eliminará después de hacer clic en el botón Eliminar.",
Expand Down
12 changes: 12 additions & 0 deletions public/locales/es/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@
"title": "Opciones de archivo",
"headers": {
"editOptions": "Opciones de edición"
},
"guestbookAppliedModal": {
"title": "Libro de visitas del dataset",
"message": "Hay un libro de visitas asignado a este dataset. Se pedirá a los usuarios que proporcionen información adicional al descargar archivos.",
"close": "Cerrar",
"additionalQuestions": "Preguntas adicionales",
"submitError": "Algo salió mal al enviar las respuestas del libro de visitas. Inténtalo de nuevo más tarde.",
"downloadError": "Algo salió mal al descargar el archivo. Inténtalo de nuevo más tarde.",
"validation": {
"required": "Este campo es obligatorio.",
"invalidEmail": "Por favor, ingresa un correo electrónico válido."
}
}
},
"alreadyDeletedAlert": {
Expand Down
16 changes: 16 additions & 0 deletions src/access/domain/repositories/AccessRepository.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export type GuestbookResponseAnswer = { id: number | string; value: string | string[] }

export interface AccessRepository {
submitGuestbookForDatasetDownload: (
datasetId: number | string,
answers: GuestbookResponseAnswer[]
) => Promise<string>
submitGuestbookForDatafileDownload: (
fileId: number | string,
answers: GuestbookResponseAnswer[]
) => Promise<string>
submitGuestbookForDatafilesDownload: (
fileIds: Array<number | string>,
answers: GuestbookResponseAnswer[]
) => Promise<string>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { AccessRepository, GuestbookResponseAnswer } from '../repositories/AccessRepository'

export function submitGuestbookForDatafileDownload(
accessRepository: AccessRepository,
fileId: number | string,
answers: GuestbookResponseAnswer[]
): Promise<string> {
return accessRepository.submitGuestbookForDatafileDownload(fileId, answers)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { AccessRepository, GuestbookResponseAnswer } from '../repositories/AccessRepository'

export function submitGuestbookForDatafilesDownload(
accessRepository: AccessRepository,
fileIds: Array<number | string>,
answers: GuestbookResponseAnswer[]
): Promise<string> {
return accessRepository.submitGuestbookForDatafilesDownload(fileIds, answers)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { AccessRepository, GuestbookResponseAnswer } from '../repositories/AccessRepository'

export function submitGuestbookForDatasetDownload(
accessRepository: AccessRepository,
datasetId: number | string,
answers: GuestbookResponseAnswer[]
): Promise<string> {
return accessRepository.submitGuestbookForDatasetDownload(datasetId, answers)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import {
submitGuestbookForDatasetDownload as submitGuestbookForDatasetDownloadJSDv,
submitGuestbookForDatafileDownload as submitGuestbookForDatafileDownloadJSDv,
submitGuestbookForDatafilesDownload as submitGuestbookForDatafilesDownloadJSDv
} from '@iqss/dataverse-client-javascript'
import {
AccessRepository,
GuestbookResponseAnswer
} from '@/access/domain/repositories/AccessRepository'

export class AccessJSDataverseRepository implements AccessRepository {
submitGuestbookForDatasetDownload(
datasetId: number | string,
answers: GuestbookResponseAnswer[]
): Promise<string> {
return submitGuestbookForDatasetDownloadJSDv.execute(datasetId, {
guestbookResponse: { answers }
})
}

submitGuestbookForDatafileDownload(
fileId: number | string,
answers: GuestbookResponseAnswer[]
): Promise<string> {
return submitGuestbookForDatafileDownloadJSDv.execute(fileId, {
guestbookResponse: { answers }
})
}

submitGuestbookForDatafilesDownload(
fileIds: Array<number | string>,
answers: GuestbookResponseAnswer[]
): Promise<string> {
return submitGuestbookForDatafilesDownloadJSDv.execute(fileIds, {
guestbookResponse: { answers }
})
}
}
5 changes: 1 addition & 4 deletions src/collection/domain/useCases/createCollection.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { WriteError } from '@iqss/dataverse-client-javascript'
import { CollectionRepository } from '../repositories/CollectionRepository'
import { CollectionDTO } from './DTOs/CollectionDTO'

Expand All @@ -7,7 +6,5 @@ export function createCollection(
collection: CollectionDTO,
hostCollection: string
): Promise<number> {
return collectionRepository.create(collection, hostCollection).catch((error: WriteError) => {
throw error
})
return collectionRepository.create(collection, hostCollection)
}
5 changes: 1 addition & 4 deletions src/collection/domain/useCases/deleteCollection.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { WriteError } from '@iqss/dataverse-client-javascript'
import { CollectionRepository } from '../repositories/CollectionRepository'

export function deleteCollection(
collectionRepository: CollectionRepository,
collectionIdOrAlias: number | string
): Promise<void> {
return collectionRepository.delete(collectionIdOrAlias).catch((error: WriteError | unknown) => {
throw error
})
return collectionRepository.delete(collectionIdOrAlias)
}
5 changes: 1 addition & 4 deletions src/collection/domain/useCases/editCollection.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { WriteError } from '@iqss/dataverse-client-javascript'
import { CollectionRepository } from '../repositories/CollectionRepository'
import { CollectionDTO } from './DTOs/CollectionDTO'

Expand All @@ -7,7 +6,5 @@ export async function editCollection(
updatedCollection: CollectionDTO,
collectionId: string
): Promise<void> {
return collectionRepository.edit(collectionId, updatedCollection).catch((error: WriteError) => {
throw error
})
return collectionRepository.edit(collectionId, updatedCollection)
}
9 changes: 6 additions & 3 deletions src/dataset/domain/models/Dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,8 @@ export class Dataset {
public readonly nextMajorVersion?: string,
public readonly nextMinorVersion?: string,
public readonly requiresMajorVersionUpdate?: boolean,
public readonly fileStore?: string
public readonly fileStore?: string,
public readonly guestbookId?: number
) {}

public checkIsLockedFromPublishing(userPersistentId: string): boolean {
Expand Down Expand Up @@ -533,7 +534,8 @@ export class Dataset {
public readonly nextMajorVersionNumber?: string,
public readonly nextMinorVersionNumber?: string,
public readonly requiresMajorVersionUpdate?: boolean,
public readonly fileStore?: string
public readonly fileStore?: string,
public readonly guestbookId?: number
) {
this.withAlerts()
}
Expand Down Expand Up @@ -605,7 +607,8 @@ export class Dataset {
this.nextMajorVersionNumber,
this.nextMinorVersionNumber,
this.requiresMajorVersionUpdate,
this.fileStore
this.fileStore,
this.guestbookId
)
}
}
Expand Down
5 changes: 1 addition & 4 deletions src/dataset/domain/useCases/deleteDatasetDraft.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { WriteError } from '@iqss/dataverse-client-javascript'
import { DatasetRepository } from '../repositories/DatasetRepository'

export function deleteDatasetDraft(
datasetRepository: DatasetRepository,
datasetId: string | number
): Promise<void> {
return datasetRepository.deleteDatasetDraft(datasetId).catch((error: WriteError | unknown) => {
throw error
})
return datasetRepository.deleteDatasetDraft(datasetId)
}
4 changes: 1 addition & 3 deletions src/dataset/domain/useCases/getDatasetVersionsSummaries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@ export function getDatasetVersionsSummaries(
datasetId: number | string,
paginationInfo?: DatasetVersionPaginationInfo
): Promise<DatasetVersionSummarySubset> {
return datasetRepository.getDatasetVersionsSummaries(datasetId, paginationInfo).catch((error) => {
throw error
})
return datasetRepository.getDatasetVersionsSummaries(datasetId, paginationInfo)
}
6 changes: 1 addition & 5 deletions src/dataset/domain/useCases/updateDatasetLicense.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,5 @@ export function updateDatasetLicense(
datasetId: string | number,
licenseUpdateRequest: DatasetLicenseUpdateRequest
): Promise<void> {
return datasetRepository
.updateDatasetLicense(datasetId, licenseUpdateRequest)
.catch((error: Error) => {
throw new Error(error.message)
})
return datasetRepository.updateDatasetLicense(datasetId, licenseUpdateRequest)
}
4 changes: 1 addition & 3 deletions src/dataset/domain/useCases/updateTermsOfAccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@ export function updateTermsOfAccess(
datasetId: string | number,
termsOfAccess: TermsOfAccess
): Promise<void> {
return datasetRepository.updateTermsOfAccess(datasetId, termsOfAccess).catch((error: Error) => {
throw new Error(error.message)
})
return datasetRepository.updateTermsOfAccess(datasetId, termsOfAccess)
}
Loading
Loading