Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update resolver to query user by orcid or id #3258

Merged
merged 16 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ GOOGLE_CLIENT_SECRET=

[podman-compose](https://github.com/containers/podman-compose) is used to run a local copy of all required services together.

#### macOS Development Setup
#### macOS Development Setup

If you're working on macOS and encounter issues with file watching in Vite, use the following environment variables (in config.env):

```
Expand Down
3 changes: 2 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"dist",
"packages/**/dist",
"services/datalad/tests/.pytest_cache",
"**/__pycache/**"
"**/__pycache/**",
"**/*.scss"
]
}
}
22 changes: 11 additions & 11 deletions packages/openneuro-app/.scss-lint.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
scss_files: 'src/sass/**/*.scss'
scss_files: "src/sass/**/*.scss"

exclude:
- 'src/sass/animate/**'
- 'src/sass/bootstrap/**'
- 'src/sass/font-awesome/**'
- 'src/sass/fonts/**'
- 'src/sass/_bootstrap-compass.scss'
- 'src/sass/_bootstrap-mincer.scss'
- 'src/sass/_bootstrap-sprockets.scss'
- 'src/sass/_bootstrap.scss'
- 'src/sass/react-select.scss'
- "src/sass/animate/**"
- "src/sass/bootstrap/**"
- "src/sass/font-awesome/**"
- "src/sass/fonts/**"
- "src/sass/_bootstrap-compass.scss"
- "src/sass/_bootstrap-mincer.scss"
- "src/sass/_bootstrap-sprockets.scss"
- "src/sass/_bootstrap.scss"
- "src/sass/react-select.scss"

linters:
BorderZero:
Expand All @@ -26,4 +26,4 @@ linters:
enabled: false

NestingDepth:
enabled: false
enabled: false
48 changes: 28 additions & 20 deletions packages/openneuro-app/maintenance.html

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions packages/openneuro-app/src/@types/custom.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ declare module "*.svg" {
export = value
}



// Allow custom scss modules
declare module "*.module.scss" {
const classes: { [key: string]: string };
export default classes;
const classes: { [key: string]: string }
export default classes
}

// Allow .scss imports
Expand Down
24 changes: 14 additions & 10 deletions packages/openneuro-app/src/index.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
<!DOCTYPE html>
<html>

<head>
<head>
<script src="/crn/config.js" type="module"></script>
<script async src="https://www.googletagmanager.com/gtag/js"></script>
<script src="https://kit.fontawesome.com/fa7ae96ba1.js" crossorigin="anonymous"></script>
<script
src="https://kit.fontawesome.com/fa7ae96ba1.js"
crossorigin="anonymous"
></script>
<meta http-equiv="expires" content="0" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>OpenNeuro</title>
<link id="favicon" rel="icon" type="image/png" href="/favicon.ico" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,700;1,300;1,400;1,700&display=swap" rel="stylesheet">
</head>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,700;1,300;1,400;1,700&display=swap"
rel="stylesheet"
/>
</head>

<body>
<body>
<div id="main"></div>
<script src="/client.jsx" type="module"></script>
</body>

</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
UpdateDatasetPermissions,
} from "../update-permissions"

import { isValidOrcid } from "../../../utils/validationUtils.ts";
import { isValidOrcid } from "../../../utils/validationUtils.ts"

function permissionMocksFactory(
updatePermissionsCalled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import ToastContent from "../../common/partials/toast-content"
import { validate as isValidEmail } from "email-validator"
import { Button } from "@openneuro/components/button"

import { isValidOrcid } from "../../utils/validationUtils";
import { isValidOrcid } from "../../utils/validationUtils"

export const UPDATE_PERMISSIONS = gql`
mutation updatePermissions(
Expand Down
2 changes: 0 additions & 2 deletions packages/openneuro-app/src/scripts/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { Navigate, Route, Routes } from "react-router-dom"
import DatasetQuery from "./dataset/dataset-query"
//import PreRefactorDatasetProps from './dataset/dataset-pre-refactor-container'



import FaqPage from "./pages/faq/faq"
import FrontPageContainer from "./pages/front-page/front-page"
import Admin from "./pages/admin/admin"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,69 +1,78 @@
import React from 'react';
import { render, screen, fireEvent, within, waitFor} from '@testing-library/react';
import { UserAccountView } from '../user-account-view';
import React from "react"
import {
fireEvent,
render,
screen,
waitFor,
within,
} from "@testing-library/react"
import { UserAccountView } from "../user-account-view"

const baseUser = {
name: "John Doe",
email: "[email protected]",
orcid: "0000-0001-2345-6789",
location: "San Francisco, CA",
institution: "University of California",
links: ["https://example.com", "https://example.org"],
github: "johndoe",
};
name: "John Doe",
email: "[email protected]",
orcid: "0000-0001-2345-6789",
location: "San Francisco, CA",
institution: "University of California",
links: ["https://example.com", "https://example.org"],
github: "johndoe",
}

describe('<UserAccountView />', () => {
it('should render the user details correctly', () => {
render(<UserAccountView user={baseUser} />);
describe("<UserAccountView />", () => {
it("should render the user details correctly", () => {
render(<UserAccountView user={baseUser} />)

// Check if user details are rendered
expect(screen.getByText('Name:')).toBeInTheDocument();
expect(screen.getByText('John Doe')).toBeInTheDocument();
expect(screen.getByText('Email:')).toBeInTheDocument();
expect(screen.getByText('[email protected]')).toBeInTheDocument();
expect(screen.getByText('ORCID:')).toBeInTheDocument();
expect(screen.getByText('0000-0001-2345-6789')).toBeInTheDocument();
expect(screen.getByText('johndoe')).toBeInTheDocument();
});
expect(screen.getByText("Name:")).toBeInTheDocument()
expect(screen.getByText("John Doe")).toBeInTheDocument()
expect(screen.getByText("Email:")).toBeInTheDocument()
expect(screen.getByText("[email protected]")).toBeInTheDocument()
expect(screen.getByText("ORCID:")).toBeInTheDocument()
expect(screen.getByText("0000-0001-2345-6789")).toBeInTheDocument()
expect(screen.getByText("johndoe")).toBeInTheDocument()
})

it('should render links with EditableContent', async () => {
render(<UserAccountView user={baseUser} />);
const institutionSection = within(screen.getByText('Institution').closest('.user-meta-block'));
expect(screen.getByText('Institution')).toBeInTheDocument();
const editButton = institutionSection.getByText('Edit');
fireEvent.click(editButton);
const textbox = institutionSection.getByRole('textbox');
fireEvent.change(textbox, { target: { value: 'New University' } });
const saveButton = institutionSection.getByText('Save');
const closeButton = institutionSection.getByText('Close');
fireEvent.click(saveButton);
fireEvent.click(closeButton);
it("should render links with EditableContent", async () => {
render(<UserAccountView user={baseUser} />)
const institutionSection = within(
screen.getByText("Institution").closest(".user-meta-block"),
)
expect(screen.getByText("Institution")).toBeInTheDocument()
const editButton = institutionSection.getByText("Edit")
fireEvent.click(editButton)
const textbox = institutionSection.getByRole("textbox")
fireEvent.change(textbox, { target: { value: "New University" } })
const saveButton = institutionSection.getByText("Save")
const closeButton = institutionSection.getByText("Close")
fireEvent.click(saveButton)
fireEvent.click(closeButton)
// Add debug step
await waitFor(() => screen.debug());
await waitFor(() => screen.debug())
// Use a flexible matcher to check for text
await waitFor(() =>
expect(institutionSection.getByText('New University')).toBeInTheDocument()
);
});

expect(institutionSection.getByText("New University")).toBeInTheDocument()
)
})

it('should render location with EditableContent', async () => {
render(<UserAccountView user={baseUser} />);
const locationSection = within(screen.getByText('Location').closest('.user-meta-block'));
expect(screen.getByText('Location')).toBeInTheDocument();
const editButton = locationSection.getByText('Edit');
fireEvent.click(editButton);
const textbox = locationSection.getByRole('textbox');
fireEvent.change(textbox, { target: { value: 'Marin, CA' } });
const saveButton = locationSection.getByText('Save');
const closeButton = locationSection.getByText('Close');
fireEvent.click(saveButton);
fireEvent.click(closeButton);
it("should render location with EditableContent", async () => {
render(<UserAccountView user={baseUser} />)
const locationSection = within(
screen.getByText("Location").closest(".user-meta-block"),
)
expect(screen.getByText("Location")).toBeInTheDocument()
const editButton = locationSection.getByText("Edit")
fireEvent.click(editButton)
const textbox = locationSection.getByRole("textbox")
fireEvent.change(textbox, { target: { value: "Marin, CA" } })
const saveButton = locationSection.getByText("Save")
const closeButton = locationSection.getByText("Close")
fireEvent.click(saveButton)
fireEvent.click(closeButton)
// Add debug step
await waitFor(() => screen.debug());
await waitFor(() => screen.debug())
// Use a flexible matcher to check for text
await waitFor(() =>
expect(locationSection.getByText('Marin, CA')).toBeInTheDocument()
);
});
});
expect(locationSection.getByText("Marin, CA")).toBeInTheDocument()
)
})
})
Loading
Loading