diff --git a/public/locales/en/dataset.json b/public/locales/en/dataset.json index c52bc9493..09d4687b8 100644 --- a/public/locales/en/dataset.json +++ b/public/locales/en/dataset.json @@ -23,6 +23,7 @@ }, "alerts": { "draftVersion": "This draft version needs to be published. When ready for sharing, please publish it so that others can see these changes", - "requestedVersionNotFound": "Info – Version {0} was not found. This is version {1}" + "requestedVersionNotFound": "Info – Version {0} was not found. This is version {1}", + "unpublishedDataset": "Privately share this dataset before it is published: {0}" } } diff --git a/src/dataset/domain/models/Dataset.ts b/src/dataset/domain/models/Dataset.ts index c25adc0fc..9bff2f11d 100644 --- a/src/dataset/domain/models/Dataset.ts +++ b/src/dataset/domain/models/Dataset.ts @@ -26,7 +26,8 @@ export class DatasetLabel { export enum DatasetAlertMessageKey { DRAFT_VERSION = 'draftVersion', - REQUESTED_VERSION_NOT_FOUND = 'requestedVersionNotFound' + REQUESTED_VERSION_NOT_FOUND = 'requestedVersionNotFound', + UNPUBLISHED_DATASET = 'unpublishedDataset' } export class DatasetAlert { @@ -271,10 +272,11 @@ export class Dataset { public readonly citation: string, public readonly summaryFields: DatasetMetadataBlock[], public readonly license: DatasetLicense = defaultLicense, - public readonly metadataBlocks: DatasetMetadataBlocks + public readonly metadataBlocks: DatasetMetadataBlocks, + public readonly privateUrl?: string ) { this.withLabels() - this.withAlerts() + this.withAlerts(privateUrl) } withLabels() { @@ -322,7 +324,7 @@ export class Dataset { } } - private withAlerts(): void { + private withAlerts(privateUrl?: string): void { if (this.version.publishingStatus === DatasetPublishingStatus.DRAFT) { this.alerts.push( new DatasetAlert('warning', DatasetAlertMessageKey.DRAFT_VERSION, undefined, 'Info') @@ -339,6 +341,17 @@ export class Dataset { ) ) } + if (privateUrl) { + const dynamicFields = [privateUrl] + this.alerts.push( + new DatasetAlert( + 'info', + DatasetAlertMessageKey.UNPUBLISHED_DATASET, + dynamicFields, + 'Unpublished Dataset Private URL' + ) + ) + } } build(): Dataset { diff --git a/src/dataset/infrastructure/mappers/JSDatasetMapper.ts b/src/dataset/infrastructure/mappers/JSDatasetMapper.ts index ea2347281..78f3ee188 100644 --- a/src/dataset/infrastructure/mappers/JSDatasetMapper.ts +++ b/src/dataset/infrastructure/mappers/JSDatasetMapper.ts @@ -21,7 +21,8 @@ export class JSDatasetMapper { jsDataset: JSDataset, citation: string, summaryFieldsNames: string[], - requestedVersion?: string + requestedVersion?: string, + privateUrl?: string ): Dataset { return new Dataset.Builder( jsDataset.persistentId, @@ -34,7 +35,8 @@ export class JSDatasetMapper { jsDataset.alternativePersistentId, jsDataset.publicationDate, jsDataset.citationDate - ) + ), + privateUrl ).build() }