Skip to content

Commit

Permalink
merge commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ekraffmiller committed Oct 18, 2023
2 parents 17fe1b2 + 410688d commit 1e60adb
Show file tree
Hide file tree
Showing 92 changed files with 2,886 additions and 755 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ jobs:
working-directory: packages/design-system
run: npm run build

- name: Install Playwright
run: npx playwright install

- name: Build Storybook Design System
working-directory: packages/design-system
run: npm run build-storybook --quiet
Expand Down
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,22 +197,36 @@ The environment is accessible through the following URLs:
- SPA: https://beta.dataverse.org/spa
- JSF: https://beta.dataverse.org

## Changes from the Style Guide
## Changes from the original JSF application

### Changes from the Style Guide

The design system and frontend in this repo are inspired by the Dataverse Project [Style Guide](https://guides.dataverse.org/en/latest/style/index.html), but the following changes have been made, especially for accessibility.

### Links
#### Links

We added an underline to links to make them accessible.

### File label
#### File label

Now we are using Bootstrap with a theme, so there is only one definition for the secondary color. Since Bootstrap applies
the secondary color to the labels automatically, the color of the file label is now the global secondary color which is
a lighter shade of grey than what it used to be.

We changed the citation block to be white with a colored border, to make the text in the box more accessible.

### Changes in functionality behavior

Our main goal is to replicate the behavior of the original JSF application in all its functionalities, although during development we have found opportunities to review certain behaviors and apply changes where we find appropriate.

#### Dataset files tab search

The original Dataset JSF page uses Solr to search for files based on the available filters. Past dataset versions are not indexed in Solr, so the filter option is not available (hidden) for such versions. When a version is indexed, the search text is searched in Solr, and Solr grammar can be applied. When the version is not indexed, the search text is searched in the database.

The new SPA does not use Solr as the API endpoint it uses performs all queries on the database. Filters and search options are available for all versions in the same way, homogenizing behavior, although losing the possibility of using the Solr grammar.

The decision of this change is made on the assumption that Solr may not be required in the context of files tab search, whose search facets are reduced compared to other in-application searches. Therefore, if we find evidence that the assumption is incorrect, we will work on extending the search capabilities to support Solr.

## Thanks

<a href="https://www.chromatic.com/"><img src="https://user-images.githubusercontent.com/321738/84662277-e3db4f80-af1b-11ea-88f5-91d67a5e59f6.png" width="153" height="30" alt="Chromatic" /></a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,18 @@ $navbar-brand-font-size: $dv-brand-font-size;
justify-content: end;
}

.dropdown-menu > .dropdown > .dropdown-toggle {
width: 100%;
text-align: start;
background-color: transparent;
border-color: transparent;
}

.dropdown-menu > .dropdown > .dropdown-toggle:hover {
background-color: $dropdown-link-hover-bg;
border-color: transparent;
}

