Skip to content

Commit 14282ac

Browse files
committed
Merge branch 'develop' into feat/614-replace-file
2 parents 8b08f8d + 668e48f commit 14282ac

File tree

38 files changed

+2121
-329
lines changed

38 files changed

+2121
-329
lines changed

package-lock.json

Lines changed: 862 additions & 193 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/design-system/src/lib/components/form/form-group/form-element/FormCheckbox.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface FormCheckboxProps
1212
}
1313

1414
export const FormCheckbox = React.forwardRef(function FormCheckbox(
15-
{ label, id, isValid, isInvalid, validFeedback, invalidFeedback, ...props }: FormCheckboxProps,
15+
{ label, id, isValid, isInvalid, ...props }: FormCheckboxProps,
1616
ref
1717
) {
1818
return (
@@ -25,8 +25,6 @@ export const FormCheckbox = React.forwardRef(function FormCheckbox(
2525
{...props}
2626
/>
2727
<FormBS.Check.Label>{label}</FormBS.Check.Label>
28-
<FormBS.Control.Feedback type="invalid">{invalidFeedback}</FormBS.Control.Feedback>
29-
<FormBS.Control.Feedback type="valid">{validFeedback}</FormBS.Control.Feedback>
3028
</FormBS.Check>
3129
)
3230
})

packages/design-system/tests/component/form/form-group/FormGroupCheckbox.spec.tsx

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -71,38 +71,6 @@ describe('FormCheckbox', () => {
7171
cy.findByText(tooltipMessage).should('be.visible')
7272
})
7373

74-
it('renders with invalid feedback', () => {
75-
cy.mount(
76-
<FormCheckboxGroup title="Checkbox">
77-
<FormGroup.Checkbox
78-
id="checkbox-1"
79-
label={option1Label}
80-
name={checkboxName}
81-
isInvalid
82-
invalidFeedback="Invalid feedback"
83-
/>
84-
</FormCheckboxGroup>
85-
)
86-
87-
cy.findByText('Invalid feedback').should('exist')
88-
})
89-
90-
it('renders with valid feedback', () => {
91-
cy.mount(
92-
<FormCheckboxGroup title="Checkbox">
93-
<FormGroup.Checkbox
94-
id="checkbox-1"
95-
label={option1Label}
96-
name={checkboxName}
97-
isValid
98-
validFeedback="Valid feedback"
99-
/>
100-
</FormCheckboxGroup>
101-
)
102-
103-
cy.findByText('Valid feedback').should('exist')
104-
})
105-
10674
it('renders with invalid feedback as a group', () => {
10775
cy.mount(
10876
<FormCheckboxGroup title="Checkbox" isInvalid>

public/locales/en/dataset.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,5 +181,40 @@
181181
"majorVersion": "Major Release",
182182
"updateCurrentVersion": "Update Current Version (will permanently overwrite the latest published version)",
183183
"error": "An error occurred while publishing the dataset."
184+
},
185+
"deaccession": {
186+
"warning": "This dataset will no longer be public and a tombstone will display the reason for deaccessioning. Please read the <anchor>documentation</anchor> if you have any questions.",
187+
"version": {
188+
"label": "Which version(s) do you want to deaccession?",
189+
"validation": "Please select at least one version to deaccession."
190+
},
191+
"reason": {
192+
"label": "What is the reason for Deaccession?",
193+
"validation": "Please select a reason for deaccessioning this dataset.",
194+
"options": {
195+
"identifiable": "There is identifiable data in one or more files.",
196+
"retracted": "The research article has been retracted.",
197+
"transferred": "The dataset has been transferred to another repository.",
198+
"irb": "IRB request.",
199+
"legalIssue": "Legal issue or Data Usage Agreement.",
200+
"invalid": "Not a valid dataset."
201+
}
202+
},
203+
"reasonOther": {
204+
"label": "Please enter additional information about the reason for deaccession."
205+
},
206+
"forwardUrl": {
207+
"label": "If applicable, please provide the URL where this dataset can be accessed after deaccessioning.",
208+
"validation": "Please enter a valid URL."
209+
}
210+
},
211+
"confirmDeaccession": {
212+
"title": "Confirm Deaccession",
213+
"message": "Are you sure you want to deaccession? This is permanent and the selected version(s) will no longer be viewable by the public.",
214+
"reason": "Reason for deaccessioning:",
215+
"reasonOther": "Additional information about the reason for deaccession:",
216+
"forwardUrl": "URL where this dataset can be accessed after deaccessioning:",
217+
"cancelButton": "Cancel",
218+
"deaccessionButton": "Deaccession"
184219
}
185220
}

public/locales/en/shared.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"asterisksIndicateRequiredFields": "Asterisks indicate required fields",
33
"remove": "Remove",
44
"add": "Add",
5+
"yes": "Yes",
6+
"no": "No",
57
"cancel": "Cancel",
68
"close": "Close",
79
"continue": "Continue",

src/dataset/domain/models/Dataset.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Alert, AlertMessageKey } from '../../../alert/domain/models/Alert'
22
import { UpwardHierarchyNode } from '../../../shared/hierarchy/domain/models/UpwardHierarchyNode'
33
import { FileDownloadSize } from '../../../files/domain/models/FileMetadata'
4+
import { DatasetVersionSummaryInfo } from '@/dataset/domain/models/DatasetVersionSummaryInfo'
45

56
export enum DatasetLabelSemanticMeaning {
67
DATASET = 'dataset',
@@ -419,7 +420,8 @@ export class Dataset {
419420
public readonly publicationDate?: string,
420421
public readonly nextMajorVersion?: string,
421422
public readonly nextMinorVersion?: string,
422-
public readonly requiresMajorVersionUpdate?: boolean
423+
public readonly requiresMajorVersionUpdate?: boolean,
424+
public readonly versionsSummaries?: DatasetVersionSummaryInfo[]
423425
) {}
424426

425427
public checkIsLockedFromPublishing(userPersistentId: string): boolean {
@@ -512,7 +514,8 @@ export class Dataset {
512514
public readonly requestedVersion?: string,
513515
public readonly nextMajorVersionNumber?: string,
514516
public readonly nextMinorVersionNumber?: string,
515-
public readonly requiresMajorVersionUpdate?: boolean
517+
public readonly requiresMajorVersionUpdate?: boolean,
518+
public readonly versionsSummaries?: DatasetVersionSummaryInfo[]
516519
) {
517520
this.withAlerts()
518521
}
@@ -581,7 +584,8 @@ export class Dataset {
581584
undefined,
582585
this.nextMajorVersionNumber,
583586
this.nextMinorVersionNumber,
584-
this.requiresMajorVersionUpdate
587+
this.requiresMajorVersionUpdate,
588+
this.versionsSummaries
585589
)
586590
}
587591
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
export interface DatasetVersionSummaryInfo {
2+
id: number
3+
versionNumber: string
4+
summary?: DatasetVersionSummary | DatasetVersionSummaryStringValues
5+
contributors: string
6+
publishedOn?: string
7+
}
8+
9+
export type DatasetVersionSummary = {
10+
[key: string]: SummaryUpdates | SummaryUpdatesWithFields | FilesSummaryUpdates | boolean
11+
}
12+
13+
interface SummaryUpdates {
14+
added: number
15+
deleted: number
16+
changed: number
17+
}
18+
19+
interface SummaryUpdatesWithFields {
20+
[key: string]: SummaryUpdates
21+
}
22+
23+
interface FilesSummaryUpdates {
24+
added: number
25+
removed: number
26+
replaced: number
27+
changedFileMetaData: number
28+
changedVariableMetadata: number
29+
}
30+
31+
export enum DatasetVersionSummaryStringValues {
32+
firstPublished = 'firstPublished',
33+
firstDraft = 'firstDraft',
34+
versionDeaccessioned = 'versionDeaccessioned',
35+
previousVersionDeaccessioned = 'previousVersionDeaccessioned'
36+
}

src/dataset/domain/repositories/DatasetRepository.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { DatasetPaginationInfo } from '../models/DatasetPaginationInfo'
44
import { DatasetDTO } from '../useCases/DTOs/DatasetDTO'
55
import { DatasetsWithCount } from '../models/DatasetsWithCount'
66
import { VersionUpdateType } from '../models/VersionUpdateType'
7+
import { DatasetDeaccessionDTO } from '../useCases/DTOs/DatasetDTO'
78

89
export interface DatasetRepository {
910
getByPersistentId: (
@@ -22,6 +23,12 @@ export interface DatasetRepository {
2223

2324
create: (dataset: DatasetDTO, collectionId: string) => Promise<{ persistentId: string }>
2425
updateMetadata: (datasetId: string | number, datasetDTO: DatasetDTO) => Promise<void>
26+
deaccession: (
27+
datasetId: string | number,
28+
version: string,
29+
deaccessionDTO: DatasetDeaccessionDTO
30+
) => Promise<void>
31+
2532
getAllWithCount: (
2633
collectionId: string,
2734
paginationInfo: DatasetPaginationInfo

src/dataset/domain/useCases/DTOs/DatasetDTO.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,8 @@ type DatasetMetadataFieldValueDTO =
1919
| DatasetMetadataChildFieldValueDTO[]
2020

2121
export type DatasetMetadataChildFieldValueDTO = Record<string, string>
22+
23+
export interface DatasetDeaccessionDTO {
24+
deaccessionReason: string
25+
deaccessionForwardURL?: string
26+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { DatasetRepository } from '../repositories/DatasetRepository'
2+
import { DatasetDeaccessionDTO } from '@iqss/dataverse-client-javascript'
3+
4+
export function deaccessionDataset(
5+
datasetRepository: DatasetRepository,
6+
datasetId: string | number,
7+
version: string,
8+
deaccessionDTO: DatasetDeaccessionDTO
9+
): Promise<void> {
10+
return datasetRepository.deaccession(datasetId, version, deaccessionDTO).catch((error: Error) => {
11+
throw new Error(error.message)
12+
})
13+
}

0 commit comments

Comments
 (0)