Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
bc88788
adding new resolver for parsing and printing contributors for datacit…
thinknoack Jun 27, 2025
c5c9509
unused vars
thinknoack Jun 27, 2025
491fa8b
unused vars
thinknoack Jun 27, 2025
3cdaf61
update comment
thinknoack Jun 27, 2025
2edce30
Merge branch 'master' into feature/dataset-contributors-resolver
thinknoack Jun 30, 2025
6455f1b
align contributors data with dataset revisions draft/snapshot - updat…
thinknoack Jun 30, 2025
dde4eed
update contributors - now has component that lists individual contrib…
thinknoack Jun 30, 2025
b62ca61
update draft and snapshot spec
thinknoack Jun 30, 2025
2b3b826
adding small spec for contributors and chaning name of single contrib…
thinknoack Jun 30, 2025
b7c77a9
adding a spec for contributors resolver/module
thinknoack Jun 30, 2025
2607cec
remove comment
thinknoack Jun 30, 2025
1cd1952
comment update
thinknoack Jun 30, 2025
73ac81b
no unused vars
thinknoack Jul 1, 2025
35a8384
typo
thinknoack Jul 1, 2025
563baed
refactor(contributors>creators) - updates schema, resolver, and app t…
thinknoack Jul 8, 2025
c8e7aad
update undefined className to map to empty string
thinknoack Jul 8, 2025
42c95bb
update text content
thinknoack Jul 8, 2025
a446fe9
Merge branch 'master' into feature/dataset-contributors-resolver
thinknoack Jul 8, 2025
02cae9d
add yaml and yml extensions to fileviewertext
thinknoack Jul 10, 2025
257c477
datacite metadata handling with .yml/.yaml support and generic fetchi…
thinknoack Jul 10, 2025
5740c96
update creators spec
thinknoack Jul 10, 2025
5dd61d4
Merge branch 'master' into feature/dataset-contributors-resolver
thinknoack Jul 10, 2025
9aad724
comment update
thinknoack Jul 10, 2025
e10ae55
Merge branch 'master' into feature/dataset-contributors-resolver
thinknoack Jul 16, 2025
e4e2633
add authors array to types
thinknoack Jul 16, 2025
512d415
clean up change
thinknoack Jul 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ export const DRAFT_FRAGMENT = gql`
version
}
}
creators {
name
givenName
familyName
orcid
}
}
}
`
Expand Down Expand Up @@ -223,6 +229,12 @@ export const SNAPSHOT_FIELDS = gql`
}
...SnapshotIssues
hexsha
creators {
name
givenName
familyName
orcid
}
}
${SNAPSHOT_ISSUES}
`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ OCI-1131441 (R. Poldrack, PI) in any publications.
class="col sidebar"
>
<div
class="dataset-meta-block undefined"
class="dataset-meta-block "
>
<h2
class="dmb-heading"
Expand All @@ -775,6 +775,16 @@ OCI-1131441 (R. Poldrack, PI) in any publications.
</h2>
ds001032
</div>
<div
class="dataset-meta-block "
>
<h2
class="dmb-heading"
>
Creators
</h2>
N/A
</div>
<div
class="dataset-meta-block dmb-inline-list"
>
Expand All @@ -800,7 +810,7 @@ OCI-1131441 (R. Poldrack, PI) in any publications.
</a>
</div>
<div
class="dataset-meta-block undefined"
class="dataset-meta-block "
>
<h2
class="dmb-heading"
Expand Down Expand Up @@ -927,7 +937,7 @@ OCI-1131441 (R. Poldrack, PI) in any publications.
N/A
</div>
<div
class="dataset-meta-block undefined"
class="dataset-meta-block "
>
<h2
class="dmb-heading"
Expand All @@ -937,7 +947,7 @@ OCI-1131441 (R. Poldrack, PI) in any publications.
Test User on 2021-12-17 - almost 2 years ago
</div>
<div
class="dataset-meta-block undefined"
class="dataset-meta-block "
>
<h2
class="dmb-heading"
Expand All @@ -947,7 +957,7 @@ OCI-1131441 (R. Poldrack, PI) in any publications.
2021-12-17 - almost 2 years ago
</div>
<div
class="dataset-meta-block undefined"
class="dataset-meta-block "
>
<h2
class="dmb-heading"
Expand All @@ -957,7 +967,7 @@ OCI-1131441 (R. Poldrack, PI) in any publications.
1
</div>
<div
class="dataset-meta-block undefined"
class="dataset-meta-block "
>
<h2
class="dmb-heading"
Expand All @@ -967,7 +977,7 @@ OCI-1131441 (R. Poldrack, PI) in any publications.
2
</div>
<div
class="dataset-meta-block undefined"
class="dataset-meta-block "
>
<h2
class="dmb-heading"
Expand All @@ -981,7 +991,7 @@ OCI-1131441 (R. Poldrack, PI) in any publications.
</a>
</div>
<div
class="dataset-meta-block undefined"
class="dataset-meta-block "
>
<h2
class="dmb-heading"
Expand All @@ -991,7 +1001,7 @@ OCI-1131441 (R. Poldrack, PI) in any publications.
CC0
</div>
<div
class="dataset-meta-block undefined"
class="dataset-meta-block "
>
<h2
class="dmb-heading"
Expand Down Expand Up @@ -1054,7 +1064,7 @@ OCI-1131441 (R. Poldrack, PI) in any publications.
</h5>
</div>
<div
class="dataset-meta-block undefined"
class="dataset-meta-block "
>
<h2
class="dmb-heading"
Expand All @@ -1063,7 +1073,7 @@ OCI-1131441 (R. Poldrack, PI) in any publications.
</h2>
</div>
<div
class="dataset-meta-block undefined"
class="dataset-meta-block "
>
<h2
class="dmb-heading"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import DraftContainer from "../draft-container"
import type { DraftContainerProps } from "../draft-container"
import { UserModalOpenProvider } from "../../utils/user-login-modal-ctx"
import { Cookies, CookiesProvider } from "react-cookie"
import type * as UserQueriesModule from "../../queries/user"

