-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Dataset story; move alert customHeading to translation text
- Loading branch information
1 parent
e40738b
commit 731997a
Showing
8 changed files
with
167 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
import { | ||
ANONYMIZED_FIELD_VALUE, | ||
DatasetPublishingStatus, | ||
DatasetVersion, | ||
DatasetLabelSemanticMeaning, | ||
DatasetLabelValue, | ||
DatasetMetadataBlocks | ||
} from '../../dataset/domain/models/Dataset' | ||
import { MetadataBlockName } from '../../dataset/domain/models/Dataset' | ||
import { Dataset } from '../../dataset/domain/models/Dataset' | ||
|
||
export const DatasetMockDataDraftVersion = ( | ||
props?: Partial<Dataset>, | ||
anonymized = false | ||
): Dataset => { | ||
const dataset = { | ||
persistentId: 'doi:10.5072/FK2/ABC123', | ||
citation: `${ | ||
anonymized ? 'Author name(s) withheld' : 'Bennet, Elizabeth; Darcy, Fitzwilliam' | ||
}, 2023, "Dataset Title", <a href="https://doi.org/10.5072/FK2/BUDNRV" target="_blank">https://doi.org/10.5072/FK2/BUDNRV</a>, Root, V1`, | ||
version: new DatasetVersion(1, DatasetPublishingStatus.DRAFT, 1, 0), | ||
labels: [ | ||
{ value: 'Version 1.0', semanticMeaning: DatasetLabelSemanticMeaning.FILE }, | ||
{ value: DatasetLabelValue.DRAFT, semanticMeaning: DatasetLabelSemanticMeaning.DATASET } | ||
], | ||
license: { | ||
name: 'CC0 1.0', | ||
uri: 'https://creativecommons.org/publicdomain/zero/1.0/', | ||
iconUri: 'https://licensebuttons.net/p/zero/1.0/88x31.png' | ||
}, | ||
summaryFields: [ | ||
{ | ||
name: MetadataBlockName.CITATION, | ||
fields: { | ||
dsDescription: [ | ||
{ | ||
dsDescriptionValue: | ||
'This text is *italic* and this is **bold**. Here is an image ![Alt text](https://picsum.photos/id/10/20/20) ' | ||
} | ||
], | ||
keyword: 'Malaria, Tuberculosis, Drug Resistant', | ||
subject: 'Medicine, Health and Life Sciences, Social Sciences', | ||
publication: 'CNN Journal [CNN.com](https://cnn.com)', | ||
notesText: 'Here is an image ![Alt text](https://picsum.photos/id/10/40/40)' | ||
} | ||
} | ||
], | ||
metadataBlocks: [ | ||
{ | ||
name: MetadataBlockName.CITATION, | ||
fields: { | ||
alternativePersistentId: 'doi:10.5072/FK2/ABC123', | ||
publicationDate: anonymized ? ANONYMIZED_FIELD_VALUE : '2021-01-01', | ||
citationDate: '2023-01-01', | ||
title: 'Dataset Title', | ||
subject: ['Subject1', 'Subject2'], | ||
author: anonymized | ||
? ANONYMIZED_FIELD_VALUE | ||
: [ | ||
{ | ||
authorName: 'Admin, Dataverse', | ||
authorAffiliation: 'Dataverse.org', | ||
authorIdentifierScheme: 'ORCID', | ||
authorIdentifier: '0000-0002-1825-1097' | ||
}, | ||
{ | ||
authorName: 'Owner, Dataverse', | ||
authorAffiliation: 'Dataverse.org', | ||
authorIdentifierScheme: 'ORCID', | ||
authorIdentifier: '0000-0032-1825-0098' | ||
} | ||
], | ||
datasetContact: anonymized | ||
? ANONYMIZED_FIELD_VALUE | ||
: [ | ||
{ | ||
datasetContactName: 'Admin, Dataverse' | ||
} | ||
], | ||
dsDescription: [ | ||
{ | ||
dsDescriptionValue: | ||
'This text is *italic* and this is **bold**. Here is an image ![Alt text](https://picsum.photos/id/10/20/20) ' | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
name: MetadataBlockName.GEOSPATIAL, | ||
fields: { | ||
geographicUnit: 'km', | ||
geographicCoverage: anonymized | ||
? ANONYMIZED_FIELD_VALUE | ||
: { | ||
geographicCoverageCountry: 'United States', | ||
geographicCoverageCity: 'Cambridge' | ||
} | ||
} | ||
} | ||
] as DatasetMetadataBlocks, | ||
...props | ||
} | ||
return new Dataset.Builder( | ||
dataset.persistentId, | ||
dataset.version, | ||
dataset.citation, | ||
dataset.summaryFields, | ||
dataset.license, | ||
dataset.metadataBlocks | ||
).build() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { DatasetRepository } from '../../dataset/domain/repositories/DatasetRepository' | ||
import { Dataset as DatasetModel } from '../../dataset/domain/models/Dataset' | ||
import { DatasetMockDataDraftVersion } from './DatasetMockDataDraftVersion' | ||
|
||
export class DatasetMockDraftVersionRepository implements DatasetRepository { | ||
getByPersistentId(persistentId: string): Promise<DatasetModel | undefined> { | ||
return new Promise((resolve) => { | ||
setTimeout(() => { | ||
resolve(DatasetMockDataDraftVersion({ persistentId: persistentId })) | ||
}, 1000) | ||
}) | ||
} | ||
|
||
// eslint-disable-next-line unused-imports/no-unused-vars | ||
getByPrivateUrlToken(privateUrlToken: string): Promise<DatasetModel | undefined> { | ||
return new Promise((resolve) => { | ||
setTimeout(() => { | ||
resolve(DatasetMockDataDraftVersion({}, true)) | ||
}, 1000) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters