Skip to content

Commit 4cc33d5

Browse files
committed
Merge branch 'develop' into 772-file-edit-tags-populated-the-categories-dropdown-with-results-from-api
2 parents 18435b1 + 6d08b5e commit 4cc33d5

69 files changed

Lines changed: 1922 additions & 617 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.

.npmrc.example

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
legacy-peer-deps=true
22

3-
# design-system registry
3+
# NPM Registry
44
//registry.npmjs.org/:_authToken=<YOUR_NPM_AUTH_TOKEN>
55
@iqss:registry=https://registry.npmjs.org/
66

7-
# js-dataverse registry
7+
# GitHub Packages Registry
88
//npm.pkg.github.com/:_authToken=<YOUR_GITHUB_AUTH_TOKEN>
9-
# IMPORTANT: when publishing the Design System, comment out the following line to avoid publishing to GitHub Packages
109
@iqss:registry=https://npm.pkg.github.com/
10+
# IMPORTANT: Comment out the line above when:
11+
# 1. Publishing the Design System to npm, to avoid publishing to the GitHub Packages Registry.
12+
# 2. Making a release of the application and installing latest version of Dataverse Client Javascript, to avoid installing from the GitHub Packages Registry (otherwise will lead to a npm error code ETARGET).

docs/making-releases.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Making Releases
2+
3+
- [Introduction](#introduction)
4+
- [Regular or Hotfix?](#regular-or-hotfix)
5+
- [Create Github Issue and Release Branch](#create-github-issue-and-release-branch)
6+
- [Update the version](#update-the-version)
7+
- [Use the Latest Dataverse Client Javascript Version](#use-the-latest-dataverse-client-javascript-version)
8+
- [Merge "release branch" into "main"](#merge-release-branch-into-main)
9+
- [Create a Draft Release on GitHub and Tag the Version](#create-a-draft-release-on-github-and-tag-the-version)
10+
- [Merge "release branch" into "develop"](#merge-release-branch-into-develop)
11+
- [Delete "release branch"](#delete-release-branch)
12+
13+
## Introduction
14+
15+
This document is about releasing a new version of the dataverse-frontend repository.
16+
17+
## Regular or Hotfix?
18+
19+
Early on, make sure it’s clear what type of release this is. The steps below describe making both regular releases. Suppose the current version is 1.0.0.
20+
21+
- Regular
22+
- e.g. 1.1.0 (minor)
23+
- e.g. 2.0.0 (major)
24+
- Hotfix
25+
- e.g. 1.1.1 (patch)
26+
27+
## Create Github Issue and Release Branch
28+
29+
First of all create an issue on Github to prepare the release, name it "Release dataverse-frontend vX.X.X".
30+
31+
On your local, create the release branch from the latest from develop and name it release/X.X.X .
32+
33+
## Update the version
34+
35+
To update the version run the command `npm version <X.X.X> --no-git-tag-version`. So if we are releasing version `3.5.0` the command will be:
36+
37+
```shell
38+
npm version 3.5.0 --no-git-tag-version
39+
```
40+
41+
This command will update the version in the `package.json` and `package-lock.json`.
42+
43+
## Use the Latest Dataverse Client Javascript Version
44+
45+
During development, the `@iqss/dataverse-client-javascript` package is installed from the [GitHub Packages Registry](https://github.com/IQSS/dataverse-client-javascript/pkgs/npm/dataverse-client-javascript), where we publish versions from PRs and the develop branch. However, for production we are going to use the latest published version of `@iqss/dataverse-client-javascript` package [from npm](https://www.npmjs.com/package/@iqss/dataverse-client-javascript?activeTab=versions).
46+
47+
⚠️ Before next step please ensure that any lines registering the `@iqss` scope with the GitHub Packages registry are commented out in the `.npmrc` file. Otherwise, you will encounter an error when trying to install the package as it will attempt to fetch the package from the GitHub registry instead of npm.
48+
49+
You can do this by running the following command in the root of the repository:
50+
51+
```shell
52+
npm install @iqss/dataverse-client-javascript@latest --save --save-exact
53+
```
54+
55+
This command will update the `package.json` and `package-lock.json` files with the latest version of the `dataverse-client-javascript` package.
56+
57+
If a Dockerized image of the upcoming Dataverse release is available (see [gdcc dataverse tags](https://hub.docker.com/r/gdcc/dataverse/tags)), please update the `E2E_DATAVERSE_IMAGE_TAG` in `workflows/test.yml`. This will make e2e tests on github actions to run against the new dataverse version.
58+
59+
If everything looks good, you can push the changes to the repository.
60+
61+
## Merge "release branch" into "main"
62+
63+
Create a pull request to merge the `release` branch into the `main` branch.
64+
Once important tests have passed (component and e2e) and the code has been reviewed, merge the pull request.
65+
Optionally, still to be defined, the frontend should be deployed to a test environment to verify that everything works as expected against the latest Dataverse release.
66+
67+
## Create a Draft Release on GitHub and Tag the Version
68+
69+
After merging the `release` branch into the `main` branch, you should create a release on GitHub and tag the version.
70+
71+
Go to https://github.com/IQSS/dataverse-frontend/releases/new to start creating a draft release.
72+
73+
- Under "Choose a tag" you will be creating a new tag. Have it start with a "v" such as v3.5.0. Click "Create new tag on publish".
74+
75+
- Under "Target", choose "main".
76+
77+
- Under "Release title" use the same name as the tag such as v3.5.0.
78+
79+
- Add a description of the changes included in this release. Summarize the key updates, fixes, or features.
80+
81+
- Click "Save draft" because we do not want to publish the release yet.
82+
83+
At this point you can send around the draft release for any final feedback. Make corrections to the draft, if necessary. Publish once everything is ok.
84+
85+
## Merge "release branch" into "develop"
86+
87+
After merging the release branch into `main`, ensure the develop branch is updated with the latest changes.
88+
89+
```shell
90+
git checkout develop
91+
git merge release/X.X.X
92+
git push origin develop
93+
```
94+
95+
## Delete "release branch"
96+
97+
Once the release process is complete and the `release` branch has been merged into both `main` and `develop`, you can safely delete the `release` branch to keep the repository clean.
98+
99+
- Delete the branch locally from your repository.
100+
- Delete the branch remotely from the remote repository.
101+
102+
This ensures that the `release` branch is no longer present in either your local or remote repositories.

packages/design-system/cypress.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export default defineConfig({
66
indexHtmlFile: 'tests/support/component-index.html',
77
specPattern: ['tests/component/**/*.spec.{js,jsx,ts,tsx}'],
88
supportFile: 'tests/support/component.ts',
9+
fixturesFolder: 'tests/component/fixtures',
910
devServer: {
1011
framework: 'react',
1112
bundler: 'vite'
48.7 KB
Loading

packages/design-system/tests/component/rich-text-editor/RichTextEditor.spec.tsx

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ const editorContentId = 'test-editor-content-id'
77

88
const textToType = 'Hello Dataverse!'
99

10-
const testImageUrl = 'https://picsum.photos/id/237/640/480'
10+
const testImageUrl = 'https://some-fake-url.com'
1111

1212
describe('RichTextEditor', () => {
13+
beforeEach(() => {
14+
cy.intercept('GET', testImageUrl, { fixture: 'images/dog-640x480.jpg' })
15+
})
16+
1317
it('should render the component', () => {
1418
cy.mount(<RichTextEditor />)
1519

@@ -371,6 +375,8 @@ describe('RichTextEditor', () => {
371375

372376
cy.findByRole('button', { name: 'OK' }).click()
373377

378+
cy.wait(300)
379+
374380
cy.get(`#${editorContentId}`).then((el) => {
375381
const html = el[0].innerHTML
376382
expect(html).to.include(
@@ -389,33 +395,35 @@ describe('RichTextEditor', () => {
389395

390396
cy.findByRole('button', { name: 'OK' }).click()
391397

398+
cy.wait(300)
399+
392400
cy.get(`#${editorContentId}`).then((el) => {
393401
const html = el[0].innerHTML
394402
expect(html).to.include(
395403
`<img src="${testImageUrl}" alt="A random image" class="${RichTextEditorCustomClasses.IMAGE}">`
396404
)
397405
})
398406

399-
cy.findByAltText('A random image').click()
400-
cy.findByLabelText('Align left').click()
407+
cy.findByAltText('A random image').click({ force: true })
408+
cy.findByLabelText('Align left').click({ force: true })
401409
cy.get(`#${editorContentId}`).then((el) => {
402410
const html = el[0].innerHTML
403411
expect(html).to.include(
404412
`<img src="${testImageUrl}" alt="A random image" class="${RichTextEditorCustomClasses.IMAGE} ${RichTextEditorCustomClasses.IMAGE_ALIGN_LEFT}">`
405413
)
406414
})
407415

408-
cy.findByAltText('A random image').click()
409-
cy.findByLabelText('Align center').click()
416+
cy.findByAltText('A random image').click({ force: true })
417+
cy.findByLabelText('Align center').click({ force: true })
410418
cy.get(`#${editorContentId}`).then((el) => {
411419
const html = el[0].innerHTML
412420
expect(html).to.include(
413421
`<img src="${testImageUrl}" alt="A random image" class="${RichTextEditorCustomClasses.IMAGE} ${RichTextEditorCustomClasses.IMAGE_ALIGN_CENTER}">`
414422
)
415423
})
416424

417-
cy.findByAltText('A random image').click()
418-
cy.findByLabelText('Align right').click()
425+
cy.findByAltText('A random image').click({ force: true })
426+
cy.findByLabelText('Align right').click({ force: true })
419427
cy.get(`#${editorContentId}`).then((el) => {
420428
const html = el[0].innerHTML
421429
expect(html).to.include(
@@ -435,6 +443,8 @@ describe('RichTextEditor', () => {
435443

436444
cy.findByRole('button', { name: 'OK' }).click()
437445

446+
cy.wait(300) // Wait for the image to be rendered
447+
438448
cy.get(`#${editorContentId}`).then((el) => {
439449
const html = el[0].innerHTML
440450
expect(html).to.include(
@@ -467,6 +477,8 @@ describe('RichTextEditor', () => {
467477

468478
cy.findByRole('button', { name: 'OK' }).click()
469479

480+
cy.wait(300) // Wait for the image to be rendered
481+
470482
cy.get(`#${editorContentId}`).then((el) => {
471483
const html = el[0].innerHTML
472484
expect(html).to.include(
@@ -499,6 +511,8 @@ describe('RichTextEditor', () => {
499511

500512
cy.findByRole('button', { name: 'OK' }).click()
501513

514+
cy.wait(300) // Wait for the image to be rendered
515+
502516
cy.get(`#${editorContentId}`).then((el) => {
503517
const html = el[0].innerHTML
504518
expect(html).to.include(
@@ -531,6 +545,8 @@ describe('RichTextEditor', () => {
531545

532546
cy.findByRole('button', { name: 'OK' }).click()
533547

548+
cy.wait(300) // Wait for the image to be rendered
549+
534550
cy.get(`#${editorContentId}`).then((el) => {
535551
const html = el[0].innerHTML
536552
expect(html).to.include(

public/locales/en/dataset.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,5 +302,20 @@
302302
"makeDataCountTip": "Each file downloaded is counted as 1, and added to the total download count."
303303
},
304304
"defaultGetDownloadCountError": "Something went wrong while getting the dataset download count. Try again later."
305+
},
306+
"persistentId": {
307+
"name": "Persistent Identifier",
308+
"description": "The Dataset's unique persistent identifier, either a DOI or Handle"
309+
},
310+
"publicationDate": {
311+
"name": "Publication Date",
312+
"description": "The publication date of a Dataset."
313+
},
314+
"alternativePersistentId": {
315+
"name": "Previous Dataset Persistent ID",
316+
"description": "A previously used persistent identifier for the Dataset, either a DOI or Handle"
317+
},
318+
"contact": {
319+
"tip": "Use email button above to contact."
305320
}
306321
}

src/dataset/domain/models/Dataset.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export class DatasetLabel {
2626
) {}
2727
}
2828

29+
// Only for testing purposes and checking the existence of the citation block in some parts of the code
2930
export enum MetadataBlockName {
3031
CITATION = 'citation',
3132
GEOSPATIAL = 'geospatial',
@@ -40,7 +41,7 @@ export enum MetadataBlockName {
4041
export type DatasetMetadataBlocks = [CitationMetadataBlock, ...DatasetMetadataBlock[]]
4142

4243
export interface DatasetMetadataBlock {
43-
name: MetadataBlockName
44+
name: string
4445
fields: DatasetMetadataFields
4546
}
4647

@@ -59,7 +60,7 @@ export type DatasetMetadataFieldValue =
5960
export type DatasetMetadataSubField = Record<string, string | undefined>
6061

6162
export interface CitationMetadataBlock extends DatasetMetadataBlock {
62-
name: MetadataBlockName.CITATION
63+
name: string // 'citation'
6364
fields: {
6465
alternativePersistentId?: string
6566
publicationDate?: string
@@ -408,6 +409,7 @@ export interface DatasetTermsOfUse {
408409

409410
export class Dataset {
410411
constructor(
412+
public readonly id: number,
411413
public readonly persistentId: string,
412414
public readonly version: DatasetVersion,
413415
public readonly internalVersionNumber: number,
@@ -430,7 +432,8 @@ export class Dataset {
430432
public readonly publicationDate?: string,
431433
public readonly nextMajorVersion?: string,
432434
public readonly nextMinorVersion?: string,
433-
public readonly requiresMajorVersionUpdate?: boolean
435+
public readonly requiresMajorVersionUpdate?: boolean,
436+
public readonly fileStore?: string
434437
) {}
435438

436439
public checkIsLockedFromPublishing(userPersistentId: string): boolean {
@@ -503,6 +506,7 @@ export class Dataset {
503506
public readonly alerts: Alert[] = []
504507

505508
constructor(
509+
public readonly id: number,
506510
public readonly persistentId: string,
507511
public readonly version: DatasetVersion,
508512
public readonly internalVersionNumber: number,
@@ -523,7 +527,8 @@ export class Dataset {
523527
public readonly requestedVersion?: string,
524528
public readonly nextMajorVersionNumber?: string,
525529
public readonly nextMinorVersionNumber?: string,
526-
public readonly requiresMajorVersionUpdate?: boolean
530+
public readonly requiresMajorVersionUpdate?: boolean,
531+
public readonly fileStore?: string
527532
) {
528533
this.withAlerts()
529534
}
@@ -571,6 +576,7 @@ export class Dataset {
571576

572577
build(): Dataset {
573578
return new Dataset(
579+
this.id,
574580
this.persistentId,
575581
this.version,
576582
this.internalVersionNumber,
@@ -593,7 +599,8 @@ export class Dataset {
593599
undefined,
594600
this.nextMajorVersionNumber,
595601
this.nextMinorVersionNumber,
596-
this.requiresMajorVersionUpdate
602+
this.requiresMajorVersionUpdate,
603+
this.fileStore
597604
)
598605
}
599606
}

src/dataset/infrastructure/mappers/JSDatasetMapper.ts

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ export class JSDatasetMapper {
4848
privateUrl?: PrivateUrl,
4949
latestPublishedVersionMajorNumber?: number,
5050
latestPublishedVersionMinorNumber?: number,
51-
datasetVersionDiff?: JSDatasetVersionDiff
51+
datasetVersionDiff?: JSDatasetVersionDiff,
52+
fileStore?: string
5253
): Dataset {
5354
const version = JSDatasetVersionMapper.toVersion(
5455
jsDataset.versionId,
@@ -60,6 +61,7 @@ export class JSDatasetMapper {
6061
jsDataset.versionInfo.deaccessionNote as string
6162
)
6263
return new Dataset.Builder(
64+
jsDataset.id,
6365
jsDataset.persistentId,
6466
version,
6567
jsDataset.internalVersionNumber,
@@ -96,7 +98,8 @@ export class JSDatasetMapper {
9698
latestPublishedVersionMajorNumber,
9799
latestPublishedVersionMinorNumber
98100
),
99-
JSDatasetMapper.toRequiresMajorVersionUpdate(datasetVersionDiff)
101+
JSDatasetMapper.toRequiresMajorVersionUpdate(datasetVersionDiff),
102+
fileStore
100103
).build()
101104
}
102105

@@ -173,7 +176,7 @@ export class JSDatasetMapper {
173176
}
174177

175178
return {
176-
name: JSDatasetMapper.toMetadataBlockName(jsDatasetMetadataBlock.name),
179+
name: jsDatasetMetadataBlock.name,
177180
fields: getSummaryFields(jsDatasetMetadataBlock.fields)
178181
}
179182
})
@@ -187,7 +190,7 @@ export class JSDatasetMapper {
187190
): DatasetMetadataBlocks {
188191
return jsDatasetMetadataBlocks.map((jsDatasetMetadataBlock) => {
189192
return {
190-
name: JSDatasetMapper.toMetadataBlockName(jsDatasetMetadataBlock.name),
193+
name: jsDatasetMetadataBlock.name,
191194
fields: JSDatasetMapper.toMetadataFields(
192195
jsDatasetMetadataBlock,
193196
alternativePersistentId,
@@ -198,18 +201,6 @@ export class JSDatasetMapper {
198201
}) as DatasetMetadataBlocks
199202
}
200203

201-
static toMetadataBlockName(jsDatasetMetadataBlockName: string): MetadataBlockName {
202-
const metadataBlockNameKey = Object.values(MetadataBlockName).find((metadataBlockNameKey) => {
203-
return metadataBlockNameKey === jsDatasetMetadataBlockName
204-
})
205-
206-
if (metadataBlockNameKey === undefined) {
207-
throw new Error('Incorrect Metadata block name key')
208-
}
209-
210-
return metadataBlockNameKey
211-
}
212-
213204
static toMetadataFields(
214205
jsDatasetMetadataBlock: JSDatasetMetadataBlock,
215206
alternativePersistentId?: string,

0 commit comments

Comments
 (0)