th {
vertical-align: middle;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import "src/lib/assets/styles/design-tokens/colors.module";

.border > button {
.border > button, .border > [role="group"] > button {
border: 1px solid $dv-button-border-color;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,17 @@ interface ButtonGroupProps extends React.HTMLAttributes<HTMLElement> {
vertical?: boolean
}

export function ButtonGroup({ vertical, children, ...props }: PropsWithChildren<ButtonGroupProps>) {
export function ButtonGroup({
vertical,
children,
className,
...props
}: PropsWithChildren<ButtonGroupProps>) {
return (
<ButtonGroupBS vertical={vertical} className={styles.border} {...props}>
<ButtonGroupBS
vertical={vertical}
className={`${styles.border} ${className ? className : ''}`}
{...props}>
{children}
</ButtonGroupBS>
)
Expand Down
38 changes: 37 additions & 1 deletion public/locales/en/dataset.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,43 @@
"learnAbout": "Learn About",
"standards": "Data Citation Standards"
},
"actions": {
"datasetActionButtons": {
"title": "Dataset Action Buttons",
"submitForReview": {
"enabled": "Submit for Review",
"disabled": "Submitted for Review"
},
"publish": {
"title": "Publish Dataset",
"publish": "Publish",
"returnToAuthor": "Return to Author",
"changeCurationStatus": "Change Curation Status",
"removeCurrentStatus": "Remove Current Status"
},
"linkDataset": {
"title": "Link Dataset"
},
"editDataset": {
"title": "Edit Dataset",
"filesUpload": "Files (Upload)",
"metadata": "Metadata",
"terms": "Terms",
"privateUrl": "Private URL",
"thumbnailsPlusWidgets": "Thumbnails + Widgets",
"delete": {
"draft": "Delete Draft Version",
"released": "Delete Dataset"
},
"deaccession": "Deaccession Dataset",
"permissions": {
"title": "Permissions",
"dataset": "Dataset",
"file": "File"
}
},
"accessDataset": {
"title": "Access Dataset"
},
"uploadFiles": "Upload Files"
},
"alerts": {
Expand Down
77 changes: 71 additions & 6 deletions src/dataset/domain/models/Dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,7 @@ export enum DatasetPublishingStatus {
RELEASED = 'released',
DRAFT = 'draft',
DEACCESSIONED = 'deaccessioned',
EMBARGOED = 'embargoed',
IN_REVIEW = 'inReview'
EMBARGOED = 'embargoed'
}

export enum DatasetNonNumericVersion {
Expand All @@ -232,6 +231,9 @@ export class DatasetVersion {
constructor(
public readonly id: number,
public readonly publishingStatus: DatasetPublishingStatus,
public readonly isLatest: boolean,
public readonly isInReview: boolean,
public readonly latestVersionStatus: DatasetPublishingStatus,
public readonly majorNumber?: number,
public readonly minorNumber?: number,
// requestedVersion will be set if the user requested a version that did not exist.
Expand All @@ -246,6 +248,32 @@ export class DatasetVersion {
}
}

export interface DatasetPermissions {
canDownloadFiles: boolean
canUpdateDataset: boolean
canPublishDataset: boolean
canManageDatasetPermissions: boolean
canManageFilesPermissions: boolean
canDeleteDataset: boolean
}

export interface DatasetLock {
id: number
reason: DatasetLockReason
}

export enum DatasetLockReason {
INGEST = 'ingest',
WORKFLOW = 'workflow',
IN_REVIEW = 'inReview',
DCM_UPLOAD = 'dcmUpload',
GLOBUS_UPLOAD = 'globusUpload',
FINALIZE_PUBLICATION = 'finalizePublication',

EDIT_IN_PROGRESS = 'editInProgress',
FILE_VALIDATION_FAILED = 'fileValidationFailed'
}

export class Dataset {
constructor(
public readonly persistentId: string,
Expand All @@ -255,13 +283,40 @@ export class Dataset {
public readonly alerts: DatasetAlert[],
public readonly summaryFields: DatasetMetadataBlock[],
public readonly license: DatasetLicense,
public readonly metadataBlocks: DatasetMetadataBlocks
public readonly metadataBlocks: DatasetMetadataBlocks,
public readonly permissions: DatasetPermissions,
public readonly locks: DatasetLock[],
public readonly hasValidTermsOfAccess: boolean,
public readonly isValid: boolean,
public readonly isReleased: boolean
) {}

public getTitle(): string {
return this.metadataBlocks[0].fields.title
}

public get isLockedFromPublishing(): boolean {
return this.isLockedFromEdits
}

public get isLocked(): boolean {
return this.locks.length > 0
}

public get isLockedInWorkflow(): boolean {
return this.locks.some((lock) => lock.reason === DatasetLockReason.WORKFLOW)
}

public get isLockedFromEdits(): boolean {
const lockedReasonIsInReview = this.locks.some(
(lock) => lock.reason === DatasetLockReason.IN_REVIEW
)
// If the lock reason is workflow and the workflow userId is the same as the current user, then the user can edit
// TODO - Ask how we want to manage pending workflows

return this.isLocked && !(lockedReasonIsInReview && this.permissions.canPublishDataset)
}

static Builder = class {
public readonly labels: DatasetLabel[] = []
public readonly alerts: DatasetAlert[] = []
Expand All @@ -273,6 +328,11 @@ export class Dataset {
public readonly summaryFields: DatasetMetadataBlock[],
public readonly license: DatasetLicense = defaultLicense,
public readonly metadataBlocks: DatasetMetadataBlocks,
public readonly permissions: DatasetPermissions,
public readonly locks: DatasetLock[],
public readonly hasValidTermsOfAccess: boolean,
public readonly isValid: boolean,
public readonly isReleased: boolean,
public readonly privateUrl?: string
) {
this.withLabels()
Expand All @@ -291,7 +351,7 @@ export class Dataset {
)
}

if (this.version.publishingStatus !== DatasetPublishingStatus.RELEASED) {
if (!this.isReleased) {
this.labels.push(
new DatasetLabel(DatasetLabelSemanticMeaning.WARNING, DatasetLabelValue.UNPUBLISHED)
)
Expand All @@ -309,7 +369,7 @@ export class Dataset {
)
}

if (this.version.publishingStatus === DatasetPublishingStatus.IN_REVIEW) {
if (this.version.isInReview) {
this.labels.push(
new DatasetLabel(DatasetLabelSemanticMeaning.SUCCESS, DatasetLabelValue.IN_REVIEW)
)
Expand Down Expand Up @@ -363,7 +423,12 @@ export class Dataset {
this.alerts,
this.summaryFields,
this.license,
this.metadataBlocks
this.metadataBlocks,
this.permissions,
this.locks,
this.hasValidTermsOfAccess,
this.isValid,
this.isReleased
)
}
}
Expand Down
47 changes: 43 additions & 4 deletions src/dataset/infrastructure/mappers/JSDatasetMapper.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,45 @@
import {
Dataset as JSDataset,
DatasetMetadataBlocks as JSDatasetMetadataBlocks,
DatasetMetadataBlock as JSDatasetMetadataBlock,
DatasetMetadataBlocks as JSDatasetMetadataBlocks,
DatasetMetadataFields as JSDatasetMetadataFields,
DatasetVersionInfo as JSDatasetVersionInfo
} from '@iqss/dataverse-client-javascript'
import { DatasetVersionState as JSDatasetVersionState } from '@iqss/dataverse-client-javascript/dist/datasets/domain/models/Dataset'
import {
Dataset,
DatasetPublishingStatus,
MetadataBlockName,
DatasetMetadataBlock,
DatasetVersion,
DatasetMetadataBlocks,
DatasetMetadataFields,
DatasetMetadataBlocks
DatasetVersion,
MetadataBlockName
} from '../../domain/models/Dataset'

/*
static Builder = class {
public readonly labels: DatasetLabel[] = []
public readonly alerts: DatasetAlert[] = []
constructor(
public readonly persistentId: string,
public readonly version: DatasetVersion,
public readonly citation: string,
public readonly summaryFields: DatasetMetadataBlock[],
public readonly license: DatasetLicense = defaultLicense,
public readonly metadataBlocks: DatasetMetadataBlocks,
public readonly permissions: DatasetPermissions,
public readonly locks: DatasetLock[],
public readonly hasValidTermsOfAccess: boolean,
public readonly isValid: boolean,
public readonly isReleased: boolean,
public readonly privateUrl?: string
) {
this.withLabels()
this.withAlerts()
}
*/
export class JSDatasetMapper {
static toDataset(
jsDataset: JSDataset,
Expand All @@ -36,6 +60,18 @@ export class JSDatasetMapper {
jsDataset.publicationDate,
jsDataset.citationDate
),
{
canDownloadFiles: true,
canUpdateDataset: true,
canPublishDataset: true,
canManageDatasetPermissions: true,
canManageFilesPermissions: true,
canDeleteDataset: true
}, // TODO Connect with dataset permissions
[], // TODO Connect with dataset locks
true, // TODO Connect with dataset hasValidTermsOfAccess
true, // TODO Connect with dataset isValid
!!jsDataset.versionInfo.releaseTime, // TODO Connect with dataset isReleased,
privateUrl
).build()
}
Expand All @@ -48,6 +84,9 @@ export class JSDatasetMapper {
return new DatasetVersion(
jDatasetVersionId,
JSDatasetMapper.toStatus(jsDatasetVersionInfo.state),
true, // TODO Connect with dataset version isLatest
false, // TODO Connect with dataset version isInReview
JSDatasetMapper.toStatus(jsDatasetVersionInfo.state), // TODO Connect with dataset version latestVersionState
jsDatasetVersionInfo.majorNumber,
jsDatasetVersionInfo.minorNumber,
requestedVersion
Expand Down
Loading

0 comments on commit 1e60adb

Please sign in to comment.