-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3077 from OpenNeuroOrg/analyze-dropdown
Snapshot page analyze dropdown menu for external tools
- Loading branch information
Showing
14 changed files
with
215 additions
and
97 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -194,7 +194,6 @@ export const SNAPSHOT_FIELDS = gql` | |
} | ||
...SnapshotIssues | ||
hexsha | ||
onBrainlife | ||
} | ||
${SNAPSHOT_ISSUES} | ||
` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
packages/openneuro-app/src/scripts/dataset/components/AnalyzeDropdown.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import React from "react" | ||
import { Dropdown } from "@openneuro/components/dropdown" | ||
import { Button } from "@openneuro/components/button" | ||
import styled from "@emotion/styled" | ||
import BrainlifeIcon from "../../../assets/external/brainlife.png" | ||
import NemarIcon from "../../../assets/external/nemar.png" | ||
import CbrainIcon from "../../../assets/external/cbrain.png" | ||
|
||
export interface CloneDropdownProps { | ||
datasetId: string | ||
snapshotVersion: string | ||
} | ||
|
||
const AnalyzeDiv = styled.div` | ||
padding-right: 1em; | ||
` | ||
|
||
export const AnalyzeDropdown: React.FC<CloneDropdownProps> = ( | ||
{ datasetId, snapshotVersion }, | ||
) => { | ||
const brainlifeUrl = | ||
`https://brainlife.io/openneuro/${datasetId}/${snapshotVersion}` | ||
const nemarUrl = | ||
`https://nemar.org/dataexplorer/detail?dataset_id=${datasetId}` | ||
const cbrainUrl = | ||
`https://portal.cbrain.mcgill.ca/openneuro/${datasetId}/versions/${snapshotVersion}` | ||
return ( | ||
<AnalyzeDiv className="clone-dropdown"> | ||
<Dropdown | ||
label={ | ||
<Button | ||
className="clone-link" | ||
primary={true} | ||
size="small" | ||
label="Analyze" | ||
> | ||
<i className="fas fa-caret-up"></i> | ||
<i className="fas fa-caret-down"></i> | ||
</Button> | ||
} | ||
> | ||
<div className="dataset-git-access"> | ||
<span> | ||
<h4>Analyze this dataset</h4> | ||
</span> | ||
<p> | ||
Work with OpenNeuro datasets using any of these third-party tools. | ||
</p> | ||
<hr /> | ||
<img | ||
src={BrainlifeIcon} | ||
height="16" | ||
width="16" | ||
/>{" "} | ||
<a | ||
href={brainlifeUrl} | ||
target="_blank" | ||
> | ||
View on Brainlife.io | ||
</a> | ||
<p> | ||
Brainlife.io is a free cloud platform for secure neuroscience data | ||
analysis. | ||
</p> | ||
<hr /> | ||
<img | ||
src={NemarIcon} | ||
height="16" | ||
width="16" | ||
/>{" "} | ||
<a | ||
href={nemarUrl} | ||
target="_blank" | ||
> | ||
View on NEMAR | ||
</a> | ||
<p> | ||
View and analyze this dataset on the NEMAR OpenNeuro portal for MEG, | ||
iEEG, and EEG data. | ||
</p> | ||
<hr /> | ||
<img | ||
src={CbrainIcon} | ||
height="16" | ||
width="16" | ||
/>{" "} | ||
<a href={cbrainUrl} target="_blank"> | ||
View on CBRAIN | ||
</a> | ||
<p> | ||
CBRAIN is a web-based distributed computing platform for | ||
collaborative neuroimaging research. | ||
</p> | ||
</div> | ||
</Dropdown> | ||
</AnalyzeDiv> | ||
) | ||
} |
38 changes: 0 additions & 38 deletions
38
packages/openneuro-app/src/scripts/dataset/components/BrainLifeButton.tsx
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
packages/openneuro-app/src/scripts/dataset/components/NemarButton.tsx
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
packages/openneuro-app/src/scripts/dataset/components/__tests__/AnalyzeDropdown.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from "react" | ||
import { fireEvent, render, screen } from "@testing-library/react" | ||
import { AnalyzeDropdown } from "../AnalyzeDropdown" | ||
|
||
describe("AnalyzeDropdown component", () => { | ||
it("opens when clicked", () => { | ||
render( | ||
<AnalyzeDropdown datasetId="ds000031" snapshotVersion="1.0.0" />, | ||
) | ||
|
||
const button = screen.getByRole("button") | ||
const menu = screen.getByRole("menu") | ||
|
||
expect(button).toBeVisible() | ||
expect(menu).toHaveClass("collapsed") | ||
fireEvent.click(button) | ||
expect(menu).toHaveClass("expanded") | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.