Skip to content
Merged
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ This changelog follows the principles of [Keep a Changelog](https://keepachangel

### Added

- Added the value entered by the user in the error messages for metadata field validation errors in EMAIL and URL type fields. For example, instead of showing “Point of Contact E-mail is not a valid email address.“, we now show “Point of Contact E-mail foo is not a valid email address.”

### Changed

- Use of the new `sourceLastUpdateTime` query parameter from update dataset and file metadata endpoints to support optimistic concurrency control during editing operations. See [Edit Dataset Metadata](https://guides.dataverse.org/en/6.8/api/native-api.html#edit-dataset-metadata) and [Updating File Metadata](https://guides.dataverse.org/en/6.8/api/native-api.html#updating-file-metadata) guides for more details.
- Changed the way we were handling DATE type metadata field validation to better match the backend validation and give users better error messages. For example, for an input like “foo AD”, we now show “Production Date is not a valid date. The AD year must be numeric.“. For an input like “99999 AD”, we now show “Production Date is not a valid date. The AD year cant be higher than 9999.“. For an input like “[-9999?], we now show “Production Date is not a valid date. The year in brackets cannot be negative.“, etc.

### Fixed

Expand Down
22 changes: 17 additions & 5 deletions public/locales/en/shared.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,23 @@
"field": {
"required": "{{displayName}} is required",
"invalid": {
"url": "{{displayName}} is not a valid URL",
"email": "{{displayName}} is not a valid email",
"int": "{{displayName}} is not a valid integer",
"float": "{{displayName}} is not a valid float",
"date": "{{displayName}} is not a valid date. Please use the format {{dateFormat}}"
"url": "{{displayName}} {{value}} is not a valid URL.",
"email": "{{displayName}} {{value}} is not a valid email.",
"int": "{{displayName}} is not a valid integer.",
"float": "{{displayName}} is not a valid float.",
"date": {
"base": "{{displayName}} is not a valid date.",
"empty": "The date is empty.",
"adDigits": "The AD year must be numeric.",
"adRange": "The AD year can't be higher than 9999.",
"bracketNotNumeric": "The year in brackets must be numeric.",
"bracketNegative": "The year in brackets cannot be negative.",
"bracketRange": "The year in brackets is out of range.",
"invalidMonth": "The month is out of range.",
"invalidDay": "The day is out of range.",
"invalidTime": "The time is out of range.",
"unrecognized": "The date format is unrecognized."
}
}
},
"status": {
Expand Down
8 changes: 0 additions & 8 deletions src/metadata-block-info/domain/models/MetadataBlockInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,6 @@ export const WatermarkMetadataFieldOptions = {
export type WatermarkMetadataField =
(typeof WatermarkMetadataFieldOptions)[keyof typeof WatermarkMetadataFieldOptions]

export const DateFormatsOptions = {
YYYY: 'YYYY',
YYYYMM: 'YYYY-MM',
YYYYMMDD: 'YYYY-MM-DD'
} as const

export type DateFormats = (typeof DateFormatsOptions)[keyof typeof DateFormatsOptions]

export interface MetadataBlockInfoDisplayFormat {
name: string
displayName: string
Expand Down
105 changes: 0 additions & 105 deletions src/metadata-block-info/domain/models/fieldValidations.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Alert, Button, Col, Form, Modal, Stack } from '@iqss/dataverse-design-s
import { useDataset } from '../DatasetContext'
import { Deaccessioned } from '@/dataset/domain/models/DatasetVersionSummaryInfo'
import { DatasetRepository } from '@/dataset/domain/repositories/DatasetRepository'
import { isValidURL } from '@/metadata-block-info/domain/models/fieldValidations'
import { Validator } from '@/shared/helpers/Validator'
import { useGetDatasetVersionsSummaries } from '../dataset-versions/useGetDatasetVersionsSummaries'
import { DeaccessionFormData } from './DeaccessionFormData'
import { ConfirmationModal } from './ConfirmationModal'
Expand Down Expand Up @@ -100,7 +100,7 @@ export function DeaccessionDatasetModal({
if (value.trim() === '') {
return true // Consider empty strings as valid
}
return isValidURL(value)
return Validator.isValidURL(value)
}

const handleCloseWithReset = () => {
Expand Down
Loading