vi.mock("../../config.ts")

Expand All @@ -25,7 +26,6 @@ const mockDataset = {
modified: "2023-01-01T00:00:00.000Z",
description: {
Name: "Test Dataset Name",
Authors: ["Author One", "Author Two"],
},
summary: {
totalFiles: 10,
Expand All @@ -36,6 +36,15 @@ const mockDataset = {
subjects: [],
},
readme: "This is a test dataset readme.",
creators: [
{
name: "Author One",
firstname: "Author",
lastname: "One",
orcid: "0000-0001-2345-6789",
},
{ name: "Author Two", firstname: "Author", lastname: "Two", id: null },
],
},
snapshots: [],
derivatives: [],
Expand Down Expand Up @@ -79,12 +88,54 @@ const renderComponent = (

describe("DraftContainer", () => {
it("renders dataset name and authors", async () => {
vi.mock("../../queries/user", async (importOriginal) => {
const actual = await importOriginal<typeof UserQueriesModule>()
return {
...actual,
useUser: vi.fn((userId) => {
if (userId === "0000-0001-2345-6789") {
return {
user: { id: userId, name: "Author One", orcid: userId },
loading: false,
error: undefined,
}
}
return { user: null, loading: false, error: undefined }
}),
}
})

renderComponent({ dataset: mockDataset })
expect(await screen.findByRole("heading", { level: 1 })).toHaveTextContent(
/Test Dataset Name/,
)
expect(await screen.findByText(/Author One/)).toBeInTheDocument()
expect(await screen.findByText(/Author Two/)).toBeInTheDocument()

const authorOneProfileLink = screen.getByRole("link", {
name: "Author One",
})
expect(authorOneProfileLink).toBeInTheDocument()
expect(authorOneProfileLink).toHaveAttribute(
"href",
"/user/0000-0001-2345-6789",
)

const orcidExternalLink = screen.getByLabelText(
/ORCID profile for Author One/i,
)
expect(orcidExternalLink).toBeInTheDocument()
expect(orcidExternalLink).toHaveAttribute(
"href",
expect.stringContaining("orcid.org/0000-0001-2345-6789"),
)
expect(orcidExternalLink).toHaveAttribute("target", "_blank")
expect(orcidExternalLink).toHaveAttribute("rel", "noopener noreferrer")

const authorTwoProfileLink = screen.queryByRole("link", {
name: /Author Two/i,
})
expect(authorTwoProfileLink).not.toBeInTheDocument()
})

describe("dataset name field", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ export const MetaDataBlock = ({
renderEditor,
}: MetaDataBlockProps) => {
const fieldContent = renderEditor ? renderEditor() : item
const effectiveBlockClass = className || ""
return (
<div className={"dataset-meta-block " + className}>
<div className={`dataset-meta-block ${effectiveBlockClass}`}>
<h2 className="dmb-heading">{heading}</h2>
<>{fieldContent}</>
</div>
Expand Down
12 changes: 11 additions & 1 deletion packages/openneuro-app/src/scripts/dataset/draft-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { DOILink } from "./fragments/doi-link"
import { TabRoutesDraft } from "./routes/tab-routes-draft"
import { FollowToggles } from "./common/follow-toggles"
import { DateDistance } from "../components/date-distance"
import { CreatorListDisplay } from "../users/creators-list"

export interface DraftContainerProps {
dataset
Expand All @@ -48,7 +49,6 @@ const snapshotVersion = (location) => {
const DraftContainer: React.FC<DraftContainerProps> = ({ dataset }) => {
const location = useLocation()
const activeDataset = snapshotVersion(location) || "draft"

const [selectedVersion, setSelectedVersion] = React.useState(activeDataset)
const summary = dataset.draft.summary
const description = dataset.draft.description
Expand Down Expand Up @@ -175,6 +175,16 @@ const DraftContainer: React.FC<DraftContainerProps> = ({ dataset }) => {
heading="OpenNeuro Accession Number"
item={datasetId}
/>

<MetaDataBlock
heading="Creators"
item={
<CreatorListDisplay
creators={dataset.draft.creators}
/>
}
/>

<EditDescriptionList
className="dmb-inline-list"
datasetId={datasetId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const FileViewerType = ({ path, url, data }) => {
path.endsWith(".bidsignore") ||
path.endsWith(".gitignore") ||
path.endsWith(".txt") ||
path.endsWith(".rst")
path.endsWith(".rst") ||
path.endsWith(".yml") || path.endsWith(".yaml")
) {
return <FileViewerText data={data} />
} else if (
Expand Down
10 changes: 10 additions & 0 deletions packages/openneuro-app/src/scripts/dataset/snapshot-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { TabRoutesSnapshot } from "./routes/tab-routes-snapshot"
import schemaGenerator from "../utils/json-ld.js"
import { FollowToggles } from "./common/follow-toggles"
import { DateDistance } from "../components/date-distance"
import { CreatorListDisplay } from "../users/creators-list"

// Helper function for getting version from URL
const snapshotVersion = (location) => {
Expand Down Expand Up @@ -177,6 +178,15 @@ export const SnapshotContainer: React.FC<SnapshotContainerProps> = ({
heading="OpenNeuro Accession Number"
item={datasetId}
/>
<MetaDataBlock
heading="Creators"
item={
<CreatorListDisplay
creators={snapshot.creators}
/>
}
/>

<MetaDataBlock
heading="Authors"
item={description?.Authors?.length
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Link } from "react-router-dom"
import type { SearchResultItemProps } from "./SearchResultItem"
import { ModalityLabel } from "../../components/formatting/modality-label"
import { MetaListItemList } from "./MetaListItemList"
import { CreatorListDisplay } from "../../users/creators-list"
import "../scss/search-result-details.scss"

interface SearchResultDetailsProps {
Expand Down Expand Up @@ -128,7 +129,10 @@ export const SearchResultDetails: FC<SearchResultDetailsProps> = (
)
const authors = renderMetaItem(
"Authors",
<div>{itemData.latestSnapshot?.description?.Authors}</div>,
<CreatorListDisplay
creators={itemData.latestSnapshot?.creators}
separator=", "
/>,
)
const uploaderDisplay = renderMetaItem(
"Uploader by",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import "../scss/search-result.scss"
import activityPulseIcon from "../../../assets/activity-icon.png"
import { hasEditPermissions } from "../../authentication/profile"
import { ModalityHexagon } from "../../components/modality-cube/ModalityHexagon"
import type { Creator } from "../../types/creators"
import { SearchResultsCitation } from "../../components/citation/search-results-citation"

export const formatDate = (dateObject) =>
Expand Down Expand Up @@ -86,6 +87,7 @@ export interface SearchResultItemProps {
Name: string
DatasetDOI: string
}
creators: Creator[]
}
analytics: {
views: number
Expand Down
Loading